Bug 1245916: Add additional browser window scripts to eslint globals. r=felipe

This adds more of the scripts that browser.js relies on and also makes
browser-chrome head files import the browser.js globals.

The MOZ_JSDOWNLOADS block in contentAreaUtils only seems to hide a single
function, I don't see any need to keep hiding that now we're on by default.

MozReview-Commit-ID: 5zvF3JtJrZG

--HG--
extra : rebase_source : a99f752b053765b621cf03965bda0c586a9eb1cb
This commit is contained in:
Dave Townsend 2016-02-05 12:16:39 -08:00
Родитель 5425cecf02
Коммит 8f0976db4f
6 изменённых файлов: 38 добавлений и 19 удалений

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

@ -187,7 +187,6 @@ toolkit/components/osfile/**
toolkit/components/passwordmgr/**
# Uses preprocessing
toolkit/content/contentAreaUtils.js
toolkit/content/widgets/videocontrols.xml
toolkit/content/widgets/wizard.xml
toolkit/components/jsdownloads/src/DownloadIntegration.jsm

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

@ -81,6 +81,7 @@ if (AppConstants.platform != "macosx") {
var gEditUIVisible = true;
}
/*globals gBrowser, gNavToolbox, gURLBar, gNavigatorBundle*/
[
["gBrowser", "content"],
["gNavToolbox", "navigator-toolbox"],

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

@ -303,6 +303,22 @@ module.exports = {
return true;
},
/**
* Check whether we might be in a test head file.
*
* @param {RuleContext} scope
* You should pass this from within a rule
* e.g. helpers.getIsBrowserMochitest(this)
*
* @return {Boolean}
* True or false
*/
getIsHeadFile: function(scope) {
var pathAndFilename = scope.getFilename();
return /.*[\\/]head(_.+)?\.js$/.test(pathAndFilename);
},
/**
* Check whether we are in a browser mochitest.
*

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

@ -18,6 +18,9 @@ var helpers = require("../helpers");
var globals = require("../globals");
const SCRIPTS = [
//"browser/base/content/nsContextMenu.js",
"toolkit/content/contentAreaUtils.js",
"browser/components/places/content/editBookmarkOverlay.js",
"toolkit/components/printing/content/printUtils.js",
"toolkit/content/viewZoomOverlay.js",
"browser/components/places/content/browserPlacesViews.js",
@ -47,13 +50,14 @@ const SCRIPTS = [
"browser/base/content/browser-thumbnails.js",
"browser/base/content/browser-trackingprotection.js",
"browser/base/content/browser-data-submission-info-bar.js",
"browser/base/content/browser-fxaccounts.js",
"browser/base/content/browser-fxaccounts.js"
];
module.exports = function(context) {
return {
Program: function(node) {
if (!helpers.getIsBrowserMochitest(this)) {
if (!helpers.getIsBrowserMochitest(this) &&
!helpers.getIsHeadFile(this)) {
return;
}

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

@ -1,7 +1,6 @@
# -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
# 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/.
/* 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/. */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
@ -25,6 +24,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
"resource://gre/modules/Deprecated.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
var ContentAreaUtils = {
@ -351,7 +352,7 @@ XPCOMUtils.defineConstant(this, "kSaveAsType_Text", kSaveAsType_Text);
* @param aDocument
* The document to be saved
* @param aDefaultFileName
* The caller-provided suggested filename if we don't
* The caller-provided suggested filename if we don't
* find a better one
* @param aContentDisposition
* The caller-provided content-disposition header to use.
@ -593,7 +594,7 @@ function AutoChosen(aFileAutoChosen, aUriAutoChosen) {
* Structure for holding info about a URL and the target filename it should be
* saved to. This structure is populated by initFileInfo(...).
* @param aSuggestedFileName This is used by initFileInfo(...) when it
* cannot 'discover' the filename from the url
* cannot 'discover' the filename from the url
* @param aFileName The target filename
* @param aFileBaseName The filename without the file extension
* @param aFileExt The extension of the filename
@ -652,7 +653,7 @@ function initFileInfo(aFI, aURL, aURLCharset, aDocument,
}
}
/**
/**
* Given the Filepicker Parameters (aFpP), show the file picker dialog,
* prompting the user to confirm (or change) the fileName.
* @param aFpP
@ -667,7 +668,7 @@ function initFileInfo(aFI, aURL, aURLCharset, aDocument,
* is set, but ask for the target explicitly.
* @param aRelatedURI
* An nsIURI associated with the download. The last used
* directory of the picker is retrieved from/stored in the
* directory of the picker is retrieved from/stored in the
* Content Pref Service using this URI.
* @return Promise
* @resolve a boolean. When true, it indicates that the file picker dialog
@ -675,7 +676,7 @@ function initFileInfo(aFI, aURL, aURLCharset, aDocument,
*/
function promiseTargetFile(aFpP, /* optional */ aSkipPrompt, /* optional */ aRelatedURI)
{
return Task.spawn(function() {
return Task.spawn(function*() {
let downloadLastDir = new DownloadLastDir(window);
let prefBranch = Services.prefs.getBranch("browser.download.");
let useDownloadDir = prefBranch.getBoolPref("useDownloadDir");
@ -795,7 +796,6 @@ function uniqueFile(aLocalFile)
return aLocalFile;
}
#ifdef MOZ_JSDOWNLOADS
/**
* Download a URL using the new jsdownloads API.
*
@ -841,7 +841,6 @@ function DownloadURL(aURL, aFileName, aInitiatingDocument) {
list.add(download);
}).then(null, Components.utils.reportError);
}
#endif
// We have no DOM, and can only save the URL as is.
const SAVEMODE_FILEONLY = 0x00;
@ -1157,10 +1156,10 @@ function getNormalizedLeafName(aFile, aDefaultExtension)
if (!aDefaultExtension)
return aFile;
#ifdef XP_WIN
// Remove trailing dots and spaces on windows
aFile = aFile.replace(/[\s.]+$/, "");
#endif
if (AppConstants.platform == "win") {
// Remove trailing dots and spaces on windows
aFile = aFile.replace(/[\s.]+$/, "");
}
// Remove leading dots
aFile = aFile.replace(/^\.+/, "");

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

@ -43,7 +43,7 @@ toolkit.jar:
content/global/browser-child.js
content/global/browser-content.js
* content/global/buildconfig.html
* content/global/contentAreaUtils.js
content/global/contentAreaUtils.js
#ifndef MOZ_FENNEC
content/global/customizeToolbar.css
content/global/customizeToolbar.js