Update eslint-plugin-mozilla, and enable mozilla/use-services rule.

This commit is contained in:
Mark Banner 2017-11-24 16:58:36 +00:00
parent c236790fb4
commit 3065197cc4
4 changed files with 8 additions and 14 deletions

View File

@ -1,8 +1,4 @@
{
"extends": [
../../.eslintrc
],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "script"
@ -19,6 +15,7 @@
"rules": {
"mozilla/import-globals": "error",
"mozilla/use-services": "error",
// Best Practices
"consistent-return": "error",

View File

@ -144,9 +144,7 @@ function startup(aData, aReason) {
pdfStreamConverterFactory.register(PdfStreamConverter);
try {
let globalMM = Cc["@mozilla.org/globalmessagemanager;1"]
.getService(Ci.nsIFrameScriptLoader);
globalMM.loadFrameScript("chrome://pdf.js/content/content.js", true);
Services.mm.loadFrameScript("chrome://pdf.js/content/content.js", true);
e10sEnabled = true;
} catch (ex) {
}

View File

@ -122,9 +122,8 @@ function getDOMWindow(aChannel) {
}
function getLocalizedStrings(path) {
var stringBundle = Cc["@mozilla.org/intl/stringbundle;1"].
getService(Ci.nsIStringBundleService).
createBundle("chrome://pdf.js/locale/" + path);
var stringBundle =
Services.strings.createBundle("chrome://pdf.js/locale/" + path);
var map = {};
var enumerator = stringBundle.getSimpleEnumeration();
@ -1028,11 +1027,10 @@ PdfStreamConverter.prototype = {
// We can use the resource principal when data is fetched by the chrome,
// e.g. useful for NoScript. Make make sure we reuse the origin attributes
// from the request channel to keep isolation consistent.
var ssm = Cc["@mozilla.org/scriptsecuritymanager;1"]
.getService(Ci.nsIScriptSecurityManager);
var uri = NetUtil.newURI(PDF_VIEWER_WEB_PAGE);
var resourcePrincipal =
ssm.createCodebasePrincipal(uri, aRequest.loadInfo.originAttributes);
Services.scriptSecurityManager.createCodebasePrincipal(uri,
aRequest.loadInfo.originAttributes);
aRequest.owner = resourcePrincipal;
channel.asyncOpen2(proxy);

View File

@ -10,7 +10,8 @@
"core-js": "^2.5.1",
"escodegen": "^1.9.0",
"eslint": "^4.10.0",
"eslint-plugin-mozilla": "^0.4.5",
"eslint-plugin-mozilla": "^0.4.9",
"eslint-plugin-no-unsanitized": "^2.0.1",
"gulp": "^3.9.1",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.6.1",