Bug 1365412 - Clean up various ESLint global definitions in browser/. r=mossop

MozReview-Commit-ID: JqAm9x1XGCM

--HG--
extra : rebase_source : e9215288195f1fe683832db53d87dbe77c697b4c
This commit is contained in:
Mark Banner 2017-05-16 22:22:42 +01:00
Родитель 9f2f58316a
Коммит 4fb45e5b8c
53 изменённых файлов: 34 добавлений и 132 удалений

Просмотреть файл

@ -3,12 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* globals
waitForExplicitFinish, whenNewWindowLoaded, whenNewTabLoaded,
executeSoon, registerCleanupFunction, finish, is
*/
/* exported test */
// This test makes sure that opening a new tab in private browsing mode opens about:privatebrowsing
function test() {
// initialization

Просмотреть файл

@ -2,9 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* globals waitForExplicitFinish, executeSoon, finish, whenNewWindowLoaded, ok */
/* globals is */
/* exported test */
function test() {
// initialization

Просмотреть файл

@ -1,7 +1,6 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
/* eslint-env worker */
/* globals OS, ParseSymbols */
"use strict";

Просмотреть файл

@ -54,7 +54,6 @@ extensions.on("page-shutdown", (type, context) => {
}
});
/* eslint-enable mozilla/balanced-listeners */
/* eslint-enable mozilla/balanced-listeners */
global.openOptionsPage = (extension) => {
let window = windowTracker.topWindow;

Просмотреть файл

@ -5,7 +5,6 @@
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
/* globals TabBase, WindowBase, TabTrackerBase, WindowTrackerBase, TabManagerBase, WindowManagerBase */
Cu.import("resource://gre/modules/ExtensionTabs.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "styleSheetService",

Просмотреть файл

@ -7,29 +7,6 @@ module.exports = {
"webextensions": true,
},
"globals": {
"NetUtil": true,
"XPCOMUtils": true,
"Task": true,
// Browser window globals.
"PanelUI": false,
// Test harness globals
"ExtensionTestUtils": false,
"TestUtils": false,
"clickBrowserAction": true,
"clickPageAction": true,
"closeContextMenu": true,
"closeExtensionContextMenu": true,
"focusWindow": true,
"makeWidgetId": true,
"openContextMenu": true,
"openExtensionContextMenu": true,
"CustomizableUI": true,
},
"rules": {
"no-shadow": 0,
},

Просмотреть файл

@ -2,8 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
/* global runTests */
Services.scriptloader.loadSubScript(new URL("head_pageAction.js", gTestPath).href,
this);

Просмотреть файл

@ -2,8 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
/* global runTests */
Services.scriptloader.loadSubScript(new URL("head_pageAction.js", gTestPath).href,
this);

Просмотреть файл

@ -2,8 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
/* globals recordInitialTimestamps, onlyNewItemsFilter, checkRecentlyClosed */
requestLongerTimeout(2);
Services.scriptloader.loadSubScript(new URL("head_sessions.js", gTestPath).href,

Просмотреть файл

@ -2,8 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
/* globals recordInitialTimestamps, onlyNewItemsFilter, checkRecentlyClosed */
SimpleTest.requestCompleteLog();
Services.scriptloader.loadSubScript(new URL("head_sessions.js", gTestPath).href,

Просмотреть файл

@ -1,8 +1,8 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
/* globals makeExtension */
"use strict";
/* import-globals-from ../../../../../toolkit/components/extensions/test/mochitest/head_webrequest.js */
Services.scriptloader.loadSubScript(new URL("head_webrequest.js", gTestPath).href,
this);
@ -117,4 +117,3 @@ add_task(async function test_subframe() {
add_task(async function teardown() {
await extension.unload();
});

Просмотреть файл

@ -371,7 +371,6 @@ async function clickPageAction(extension, win = window) {
//
// Unfortunately, that doesn't happen automatically in browser chrome
// tests.
/* globals SetPageProxyState */
SetPageProxyState("valid");
await promiseAnimationFrame(win);

Просмотреть файл

@ -3,7 +3,8 @@
"use strict";
/* exported runTests */
/* globals getListStyleImage, promiseAnimationFrame */
// This file is imported into the same scope as head.js.
/* import-globals-from head.js */
async function runTests(options) {
function background(getTests) {
@ -157,4 +158,3 @@ async function runTests(options) {
await BrowserTestUtils.closeWindow(win);
}
}

Просмотреть файл

@ -3,8 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global BrowserFeedWriter */
var SubscribeHandler = {
/**
* The nsIFeedWriter object that produces the UI

Просмотреть файл

@ -10,8 +10,8 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/osfile.jsm"); /* globals OS */
Cu.import("resource:///modules/MigrationUtils.jsm"); /* globals MigratorPrototype */
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource:///modules/MigrationUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");

Просмотреть файл

@ -46,7 +46,6 @@ XPCOMUtils.defineLazyGetter(this, "gBrandBundle", function() {
Cu.importGlobalProperties(["URL"]);
/* globals kUndoStateFullPath */
XPCOMUtils.defineLazyGetter(this, "kUndoStateFullPath", function() {
return OS.Path.join(OS.Constants.Path.profileDir, "initialMigrationMetadata.jsonlz4");
});

Просмотреть файл

@ -24,8 +24,8 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/osfile.jsm"); /* globals OS */
Cu.import("resource:///modules/MigrationUtils.jsm"); /* globals MigratorPrototype */
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource:///modules/MigrationUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");

Просмотреть файл

@ -7,10 +7,10 @@
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/osfile.jsm"); /* globals OS */
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/MigrationUtils.jsm"); /* globals MigratorPrototype */
Cu.import("resource:///modules/MigrationUtils.jsm");
Cu.import("resource:///modules/MSMigrationUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");

Просмотреть файл

@ -16,7 +16,7 @@
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/MigrationUtils.jsm"); /* globals MigratorPrototype */
Cu.import("resource:///modules/MigrationUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesBackups",

Просмотреть файл

@ -13,10 +13,10 @@ const kLoginsKey = "Software\\Microsoft\\Internet Explorer\\IntelliForms\\Storag
const kMainKey = "Software\\Microsoft\\Internet Explorer\\Main";
Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/osfile.jsm"); /* globals OS */
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/MigrationUtils.jsm"); /* globals MigratorPrototype */
Cu.import("resource:///modules/MigrationUtils.jsm");
Cu.import("resource:///modules/MSMigrationUtils.jsm");

Просмотреть файл

@ -10,10 +10,10 @@ var Cu = Components.utils;
Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/osfile.jsm"); /* globals OS */
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/MigrationUtils.jsm"); /* globals MigratorPrototype */
Cu.import("resource:///modules/MigrationUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
"resource://gre/modules/Downloads.jsm");

Просмотреть файл

@ -24,7 +24,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "Sqlite",
// Initialize profile.
var gProfD = do_get_profile();
Cu.import("resource://testing-common/AppInfo.jsm"); /* globals updateAppInfo */
Cu.import("resource://testing-common/AppInfo.jsm");
updateAppInfo();
/**

Просмотреть файл

@ -28,7 +28,7 @@ add_task(async function() {
// importing osfile will sometimes greedily fetch certain path identifiers
// from the dir service, which means they get cached, which means we can't
// register a fake path for them anymore.
Cu.import("resource://gre/modules/osfile.jsm"); /* globals OS */
Cu.import("resource://gre/modules/osfile.jsm");
await OS.File.makeDir(target.path, {from: rootDir.parent.path, ignoreExisting: true});
target.append("Bookmarks");

Просмотреть файл

@ -1,8 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* globals do_get_tempdir */
"use strict";
function run_test() {

Просмотреть файл

@ -1,6 +1,3 @@
/* global Services, Preferences, EventEmitter, XPCOMUtils */
/* exported NewTabPrefsProvider */
"use strict";
this.EXPORTED_SYMBOLS = ["NewTabPrefsProvider"];

Просмотреть файл

@ -1,6 +1,3 @@
/* global XPCOMUtils, ContentSearch, Task, Services, EventEmitter */
/* exported NewTabSearchProvider */
"use strict";
this.EXPORTED_SYMBOLS = ["NewTabSearchProvider"];

Просмотреть файл

@ -2,9 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* globals XPCOMUtils, aboutNewTabService*/
/* exported NewTabURL */
"use strict";
const {utils: Cu} = Components;

Просмотреть файл

@ -1,14 +1,3 @@
/* global
NewTabPrefsProvider,
Services,
EventEmitter,
Preferences,
XPCOMUtils,
WebChannel,
NewTabRemoteResources
*/
/* exported NewTabWebChannel */
"use strict";
this.EXPORTED_SYMBOLS = ["NewTabWebChannel"];

Просмотреть файл

@ -1,6 +1,3 @@
/* global XPCOMUtils, BackgroundPageThumbs, FileUtils, PageThumbsStorage, Task, MIMEService */
/* exported PreviewProvider */
"use strict";
this.EXPORTED_SYMBOLS = ["PreviewProvider"];

Просмотреть файл

@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* globals XPCOMUtils, Preferences, Services */
"use strict";
const {utils: Cu, interfaces: Ci} = Components;

Просмотреть файл

@ -1,4 +1,3 @@
/* globals XPCOMUtils, Services, PreviewProvider, registerCleanupFunction */
"use strict";
let Cu = Components.utils;

Просмотреть файл

@ -1,15 +1,3 @@
/* globals
XPCOMUtils,
aboutNewTabService,
Services,
ContentTask,
TestUtils,
BrowserOpenTab,
registerCleanupFunction,
is,
content
*/
"use strict";
let Cu = Components.utils;

Просмотреть файл

@ -1,4 +1,3 @@
/* globals Cu, XPCOMUtils, TestUtils, aboutNewTabService, ContentTask, content, is */
"use strict";
Cu.import("resource://gre/modules/XPCOMUtils.jsm");

Просмотреть файл

@ -2,8 +2,6 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* globals Services, XPCOMUtils, Preferences, aboutNewTabService, do_register_cleanup */
"use strict";
const {utils: Cu} = Components;

Просмотреть файл

@ -1,8 +1,5 @@
"use strict";
/* global XPCOMUtils, equal, Preferences, NewTabPrefsProvider, run_next_test */
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Preferences.jsm");

Просмотреть файл

@ -1,8 +1,5 @@
"use strict";
/* global XPCOMUtils, NewTabSearchProvider, run_next_test, ok, equal, do_check_true, do_get_profile, Services */
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");

Просмотреть файл

@ -2,7 +2,6 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* globals Services, NewTabURL, XPCOMUtils, aboutNewTabService */
"use strict";
const {utils: Cu} = Components;

Просмотреть файл

@ -1,6 +1,6 @@
self.randomValue = Math.random();
/* global onconnect:true */
/* eslint-env worker */
onconnect = function(e) {
let port = e.ports[0];

Просмотреть файл

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

Просмотреть файл

@ -15,7 +15,6 @@
<body>
<pre id="test"></pre>
<script type="application/javascript">
/* globals SpecialPowers, SimpleTest, is, ok, */
"use strict";
const {

Просмотреть файл

@ -7,11 +7,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
XPCOMUtils.defineLazyModuleGetter(this, "TestUtils",
"resource://testing-common/TestUtils.jsm");
// Imported via PlacesOverlay.xul
/* global doGetPlacesControllerForCommand:false, PlacesControllerDragHelper:false,
PlacesUIUtils:false
*/
// We need to cache this before test runs...
var cachedLeftPaneFolderIdGetter;
var getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId");

Просмотреть файл

@ -3,8 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// These globals are imported via placesOverlay.xul.
/* globals PlacesUIUtils, PlacesUtils, NS_ASSERT */
/* eslint-env mozilla/places-overlay */
/**
* SelectBookmarkDialog controls the user interface for the "Use Bookmark for

Просмотреть файл

@ -8,7 +8,7 @@
"use strict";
/* global content */
/* eslint-env mozilla/frame-script */
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global content:false, sendAsyncMessage:false */
/* eslint-env mozilla/frame-script */
let { utils: Cu } = Components;

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global content:false, addMessageListener:false, removeMessageListener: false */
/* eslint-env mozilla/frame-script */
let { utils: Cu } = Components;

Просмотреть файл

@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global AddonManager */
"use strict";
add_task(async function installed() {

Просмотреть файл

@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* globals XPCOMUtils, UAOverrider, IOService */
"use strict";
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");

Просмотреть файл

@ -1,7 +1,6 @@
/* 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 file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/* globals XPCOMUtils, Services, Task, Promise, SearchSuggestionController, FormHistory, PrivateBrowsingUtils */
"use strict";
this.EXPORTED_SYMBOLS = [

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global addMessageListener:false, sendAsyncMessage:false, XPCOMUtils */
/* eslint-env mozilla/frame-script */
const TEST_MSG = "ContentSearchTest";
const SERVICE_EVENT_TYPE = "ContentSearchService";

Просмотреть файл

@ -8,6 +8,7 @@ module.exports = {
"globals": {
"BroadcastChannel": false,
"BrowserFeedWriter": false,
"CSSPrimitiveValue": false,
"CSSValueList": false,
// Specific to Firefox (Chrome code only).

Просмотреть файл

@ -18,6 +18,7 @@ var helpers = require("../helpers");
var globals = require("../globals");
const simpleTestFiles = [
"ExtensionTestUtils.js",
"EventUtils.js",
"MockObjects.js",
"SimpleTest.js",

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "eslint-plugin-mozilla",
"version": "0.2.47",
"version": "0.3.0",
"description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.",
"keywords": [
"eslint",

Просмотреть файл

@ -66,6 +66,7 @@
"Extension.jsm": ["Extension", "ExtensionData"],
"ExtensionAPI.jsm": ["ExtensionAPI", "ExtensionAPIs"],
"ExtensionsUI.jsm": ["ExtensionsUI"],
"ExtensionTabs.jsm": ["TabTrackerBase", "TabManagerBase", "TabBase", "WindowTrackerBase", "WindowManagerBase", "WindowBase"],
"extension-storage.js": ["ExtensionStorageEngine", "EncryptionRemoteTransformer", "KeyRingEncryptionRemoteTransformer"],
"ExtensionXPCShellUtils.jsm": ["ExtensionTestUtils"],
"fakeservices.js": ["FakeCryptoService", "FakeFilesystemService", "FakeGUIDService", "fakeSHA256HMAC"],
@ -155,6 +156,7 @@
"PageMenu.jsm": ["PageMenuParent", "PageMenuChild"],
"PageThumbs.jsm": ["PageThumbs", "PageThumbsStorage"],
"Parser.jsm": ["Parser", "ParserHelpers", "SyntaxTreeVisitor"],
"ParseSymbols.jsm": ["ParseSymbols"],
"passwords.js": ["PasswordEngine", "LoginRec", "PasswordValidator"],
"passwords.jsm": ["Password", "DumpPasswords"],
"PdfJsNetwork.jsm": ["NetworkManager"],