forked from mirrors/gecko-dev
Bug 1378767 - Enable ESLint for extensions/pref/ r=standard8
MozReview-Commit-ID: BJWBoD3lcTb --HG-- extra : rebase_source : b3ee9d94abdbe19a355c85da2b5abf148fe43689
This commit is contained in:
parent
aeaad5857f
commit
53e34790cc
5 changed files with 58 additions and 58 deletions
|
|
@ -15,7 +15,9 @@ db/**
|
|||
docshell/**
|
||||
editor/**
|
||||
embedding/**
|
||||
extensions/**
|
||||
extensions/cookie/**
|
||||
extensions/spellcheck/**
|
||||
extensions/universalchardet/**
|
||||
gfx/**
|
||||
gradle/**
|
||||
hal/**
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* global processLDAPValues */
|
||||
/* -*- tab-width: 4; indent-tabs-mode: nil; js-indent-level: 4 -*-
|
||||
* 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
|
||||
|
|
@ -31,15 +32,12 @@ function pref(prefName, value) {
|
|||
return;
|
||||
}
|
||||
prefBranch.setCharPref(prefName, value);
|
||||
}
|
||||
else if (typeof value == "number") {
|
||||
} else if (typeof value == "number") {
|
||||
prefBranch.setIntPref(prefName, value);
|
||||
}
|
||||
else if (typeof value == "boolean") {
|
||||
} else if (typeof value == "boolean") {
|
||||
prefBranch.setBoolPref(prefName, value);
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
} catch (e) {
|
||||
displayError("pref", e);
|
||||
}
|
||||
}
|
||||
|
|
@ -56,15 +54,12 @@ function defaultPref(prefName, value) {
|
|||
return;
|
||||
}
|
||||
prefBranch.setCharPref(prefName, value);
|
||||
}
|
||||
else if (typeof value == "number") {
|
||||
} else if (typeof value == "number") {
|
||||
prefBranch.setIntPref(prefName, value);
|
||||
}
|
||||
else if (typeof value == "boolean") {
|
||||
} else if (typeof value == "boolean") {
|
||||
prefBranch.setBoolPref(prefName, value);
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
} catch (e) {
|
||||
displayError("defaultPref", e);
|
||||
}
|
||||
}
|
||||
|
|
@ -80,8 +75,7 @@ function lockPref(prefName, value) {
|
|||
defaultPref(prefName, value);
|
||||
|
||||
prefBranch.lockPref(prefName);
|
||||
}
|
||||
catch(e) {
|
||||
} catch (e) {
|
||||
displayError("lockPref", e);
|
||||
}
|
||||
}
|
||||
|
|
@ -92,8 +86,7 @@ function unlockPref(prefName) {
|
|||
|
||||
var prefBranch = getPrefBranch();
|
||||
prefBranch.unlockPref(prefName);
|
||||
}
|
||||
catch(e) {
|
||||
} catch (e) {
|
||||
displayError("unlockPref", e);
|
||||
}
|
||||
}
|
||||
|
|
@ -119,10 +112,10 @@ function getPref(prefName) {
|
|||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
} catch (e) {
|
||||
displayError("getPref", e);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function clearPref(prefName) {
|
||||
|
|
@ -130,8 +123,7 @@ function clearPref(prefName) {
|
|||
try {
|
||||
var prefBranch = getPrefBranch();
|
||||
prefBranch.clearUserPref(prefName);
|
||||
}
|
||||
catch(e) {
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -159,8 +151,7 @@ function getLDAPAttributes(host, base, filter, attribs, isSecure) {
|
|||
gVersion = Components.interfaces.nsILDAPConnection.VERSION3
|
||||
// user supplied method
|
||||
processLDAPValues(ldapquery.getQueryResults(url, gVersion));
|
||||
}
|
||||
catch(e) {
|
||||
} catch (e) {
|
||||
displayError("getLDAPAttibutes", e);
|
||||
}
|
||||
}
|
||||
|
|
@ -184,10 +175,10 @@ function getLDAPValue(str, key) {
|
|||
end_pos = str.length;
|
||||
|
||||
return str.substring(start_pos, end_pos);
|
||||
}
|
||||
catch(e) {
|
||||
} catch (e) {
|
||||
displayError("getLDAPValue", e);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function displayError(funcname, message) {
|
||||
|
|
@ -202,8 +193,7 @@ function displayError(funcname, message) {
|
|||
var title = bundle.GetStringFromName("autoConfigTitle");
|
||||
var msg = bundle.formatStringFromName("autoConfigMsg", [funcname], 1);
|
||||
promptService.alert(null, title, msg + " " + message);
|
||||
}
|
||||
catch(e) { }
|
||||
} catch (e) { }
|
||||
}
|
||||
|
||||
function getenv(name) {
|
||||
|
|
@ -211,9 +201,8 @@ function getenv(name) {
|
|||
var environment = Components.classes["@mozilla.org/process/environment;1"].
|
||||
getService(Components.interfaces.nsIEnvironment);
|
||||
return environment.get(name);
|
||||
}
|
||||
catch(e) {
|
||||
} catch (e) {
|
||||
displayError("getEnvironment", e);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
|
|||
7
extensions/pref/autoconfig/test/unit/.eslintrc.js
Normal file
7
extensions/pref/autoconfig/test/unit/.eslintrc.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"plugin:mozilla/xpcshell-test"
|
||||
]
|
||||
};
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
/* global pref */
|
||||
pref("general.config.filename", "autoconfig.cfg");
|
||||
pref("general.config.vendor", "autoconfig");
|
||||
pref("general.config.obscure_value", 0);
|
||||
|
|
|
|||
|
|
@ -3,14 +3,16 @@
|
|||
|
||||
var {classes: Cc, interfaces: Ci, results: Cr} = Components;
|
||||
|
||||
/* eslint no-unsafe-finally: "off"*/
|
||||
/* Turning off this rule to allow control flow operations in finally block
|
||||
* http://eslint.org/docs/rules/no-unsafe-finally */
|
||||
function run_test() {
|
||||
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
let obsvc = Cc['@mozilla.org/observer-service;1'].
|
||||
let obsvc = Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
let ps = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefService);
|
||||
let defaultPrefs = ps.getDefaultBranch(null);
|
||||
let prefs = ps.getBranch(null);
|
||||
|
||||
let greD = dirSvc.get("GreD", Ci.nsIFile);
|
||||
|
|
@ -94,4 +96,3 @@ function run_test() {
|
|||
ps.resetPrefs();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue