Skip to content

Commit

Permalink
Bug 1554121 - Enable most ESLint rules for extensions/permissions, ex…
Browse files Browse the repository at this point in the history
…tensions/spellcheck and extensions/universalchardet. r=Ehsan

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

--HG--
extra : moz-landing-system : lando
  • Loading branch information
Standard8 committed May 24, 2019
1 parent 943dde7 commit 6971980
Show file tree
Hide file tree
Showing 13 changed files with 136 additions and 113 deletions.
3 changes: 0 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ obj*/**
# We ignore all these directories by default, until we get them enabled.
# If you are enabling a directory, please add directory specific exclusions
# below.
extensions/permissions/**
extensions/spellcheck/**
extensions/universalchardet/**
image/**
layout/**
netwerk/cookie/test/browser/**
Expand Down
31 changes: 31 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,36 @@ module.exports = {
...mochitestTestPaths.map(path => `${path}/**/*.js`),
...chromeTestPaths.map(path => `${path}/**/*.js`),
],
}, {
"files": [
"extensions/permissions/test/**",
"extensions/spellcheck/**",
"extensions/universalchardet/tests/**",
],
"rules": {
"mozilla/reject-importGlobalProperties": "off",
"mozilla/use-default-preference-values": "off",
"mozilla/use-services": "off",
"no-array-constructor": "off",
"no-undef": "off",
"no-unused-vars": "off",
"no-redeclare": "off",
"no-global-assign": "off",

// Not enabling the rules below for now pending prettier roll-out.
"brace-style": "off",
"comma-dangle": "off",
"linebreak-style": "off",
"no-tabs": "off",
"no-mixed-spaces-and-tabs": "off",
"no-multi-spaces": "off",
"no-trailing-spaces": "off",
"padded-blocks": "off",
"quotes": "off",
"semi": "off",
"space-infix-ops": "off",


}
}]
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ function promiseTimeout(delay) {
});
}

function run_test() {
run_next_test();
}

add_task(async function do_test() {
// setup a profile.
do_get_profile();
Expand Down Expand Up @@ -46,7 +42,7 @@ add_task(async function do_test() {
Services.prefs.setCharPref("permissions.manager.defaultsUrl", "file://" + file.path);

// This will force the permission-manager to reload the data.
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk", "");
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk");

let pm = Cc["@mozilla.org/permissionmanager;1"].
getService(Ci.nsIPermissionManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function run_test() {
}

// This will force the permission-manager to reload the data.
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk", "");
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk");

let earliestNow = Number(Date.now());
// Initialize the permission manager service
Expand Down
20 changes: 10 additions & 10 deletions extensions/permissions/test/unit/test_permmanager_migrate_4-7.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ add_task(async function test() {

return {
id: thisId,
host: host,
type: type,
permission: permission,
expireType: expireType,
expireTime: expireTime,
modificationTime: modificationTime,
appId: appId,
isInBrowserElement: isInBrowserElement
host,
type,
permission,
expireType,
expireTime,
modificationTime,
appId,
isInBrowserElement
};
}

Expand Down Expand Up @@ -157,7 +157,7 @@ add_task(async function test() {
await PlacesTestUtils.addVisits(Services.io.newURI("ftp://some.subdomain.of.foo.com:8000/some/subdirectory"));

// This will force the permission-manager to reload the data.
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk", "");
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk");

// Force initialization of the nsPermissionManager
for (let permission of Services.perms.enumerator) {
Expand Down Expand Up @@ -190,7 +190,7 @@ add_task(async function test() {

// Check to make sure that all of the tables which we care about are present
{
let db = Services.storage.openDatabase(GetPermissionsFile(profile));
db = Services.storage.openDatabase(GetPermissionsFile(profile));
Assert.ok(db.tableExists("moz_perms"));
Assert.ok(db.tableExists("moz_hosts"));
Assert.ok(!db.tableExists("moz_hosts_is_backup"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ var PERMISSIONS_FILE_NAME = "permissions.sqlite";

var CONTRACT_ID = "@mozilla.org/browser/nav-history-service;1";
var factory = {
createInstance: function() {
createInstance() {
throw new Error("There is no history service");
},
lockFactory: function() {
lockFactory() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory])
Expand Down Expand Up @@ -102,14 +102,14 @@ add_task(function test() {

return {
id: thisId,
host: host,
type: type,
permission: permission,
expireType: expireType,
expireTime: expireTime,
modificationTime: modificationTime,
appId: appId,
isInBrowserElement: isInBrowserElement
host,
type,
permission,
expireType,
expireTime,
modificationTime,
appId,
isInBrowserElement
};
}

Expand Down Expand Up @@ -174,7 +174,7 @@ add_task(function test() {
let found = expected.map((it) => 0);

// This will force the permission-manager to reload the data.
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk", "");
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk");

// Force initialization of the nsPermissionManager
for (let permission of Services.perms.enumerator) {
Expand Down Expand Up @@ -207,7 +207,7 @@ add_task(function test() {

// Check to make sure that all of the tables which we care about are present
{
let db = Services.storage.openDatabase(GetPermissionsFile(profile));
db = Services.storage.openDatabase(GetPermissionsFile(profile));
Assert.ok(db.tableExists("moz_perms"));
Assert.ok(db.tableExists("moz_hosts"));
Assert.ok(!db.tableExists("moz_hosts_is_backup"));
Expand Down
32 changes: 16 additions & 16 deletions extensions/permissions/test/unit/test_permmanager_migrate_5-7a.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ add_task(async function test() {

return {
id: thisId,
origin: origin,
type: type,
permission: permission,
expireType: expireType,
expireTime: expireTime,
modificationTime: modificationTime
origin,
type,
permission,
expireType,
expireTime,
modificationTime
};
}

Expand All @@ -118,14 +118,14 @@ add_task(async function test() {

return {
id: thisId,
host: host,
type: type,
permission: permission,
expireType: expireType,
expireTime: expireTime,
modificationTime: modificationTime,
appId: appId,
isInBrowserElement: isInBrowserElement
host,
type,
permission,
expireType,
expireTime,
modificationTime,
appId,
isInBrowserElement
};
}

Expand Down Expand Up @@ -216,7 +216,7 @@ add_task(async function test() {
await PlacesTestUtils.addVisits(Services.io.newURI("ftp://some.subdomain.of.foo.com:8000/some/subdirectory"));

// This will force the permission-manager to reload the data.
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk", "");
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk");

// Force initialization of the nsPermissionManager
for (let permission of Services.perms.enumerator) {
Expand Down Expand Up @@ -249,7 +249,7 @@ add_task(async function test() {

// Check to make sure that all of the tables which we care about are present
{
let db = Services.storage.openDatabase(GetPermissionsFile(profile));
db = Services.storage.openDatabase(GetPermissionsFile(profile));
Assert.ok(db.tableExists("moz_perms"));
Assert.ok(db.tableExists("moz_hosts"));
Assert.ok(!db.tableExists("moz_hosts_is_backup"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ add_task(function test() {
return {
id: thisId,
host: origin,
type: type,
permission: permission,
expireType: expireType,
expireTime: expireTime,
modificationTime: modificationTime
type,
permission,
expireType,
expireTime,
modificationTime
};
}

Expand Down Expand Up @@ -103,7 +103,7 @@ add_task(function test() {
let found = expected.map((it) => 0);

// This will force the permission-manager to reload the data.
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk", "");
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk");

// Force initialization of the nsPermissionManager
for (let permission of Services.perms.enumerator) {
Expand Down Expand Up @@ -136,7 +136,7 @@ add_task(function test() {

// Check to make sure that all of the tables which we care about are present
{
let db = Services.storage.openDatabase(GetPermissionsFile(profile));
db = Services.storage.openDatabase(GetPermissionsFile(profile));
Assert.ok(db.tableExists("moz_perms"));
Assert.ok(db.tableExists("moz_hosts"));
Assert.ok(!db.tableExists("moz_hosts_is_backup"));
Expand Down
32 changes: 16 additions & 16 deletions extensions/permissions/test/unit/test_permmanager_migrate_6-7a.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ add_task(async function test() {

return {
id: thisId,
origin: origin,
type: type,
permission: permission,
expireType: expireType,
expireTime: expireTime,
modificationTime: modificationTime
origin,
type,
permission,
expireType,
expireTime,
modificationTime
};
}

Expand All @@ -118,14 +118,14 @@ add_task(async function test() {

return {
id: thisId,
host: host,
type: type,
permission: permission,
expireType: expireType,
expireTime: expireTime,
modificationTime: modificationTime,
appId: appId,
isInBrowserElement: isInBrowserElement
host,
type,
permission,
expireType,
expireTime,
modificationTime,
appId,
isInBrowserElement
};
}

Expand Down Expand Up @@ -216,7 +216,7 @@ add_task(async function test() {
await PlacesTestUtils.addVisits(Services.io.newURI("ftp://some.subdomain.of.foo.com:8000/some/subdirectory"));

// This will force the permission-manager to reload the data.
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk", "");
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk");

// Force initialization of the nsPermissionManager
for (let permission of Services.perms.enumerator) {
Expand Down Expand Up @@ -249,7 +249,7 @@ add_task(async function test() {

// Check to make sure that all of the tables which we care about are present
{
let db = Services.storage.openDatabase(GetPermissionsFile(profile));
db = Services.storage.openDatabase(GetPermissionsFile(profile));
Assert.ok(db.tableExists("moz_perms"));
Assert.ok(db.tableExists("moz_hosts"));
Assert.ok(!db.tableExists("moz_hosts_is_backup"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ add_task(function test() {
return {
id: thisId,
host: origin,
type: type,
permission: permission,
expireType: expireType,
expireTime: expireTime,
modificationTime: modificationTime
type,
permission,
expireType,
expireTime,
modificationTime
};
}

Expand All @@ -97,7 +97,7 @@ add_task(function test() {
let found = expected.map((it) => 0);

// This will force the permission-manager to reload the data.
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk", "");
Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk");

// Force initialization of the nsPermissionManager
for (let permission of Services.perms.enumerator) {
Expand Down Expand Up @@ -130,7 +130,7 @@ add_task(function test() {

// Check to make sure that all of the tables which we care about are present
{
let db = Services.storage.openDatabase(GetPermissionsFile(profile));
db = Services.storage.openDatabase(GetPermissionsFile(profile));
Assert.ok(db.tableExists("moz_perms"));
Assert.ok(db.tableExists("moz_hosts"));
Assert.ok(!db.tableExists("moz_hosts_is_backup"));
Expand Down
Loading

0 comments on commit 6971980

Please sign in to comment.