Bug 1344027 - Fix most of the remaining ESLint no-undef issues in browser/components. r=jaws

MozReview-Commit-ID: DUnxVITvZgh

--HG--
extra : rebase_source : abe5adf3b024a45c2804d048f078c6a59a936242
This commit is contained in:
Mark Banner 2017-03-03 09:29:14 +00:00
parent 7d5e6f23c5
commit 561b6cfb0c
21 changed files with 83 additions and 15 deletions

View file

@ -63,8 +63,8 @@ browser/base/content/newtab/**
browser/components/downloads/** browser/components/downloads/**
browser/components/sessionstore/** browser/components/sessionstore/**
browser/components/tabview/** browser/components/tabview/**
# generated files in cld2 # generated & special files in cld2
browser/components/translation/cld2/cld-worker.js browser/components/translation/cld2/**
browser/extensions/pdfjs/content/build** browser/extensions/pdfjs/content/build**
browser/extensions/pdfjs/content/web** browser/extensions/pdfjs/content/web**
# generated or library files in pocket # generated or library files in pocket

View file

@ -0,0 +1,7 @@
"use strict";
module.exports = {
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
]
};

View file

@ -0,0 +1,11 @@
"use strict";
module.exports = { // eslint-disable-line no-undef
"env": {
"mozilla/browser-window": true,
},
"plugins": [
"mozilla",
]
};

View file

@ -242,4 +242,3 @@ let PlacesProvider = {
// Kept only for backwards-compatibility // Kept only for backwards-compatibility
XPCOMUtils.defineLazyGetter(PlacesProvider, "LinkChecker", XPCOMUtils.defineLazyGetter(PlacesProvider, "LinkChecker",
() => NewTabUtils.linkChecker); () => NewTabUtils.linkChecker);

View file

@ -23,7 +23,8 @@ XPCOMUtils.defineLazyServiceGetter(this, "AlertsService", "@mozilla.org/alerts-s
AsyncShutdown:false, AutoCompletePopup:false, BookmarkHTMLUtils:false, AsyncShutdown:false, AutoCompletePopup:false, BookmarkHTMLUtils:false,
BookmarkJSONUtils:false, BrowserUITelemetry:false, BrowserUsageTelemetry:false, BookmarkJSONUtils:false, BrowserUITelemetry:false, BrowserUsageTelemetry:false,
ContentClick:false, ContentPrefServiceParent:false, ContentSearch:false, ContentClick:false, ContentPrefServiceParent:false, ContentSearch:false,
DateTimePickerHelper:false, DirectoryLinksProvider:false, Feeds:false, DateTimePickerHelper:false, DirectoryLinksProvider:false,
ExtensionsUI:false, Feeds:false,
FileUtils:false, FormValidationHandler:false, Integration:false, FileUtils:false, FormValidationHandler:false, Integration:false,
LightweightThemeManager:false, LoginHelper:false, LoginManagerParent:false, LightweightThemeManager:false, LoginHelper:false, LoginManagerParent:false,
NetUtil:false, NewTabMessages:false, NewTabUtils:false, OS:false, NetUtil:false, NewTabMessages:false, NewTabUtils:false, OS:false,

View file

@ -1,3 +1,6 @@
// This file spawns content tasks.
/* eslint-env mozilla/frame-script */
const BASE_URL = "http://mochi.test:8888/browser/browser/components/originattributes/test/browser/"; const BASE_URL = "http://mochi.test:8888/browser/browser/components/originattributes/test/browser/";
const BASE_DOMAIN = "mochi.test"; const BASE_DOMAIN = "mochi.test";

View file

@ -0,0 +1,12 @@
"use strict";
module.exports = {
"env": {
// Everything in this directory is loaded alongside the places overlay.
"mozilla/places-overlay": true
},
"plugins": [
"mozilla",
]
};

View file

