mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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
This commit is contained in:
parent
00ec37e011
commit
9d4c7a1cd4
@ -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
|
||||
|
@ -83,6 +83,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 = {
|
||||
|
||||
@ -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");
|
||||
@ -693,7 +694,7 @@ function promiseTargetFile(aFpP, /* optional */ aSkipPrompt, /* optional */ aRel
|
||||
dir.append(getNormalizedLeafName(aFpP.fileInfo.fileName,
|
||||
aFpP.fileInfo.fileExt));
|
||||
aFpP.file = uniqueFile(dir);
|
||||
throw new Task.Result(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
// We must prompt for the file name explicitly.
|
||||
@ -748,7 +749,7 @@ function promiseTargetFile(aFpP, /* optional */ aSkipPrompt, /* optional */ aRel
|
||||
});
|
||||
let result = yield deferComplete.promise;
|
||||
if (result == Components.interfaces.nsIFilePicker.returnCancel || !fp.file) {
|
||||
throw new Task.Result(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aFpP.saveMode != SAVEMODE_FILEONLY)
|
||||
@ -763,7 +764,7 @@ function promiseTargetFile(aFpP, /* optional */ aSkipPrompt, /* optional */ aRel
|
||||
aFpP.file = fp.file;
|
||||
aFpP.fileURL = fp.fileURL;
|
||||
|
||||
throw new Task.Result(true);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@ -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
|
||||
if (AppConstants.platform == "win") {
|
||||
// Remove trailing dots and spaces on windows
|
||||
aFile = aFile.replace(/[\s.]+$/, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
// 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
|
||||
|
Loading…
Reference in New Issue
Block a user