@ -57,6 +57,8 @@
* been performed by the dialog. * been performed by the dialog.
*/ */
/* import-globals-from editBookmarkOverlay.js */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm"); "resource://gre/modules/PrivateBrowsingUtils.jsm");

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env mozilla/browser-window */
Components.utils.import("resource://gre/modules/AppConstants.jsm"); Components.utils.import("resource://gre/modules/AppConstants.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/Services.jsm");

View file

@ -286,9 +286,13 @@ var gEditItemOverlay = {
// Note: since all controls are collapsed by default, we don't get the // Note: since all controls are collapsed by default, we don't get the
// default XUL dialog behavior, that selects the first control, so we set // default XUL dialog behavior, that selects the first control, so we set
// the focus explicitly. // the focus explicitly.
// Note: If focusedElement === "preferred", this file expects gPrefService
// to be defined in the global scope.
let elt; let elt;
if (focusedElement === "preferred") { if (focusedElement === "preferred") {
/* eslint-disable no-undef */
elt = this._element(gPrefService.getCharPref("browser.bookmarks.editDialog.firstEditField")); elt = this._element(gPrefService.getCharPref("browser.bookmarks.editDialog.firstEditField"));
/* eslint-enable no-undef */
} else if (focusedElement === "first") { } else if (focusedElement === "first") {
elt = document.querySelector("textbox:not([collapsed=true])"); elt = document.querySelector("textbox:not([collapsed=true])");
} }
@ -899,7 +903,7 @@ var gEditItemOverlay = {
let tagsInField = this._getTagsArrayFromTagsInputField(); let tagsInField = this._getTagsArrayFromTagsInputField();
let allTags = PlacesUtils.tagging.allTags; let allTags = PlacesUtils.tagging.allTags;
for (tag of allTags) { for (let tag of allTags) {
let elt = document.createElement("listitem"); let elt = document.createElement("listitem");
elt.setAttribute("type", "checkbox"); elt.setAttribute("type", "checkbox");
elt.setAttribute("label", tag); elt.setAttribute("label", tag);
@ -1064,7 +1068,7 @@ var gEditItemOverlay = {
// menulist has been changed, we need to update the label of its // menulist has been changed, we need to update the label of its
// representing element. // representing element.
let menupopup = this._folderMenuList.menupopup; let menupopup = this._folderMenuList.menupopup;
for (menuitem of menupopup.childNodes) { for (let menuitem of menupopup.childNodes) {
if ("folderId" in menuitem && menuitem.folderId == aItemId) { if ("folderId" in menuitem && menuitem.folderId == aItemId) {
menuitem.label = aNewTitle; menuitem.label = aNewTitle;
break; break;

View file

@ -3,6 +3,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* import-globals-from editBookmarkOverlay.js */
// Via downloadsViewOverlay.xul -> allDownloadsViewOverlay.xul
/* import-globals-from ../../../../toolkit/content/contentAreaUtils.js */
Components.utils.import("resource://gre/modules/AppConstants.jsm"); Components.utils.import("resource://gre/modules/AppConstants.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/TelemetryStopwatch.jsm"); Components.utils.import("resource://gre/modules/TelemetryStopwatch.jsm");

View file

@ -44,8 +44,6 @@
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/places/places.js"/> src="chrome://browser/content/places/places.js"/>
<script type="application/javascript"
src="chrome://browser/content/utilityOverlay.js"/>
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/places/editBookmarkOverlay.js"/> src="chrome://browser/content/places/editBookmarkOverlay.js"/>
@ -89,7 +87,7 @@
<!-- Instantiation Keys --> <!-- Instantiation Keys -->
<key id="placesKey_close" key="&cmd.close.key;" modifiers="accel" <key id="placesKey_close" key="&cmd.close.key;" modifiers="accel"
oncommand="close();"/> oncommand="close();"/>
<!-- Command Keys --> <!-- Command Keys -->
<key id="placesKey_find:all" <key id="placesKey_find:all"
command="OrganizerCommand_find:all" command="OrganizerCommand_find:all"
@ -375,7 +373,7 @@
onkeypress="ContentTree.onKeyPress(event);" onkeypress="ContentTree.onKeyPress(event);"
onopenflatcontainer="PlacesOrganizer.openFlatContainer(aContainer);"> onopenflatcontainer="PlacesOrganizer.openFlatContainer(aContainer);">
<treecols id="placeContentColumns" context="placesColumnsContext"> <treecols id="placeContentColumns" context="placesColumnsContext">
<treecol label="&col.name.label;" id="placesContentTitle" anonid="title" flex="5" primary="true" ordinal="1" <treecol label="&col.name.label;" id="placesContentTitle" anonid="title" flex="5" primary="true" ordinal="1"
persist="width hidden ordinal sortActive sortDirection"/> persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/> <splitter class="tree-splitter"/>
<treecol label="&col.tags.label;" id="placesContentTags" anonid="tags" flex="2" <treecol label="&col.tags.label;" id="placesContentTags" anonid="tags" flex="2"

View file

@ -23,6 +23,7 @@
var Cc = Components.classes; var Cc = Components.classes;
var Ci = Components.interfaces; var Ci = Components.interfaces;
var Cr = Components.results; var Cr = Components.results;
var Cu = Components.utils;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Task.jsm"); Components.utils.import("resource://gre/modules/Task.jsm");
@ -65,7 +66,7 @@
oncommand="goDoPlacesCommand('placesCmd_new:folder');"/> oncommand="goDoPlacesCommand('placesCmd_new:folder');"/>
<command id="placesCmd_new:separator" <command id="placesCmd_new:separator"
oncommand="goDoPlacesCommand('placesCmd_new:separator');"/> oncommand="goDoPlacesCommand('placesCmd_new:separator');"/>
<command id="placesCmd_show:info" <command id="placesCmd_show:info"
oncommand="goDoPlacesCommand('placesCmd_show:info');"/> oncommand="goDoPlacesCommand('placesCmd_show:info');"/>
<command id="placesCmd_rename" <command id="placesCmd_rename"
oncommand="goDoPlacesCommand('placesCmd_show:info');" oncommand="goDoPlacesCommand('placesCmd_show:info');"
@ -166,7 +167,7 @@
<menuitem id="placesContext_cut" <menuitem id="placesContext_cut"
command="placesCmd_cut" command="placesCmd_cut"
label="&cutCmd.label;" label="&cutCmd.label;"
accesskey="&cutCmd.accesskey;" accesskey="&cutCmd.accesskey;"
closemenu="single" closemenu="single"
selection="bookmark|folder|separator|query" selection="bookmark|folder|separator|query"
forcehideselection="tagChild|livemarkChild"/> forcehideselection="tagChild|livemarkChild"/>
@ -220,7 +221,7 @@
<menuseparator id="placesContext_sortSeparator"/> <menuseparator id="placesContext_sortSeparator"/>
<menuitem id="placesContext_show:info" <menuitem id="placesContext_show:info"
command="placesCmd_show:info" command="placesCmd_show:info"
label="&cmd.properties.label;" label="&cmd.properties.label;"
accesskey="&cmd.properties.accesskey;" accesskey="&cmd.properties.accesskey;"
selection="bookmark|folder|query" selection="bookmark|folder|query"
forcehideselection="livemarkChild"/> forcehideselection="livemarkChild"/>

View file

@ -1,5 +1,7 @@
"use strict"; "use strict";
/* eslint-env mozilla/frame-script */
/** /**
* Given some window in the parent process, ensure that * Given some window in the parent process, ensure that
* the nsIXULWindow has the CHROME_PRIVATE_WINDOW chromeFlag, * the nsIXULWindow has the CHROME_PRIVATE_WINDOW chromeFlag,

View file

@ -3,6 +3,12 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this - 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/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!-- This file is imported into the browser window. -->
<!-- eslint-env mozilla/browser-window -->
<!-- XULCommandEvent is a specialised global. -->
<!-- global XULCommandEvent -->
<!DOCTYPE bindings [ <!DOCTYPE bindings [
<!ENTITY % searchBarDTD SYSTEM "chrome://browser/locale/searchbar.dtd" > <!ENTITY % searchBarDTD SYSTEM "chrome://browser/locale/searchbar.dtd" >
%searchBarDTD; %searchBarDTD;

View file

@ -13,7 +13,7 @@ Cu.import("resource:///modules/syncedtabs/SyncedTabsDeckComponent.js");
XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts", XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts",
"resource://gre/modules/FxAccounts.jsm"); "resource://gre/modules/FxAccounts.jsm");
this.syncedTabsDeckComponent = new SyncedTabsDeckComponent({window, SyncedTabs, fxAccounts}); var syncedTabsDeckComponent = new SyncedTabsDeckComponent({window, SyncedTabs, fxAccounts});
let onLoaded = () => { let onLoaded = () => {
syncedTabsDeckComponent.init(); syncedTabsDeckComponent.init();

View file

@ -3,6 +3,8 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this - 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/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!-- eslint-env mozilla/browser-window -->
<!DOCTYPE bindings [ <!DOCTYPE bindings [
<!ENTITY % notificationDTD SYSTEM "chrome://global/locale/notification.dtd"> <!ENTITY % notificationDTD SYSTEM "chrome://global/locale/notification.dtd">
%notificationDTD; %notificationDTD;

View file

@ -326,6 +326,7 @@ if (typeof Mozilla == "undefined") {
})(); })();
// Make this library Require-able. // Make this library Require-able.
/* eslint-env commonjs */
if (typeof module !== "undefined" && module.exports) { if (typeof module !== "undefined" && module.exports) {
module.exports = Mozilla.UITour; module.exports = Mozilla.UITour;
} }

View file

@ -5,6 +5,7 @@
/* eslint-env mozilla/frame-script */ /* eslint-env mozilla/frame-script */
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/Services.jsm");
const PREF_TEST_WHITELIST = "browser.uitour.testingOrigins"; const PREF_TEST_WHITELIST = "browser.uitour.testingOrigins";
const UITOUR_PERMISSION = "uitour"; const UITOUR_PERMISSION = "uitour";

View file

@ -1,5 +1,11 @@
"use strict"; "use strict";
// This file spawns a content task.
/* eslint-env mozilla/frame-script */
// This file expects these globals to be defined by the test case.
/* global gTestTab:true, gContentAPI:true, gContentWindow:true, tests:false */
Cu.import("resource://gre/modules/Promise.jsm"); Cu.import("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/Task.jsm"); Cu.import("resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "UITour", XPCOMUtils.defineLazyModuleGetter(this, "UITour",

View file

@ -247,6 +247,9 @@ module.exports = {
"browser": true, "browser": true,
}, },
"globals": { "globals": {
"BroadcastChannel": false,
// Specific to Firefox (Chrome code only).
"ChromeWindow": false,
"ChromeWorker": false, "ChromeWorker": false,
"ChromeUtils": false, "ChromeUtils": false,
"Components": false, "Components": false,
@ -257,6 +260,8 @@ module.exports = {
"KeyEvent": false, "KeyEvent": false,
"openDialog": false, "openDialog": false,
"MenuBoxObject": false, "MenuBoxObject": false,
// Specific to Firefox (Chrome code only).
"MozSelfSupport": false,
"SimpleGestureEvent": false, "SimpleGestureEvent": false,
"sizeToContent": false, "sizeToContent": false,
"SharedArrayBuffer": false, "SharedArrayBuffer": false,
@ -265,6 +270,7 @@ module.exports = {
"StopIteration": false, "StopIteration": false,
// Specific to Firefox // Specific to Firefox
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/uneval // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/uneval
"uneval": false "uneval": false,
"XULElement": false,
} }
}; };