Bug 1478572 - Turn on ESLint in mail/components/preferences (manual changes). r=aceman

This commit is contained in:
Geoff Lankow 2018-09-06 11:24:50 +12:00
Родитель 47d44c6d73
Коммит 5b169467ce
21 изменённых файлов: 247 добавлений и 390 удалений

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

@ -0,0 +1,14 @@
"use strict";
module.exports = { // eslint-disable-line no-undef
"globals": {
// preferences.js
"AppConstants": true,
"MailServices": true,
"Services": true,
"ExtensionSupport": true,
// subdialogs.js
"gSubDialog": true,
},
};

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

@ -103,9 +103,9 @@
this.lastSelected = aPaneElement.id;
this.currentPane = aPaneElement;
let targetHeight = parseInt(window.getComputedStyle(this._paneDeckContainer, "").height);
let verticalPadding = parseInt(window.getComputedStyle(aPaneElement, "").paddingTop);
verticalPadding += parseInt(window.getComputedStyle(aPaneElement, "").paddingBottom);
let targetHeight = parseInt(window.getComputedStyle(this._paneDeckContainer).height);
let verticalPadding = parseInt(window.getComputedStyle(aPaneElement).paddingTop);
verticalPadding += parseInt(window.getComputedStyle(aPaneElement).paddingBottom);
if (aPaneElement.contentHeight + verticalPadding < targetHeight)
aPaneElement._content.style.height = targetHeight - verticalPadding + "px";
}

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

@ -3,6 +3,9 @@
* 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/. */
// mail/base/content/aboutDialog-appUpdater.js
/* globals appUpdater, gAppUpdater */
// Load DownloadUtils module for convertByteUnits
ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
@ -73,8 +76,7 @@ var gAdvancedPane = {
// If the shell service is not working, disable the "Check now" button
// and "perform check at startup" checkbox.
try {
let shellSvc = Cc["@mozilla.org/mail/shell-service;1"]
.getService(Ci.nsIShellService);
Cc["@mozilla.org/mail/shell-service;1"].getService(Ci.nsIShellService);
this.mShellServiceWorking = true;
} catch (ex) {
// The elements may not exist if HAVE_SHELL_SERVICE is off.
@ -138,7 +140,7 @@ var gAdvancedPane = {
}
}
gAppUpdater = new appUpdater();
gAppUpdater = new appUpdater(); // eslint-disable-line no-global-assign
}
this.mInitialized = true;
@ -213,10 +215,7 @@ var gAdvancedPane = {
actualSizeLabel.value = prefStrBundle.getString("actualDiskCacheSizeCalculated");
try {
let cacheService =
Cc["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Ci.nsICacheStorageService);
cacheService.asyncGetDiskConsumption(this.observer);
Services.cache2.asyncGetDiskConsumption(this.observer);
} catch (e) {}
},
@ -257,81 +256,71 @@ var gAdvancedPane = {
*/
clearCache() {
try {
let cache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Ci.nsICacheStorageService);
cache.clear();
Services.cache2.clear();
} catch (ex) {}
this.updateActualCacheSize();
},
updateButtons(aButtonID, aPreferenceID) {
var button = document.getElementById(aButtonID);
var preference = document.getElementById(aPreferenceID);
// This is actually before the value changes, so the value is not as you expect.
button.disabled = preference.value == true;
return undefined;
/**
* Selects the item of the radiogroup based on the pref values and locked
* states.
*
* UI state matrix for update preference conditions
*
* UI Components: Preferences
* Radiogroup i = app.update.auto
*/
updateReadPrefs() {
let autoPref = document.getElementById("app.update.auto");
let radiogroup = document.getElementById("updateRadioGroup");
if (autoPref.value)
radiogroup.value = "auto"; // Automatically install updates
else
radiogroup.value = "checkOnly"; // Check, but let me choose
let canCheck = Cc["@mozilla.org/updates/update-service;1"].
getService(Ci.nsIApplicationUpdateService).
canCheckForUpdates;
// canCheck is false if the binary platform or OS version is not known.
// A locked pref is sufficient to disable the radiogroup.
radiogroup.disabled = !canCheck || autoPref.locked;
if (AppConstants.MOZ_MAINTENANCE_SERVICE) {
// Check to see if the maintenance service is installed.
// If it is don't show the preference at all.
let installed;
try {
let wrk = Cc["@mozilla.org/windows-registry-key;1"]
.createInstance(Ci.nsIWindowsRegKey);
wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE,
"SOFTWARE\\Mozilla\\MaintenanceService",
wrk.ACCESS_READ | wrk.WOW64_64);
installed = wrk.readIntValue("Installed");
wrk.close();
} catch (e) { }
if (installed != 1) {
document.getElementById("useService").hidden = true;
}
}
},
/**
* Selects the item of the radiogroup based on the pref values and locked
* states.
*
* UI state matrix for update preference conditions
*
* UI Components: Preferences
* Radiogroup i = app.update.auto
*/
updateReadPrefs() {
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
if (autoPref.value)
radiogroup.value = "auto"; // Automatically install updates
else
radiogroup.value = "checkOnly"; // Check, but let me choose
var canCheck = Cc["@mozilla.org/updates/update-service;1"].
getService(Ci.nsIApplicationUpdateService).
canCheckForUpdates;
// canCheck is false if the binary platform or OS version is not known.
// A locked pref is sufficient to disable the radiogroup.
radiogroup.disabled = !canCheck || autoPref.locked;
if (AppConstants.MOZ_MAINTENANCE_SERVICE) {
// Check to see if the maintenance service is installed.
// If it is don't show the preference at all.
let installed;
try {
let wrk = Cc["@mozilla.org/windows-registry-key;1"]
.createInstance(Ci.nsIWindowsRegKey);
wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE,
"SOFTWARE\\Mozilla\\MaintenanceService",
wrk.ACCESS_READ | wrk.WOW64_64);
installed = wrk.readIntValue("Installed");
wrk.close();
} catch (e) { }
if (installed != 1) {
document.getElementById("useService").hidden = true;
/**
* Sets the pref values based on the selected item of the radiogroup.
*/
updateWritePrefs() {
let autoPref = document.getElementById("app.update.auto");
let radiogroup = document.getElementById("updateRadioGroup");
switch (radiogroup.value) {
case "auto": // Automatically install updates
autoPref.value = true;
break;
case "checkOnly": // Check, but but let me choose
autoPref.value = false;
break;
}
}
},
/**
* Sets the pref values based on the selected item of the radiogroup.
*/
updateWritePrefs() {
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
switch (radiogroup.value) {
case "auto": // Automatically install updates
autoPref.value = true;
break;
case "checkOnly": // Check, but but let me choose
autoPref.value = false;
break;
}
},
},
showUpdates() {
gSubDialog.open("chrome://mozapps/content/update/history.xul");
@ -484,13 +473,10 @@ updateWritePrefs() {
},
formatLocaleSetLabels() {
const localeService =
Cc["@mozilla.org/intl/localeservice;1"]
.getService(Ci.mozILocaleService);
const osprefs =
Cc["@mozilla.org/intl/ospreferences;1"]
.getService(Ci.mozIOSPreferences);
let appLocale = localeService.getAppLocalesAsBCP47()[0];
let appLocale = Services.locale.getAppLocalesAsBCP47()[0];
let rsLocale = osprefs.getRegionalPrefsLocales()[0];
let names = Services.intl.getLocaleDisplayNames(undefined, [appLocale, rsLocale]);
let appLocaleRadio = document.getElementById("appLocale");

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

@ -2,6 +2,9 @@
* 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/. */
// applications.js
/* globals gApplicationsPane */
var gAppManagerDialog = {
_removed: [],

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

@ -3,7 +3,14 @@
* 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/. */
//* ***************************************************************************//
// applications.inc.xul
/* globals ICON_URL_APP */
// mail/base/content/contentAreaClick.js
/* globals openLinkExternally */
// toolkit/content/globalOverlay.js
/* globals goUpdateCommand */
// ------------------------------
// Constants & Enumeration Values
var PREF_DISABLED_PLUGIN_TYPES = "plugin.disable_full_page_plugin_for_types";
@ -29,7 +36,7 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
//* ***************************************************************************//
// ---------
// Utilities
function getDisplayNameForFile(aFile) {
@ -87,7 +94,7 @@ ArrayEnumerator.prototype = {
},
};
//* ***************************************************************************//
// ------------------
// HandlerInfoWrapper
/**
@ -116,16 +123,13 @@ HandlerInfoWrapper.prototype = {
// we haven't (yet?) implemented, so we make it a public property.
wrappedHandlerInfo: null,
//* *************************************************************************//
// -----------------
// Convenience Utils
_handlerSvc: Cc["@mozilla.org/uriloader/handler-service;1"]
.getService(Ci.nsIHandlerService),
_categoryMgr: Cc["@mozilla.org/categorymanager;1"]
.getService(Ci.nsICategoryManager),
//* *************************************************************************//
// --------------
// nsIHandlerInfo
// The MIME type or protocol scheme.
@ -164,8 +168,10 @@ HandlerInfoWrapper.prototype = {
addPossibleApplicationHandler(aNewHandler) {
try {
/* eslint-disable mozilla/use-includes-instead-of-indexOf */
if (this.possibleApplicationHandlers.indexOf(0, aNewHandler) != -1)
return;
/* eslint-enable mozilla/use-includes-instead-of-indexOf */
} catch (e) { }
this.possibleApplicationHandlers.appendElement(aNewHandler);
},
@ -252,8 +258,7 @@ HandlerInfoWrapper.prototype = {
this.wrappedHandlerInfo.alwaysAskBeforeHandling = aNewValue;
},
//* *************************************************************************//
// -----------
// nsIMIMEInfo
// The primary file extension associated with this type, if any.
@ -271,8 +276,7 @@ HandlerInfoWrapper.prototype = {
return null;
},
//* *************************************************************************//
// ---------------
// Plugin Handling
// A plugin that can handle this type, if any.
@ -321,9 +325,7 @@ HandlerInfoWrapper.prototype = {
disabledPluginTypes.join(","));
// Update the category manager so existing browser windows update.
this._categoryMgr.deleteCategoryEntry("Gecko-Content-Viewers",
this.type,
false);
Services.catMan.deleteCategoryEntry("Gecko-Content-Viewers", this.type, false);
},
enablePluginType() {
@ -336,16 +338,14 @@ HandlerInfoWrapper.prototype = {
disabledPluginTypes.join(","));
// Update the category manager so existing browser windows update.
this._categoryMgr.
addCategoryEntry("Gecko-Content-Viewers",
this.type,
"@mozilla.org/content/plugin/document-loader-factory;1",
false,
true);
Services.catMan.addCategoryEntry(
"Gecko-Content-Viewers", this.type,
"@mozilla.org/content/plugin/document-loader-factory;1",
false, true
);
},
//* *************************************************************************//
// -------
// Storage
store() {
@ -356,8 +356,7 @@ HandlerInfoWrapper.prototype = {
this._handlerSvc.remove(this.wrappedHandlerInfo);
},
//* *************************************************************************//
// -----
// Icons
get smallIcon() {
@ -618,9 +617,11 @@ var gCloudFileTab = {
},
};
let accountInfo = {account,
listItem: aItem,
result: Cr.NS_ERROR_NOT_AVAILABLE};
let accountInfo = {
account,
listItem: aItem,
result: Cr.NS_ERROR_NOT_AVAILABLE,
};
this._accountCache[accountKey] = accountInfo;
@ -804,7 +805,7 @@ var gCloudFileTab = {
"nsISupportsWeakReference"]),
};
//* ***************************************************************************//
// -------------------
// Prefpane Controller
var gApplicationsPane = {
@ -828,7 +829,7 @@ var gApplicationsPane = {
_visibleTypeDescriptionCount: new Map(),
//* *************************************************************************//
// -----------------------------------
// Convenience & Performance Shortcuts
// These get defined by init().
@ -837,16 +838,15 @@ var gApplicationsPane = {
_list: null,
_filter: null,
_mimeSvc: Cc["@mozilla.org/mime;1"]
.getService(Ci.nsIMIMEService),
_mimeSvc: Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService),
_helperAppSvc: Cc["@mozilla.org/uriloader/external-helper-app-service;1"]
.getService(Ci.nsIExternalHelperAppService),
.getService(Ci.nsIExternalHelperAppService),
_handlerSvc: Cc["@mozilla.org/uriloader/handler-service;1"]
.getService(Ci.nsIHandlerService),
.getService(Ci.nsIHandlerService),
//* *************************************************************************//
// ----------------------------
// Initialization & Destruction
init() {
@ -901,13 +901,12 @@ var gApplicationsPane = {
Services.prefs.removeObserver(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS, this);
},
//* *************************************************************************//
// -----------
// nsISupports
QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
//* *************************************************************************//
// -----------
// nsIObserver
observe(aSubject, aTopic, aData) {
@ -928,8 +927,7 @@ var gApplicationsPane = {
}
},
//* *************************************************************************//
// -------------
// EventListener
handleEvent(aEvent) {
@ -937,8 +935,7 @@ var gApplicationsPane = {
this.destroy();
},
//* *************************************************************************//
// ---------------------------
// Composed Model Construction
_loadData() {
@ -1010,7 +1007,7 @@ var gApplicationsPane = {
}
},
//* *************************************************************************//
// -----------------
// View Construction
_rebuildVisibleTypes() {
@ -1405,9 +1402,6 @@ var gApplicationsPane = {
if (handlerInfo.alwaysAskBeforeHandling)
menu.selectedItem = askMenuItem;
else switch (handlerInfo.preferredAction) {
case Ci.nsIHandlerInfo.handleInternally:
menu.selectedItem = internalMenuItem;
break;
case Ci.nsIHandlerInfo.useSystemDefault:
menu.selectedItem = defaultMenuItem;
break;
@ -1429,8 +1423,7 @@ var gApplicationsPane = {
menu.previousSelectedItem = menu.selectedItem || askMenuItem;
},
//* *************************************************************************//
// -------------------
// Sorting & Filtering
_sortColumn: null,
@ -1495,7 +1488,7 @@ var gApplicationsPane = {
this._filter.select();
},
//* *************************************************************************//
// -------
// Changes
onSelectAction(aActionItem) {
@ -1682,7 +1675,6 @@ var gApplicationsPane = {
this.onDelete(aEvent);
else {
// They hit cancel, so return them to the previously selected item.
let typeItem = this._list.selectedItem;
let menu = document.getAnonymousElementByAttribute(this._list.selectedItem,
"class", "actionsMenu");
menu.selectedItem = menu.previousSelectedItem;

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

@ -21,9 +21,9 @@ var gAttachmentReminderOptionsDialog = {
Ci.nsIPrefLocalizedString);
if (!keywordsInCsv)
return;
var keywordsInCsv = keywordsInCsv.data;
keywordsInCsv = keywordsInCsv.data;
var keywordsInArr = keywordsInCsv.split(",");
for (var i = 0; i < keywordsInArr.length; i++) {
for (let i = 0; i < keywordsInArr.length; i++) {
if (keywordsInArr[i])
this.keywordListBox.appendItem(keywordsInArr[i], keywordsInArr[i]);
}

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

@ -2,6 +2,9 @@
* 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/. */
// messagestyle.js
/* globals previewObserver */
var gChatPane = {
init() {
previewObserver.load();
@ -14,8 +17,9 @@ var gChatPane = {
if (document.getElementById("messenger.status.reportIdle").value) {
broadcaster.removeAttribute("disabled");
this.updateMessageDisabledState();
} else
} else {
broadcaster.setAttribute("disabled", "true");
}
},
updateMessageDisabledState() {

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

@ -162,7 +162,7 @@ var gComposePane = {
.getService(Ci.nsIFontEnumerator);
var localFontCount = { value: 0 };
var localFonts = enumerator.EnumerateAllFonts(localFontCount);
for (var i = 0; i < localFonts.length; ++i) {
for (let i = 0; i < localFonts.length; ++i) {
// Remove Linux system generic fonts that collide with CSS generic fonts.
if (localFonts[i] != "" && localFonts[i] != "serif" &&
localFonts[i] != "sans-serif" && localFonts[i] != "monospace")

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

@ -48,8 +48,9 @@ var gCookiesWindow = {
window.arguments[2].filterString) {
this.setFilter(window.arguments[2].filterString);
}
} else if (document.getElementById("filter").value != "")
this.filter();
} else if (document.getElementById("filter").value != "") {
this.filter();
}
this._saveState();
},
@ -114,8 +115,9 @@ var gCookiesWindow = {
break;
}
}
} else if (hostItem.open)
} else if (hostItem.open) {
rowIndex += hostItem.cookies.length;
}
}
} else {
// Just walk the filter list to find the item. It doesn't matter that
@ -194,14 +196,14 @@ var gCookiesWindow = {
count = hostIndex = cacheItem.count;
}
for (var i = start; i < gCookiesWindow._hostOrder.length; ++i) { // var host in gCookiesWindow._hosts) {
var currHost = gCookiesWindow._hosts[gCookiesWindow._hostOrder[i]]; // gCookiesWindow._hosts[host];
for (let i = start; i < gCookiesWindow._hostOrder.length; ++i) {
let currHost = gCookiesWindow._hosts[gCookiesWindow._hostOrder[i]];
if (!currHost) continue;
if (count == aIndex)
return currHost;
hostIndex = count;
var cacheEntry = { "start": i, "count": count };
let cacheEntry = { start: i, count };
var cacheStart = count;
if (currHost.open) {
@ -209,9 +211,9 @@ var gCookiesWindow = {
// We are looking for an entry within this host's children,
// enumerate them looking for the index.
++count;
for (var i = 0; i < currHost.cookies.length; ++i) {
for (let j = 0; j < currHost.cookies.length; ++j) {
if (count == aIndex) {
var cookie = currHost.cookies[i];
let cookie = currHost.cookies[j];
cookie.parentIndex = hostIndex;
return cookie;
}
@ -224,11 +226,13 @@ var gCookiesWindow = {
// host value too.
count += currHost.cookies.length + 1;
}
} else
} else {
++count;
}
for (var j = cacheStart; j < count; j++)
for (let j = cacheStart; j < count; j++) {
this._cacheItems[j] = cacheEntry;
}
this._cacheValid = count - 1;
}
return null;
@ -239,9 +243,9 @@ var gCookiesWindow = {
if (this._filtered) {
// remove the cookies from the unfiltered set so that they
// don't reappear when the filter is changed. See bug 410863.
for (var i = aIndex; i < aIndex + removeCount; ++i) {
var item = this._filterSet[i];
var parent = gCookiesWindow._hosts[item.rawHost];
for (let i = aIndex; i < aIndex + removeCount; ++i) {
let item = this._filterSet[i];
let parent = gCookiesWindow._hosts[item.rawHost];
for (var j = 0; j < parent.cookies.length; ++j) {
if (item == parent.cookies[j]) {
parent.cookies.splice(j, 1);
@ -253,14 +257,14 @@ var gCookiesWindow = {
return;
}
var item = this._getItemAtIndex(aIndex);
let item = this._getItemAtIndex(aIndex);
if (!item) return;
this._invalidateCache(aIndex - 1);
if (item.container) {
gCookiesWindow._hosts[item.rawHost] = null;
} else {
var parent = this._getItemAtIndex(item.parentIndex);
for (var i = 0; i < parent.cookies.length; ++i) {
let parent = this._getItemAtIndex(item.parentIndex);
for (let i = 0; i < parent.cookies.length; ++i) {
var cookie = parent.cookies[i];
if (item.rawHost == cookie.rawHost &&
item.name == cookie.name &&
@ -280,16 +284,20 @@ var gCookiesWindow = {
getCellText(aIndex, aColumn) {
if (!this._filtered) {
var item = this._getItemAtIndex(aIndex);
if (!item)
if (!item) {
return "";
if (aColumn.id == "domainCol")
}
if (aColumn.id == "domainCol") {
return item.rawHost;
else if (aColumn.id == "nameCol")
}
if (aColumn.id == "nameCol") {
return ("name" in item) ? item.name : "";
} else if (aColumn.id == "domainCol")
return this._filterSet[aIndex].rawHost;
else if (aColumn.id == "nameCol")
return ("name" in this._filterSet[aIndex]) ? this._filterSet[aIndex].name : "";
}
} else if (aColumn.id == "domainCol") {
return this._filterSet[aIndex].rawHost;
} else if (aColumn.id == "nameCol") {
return ("name" in this._filterSet[aIndex]) ? this._filterSet[aIndex].name : "";
}
return "";
},
@ -357,10 +365,9 @@ var gCookiesWindow = {
}
return false;
}
var parent = this._getItemAtIndex(item.parentIndex);
if (parent && parent.container)
return aIndex < item.parentIndex + parent.cookies.length;
let parent = this._getItemAtIndex(item.parentIndex);
if (parent && parent.container)
return aIndex < item.parentIndex + parent.cookies.length;
}
}
return aIndex < this.rowCount - 1;
@ -423,11 +430,13 @@ var gCookiesWindow = {
_addCookie(aStrippedHost, aCookie, aHostCount) {
if (!(aStrippedHost in this._hosts) || !this._hosts[aStrippedHost]) {
this._hosts[aStrippedHost] = { cookies: [],
rawHost: aStrippedHost,
level: 0,
open: false,
container: true };
this._hosts[aStrippedHost] = {
cookies: [],
rawHost: aStrippedHost,
level: 0,
open: false,
container: true,
};
this._hostOrder.push(aStrippedHost);
++aHostCount.value;
}
@ -437,19 +446,19 @@ var gCookiesWindow = {
},
_makeCookieObject(aStrippedHost, aCookie) {
let host = aCookie.host;
let formattedHost = host.startsWith(".") ? host.substring(1) : host;
let c = { name: aCookie.name,
value: aCookie.value,
isDomain: aCookie.isDomain,
host: aCookie.host,
rawHost: aStrippedHost,
path: aCookie.path,
isSecure: aCookie.isSecure,
expires: aCookie.expires,
level: 1,
container: false,
originAttributes: aCookie.originAttributes };
let c = {
name: aCookie.name,
value: aCookie.value,
isDomain: aCookie.isDomain,
host: aCookie.host,
rawHost: aStrippedHost,
path: aCookie.path,
isSecure: aCookie.isSecure,
expires: aCookie.expires,
level: 1,
container: false,
originAttributes: aCookie.originAttributes,
};
return c;
},
@ -463,8 +472,9 @@ var gCookiesWindow = {
if (cookie && cookie instanceof Ci.nsICookie) {
var strippedHost = this._makeStrippedHost(cookie.host);
this._addCookie(strippedHost, cookie, hostCount);
} else
} else {
break;
}
}
this._view._rowCount = hostCount.value;
},
@ -538,7 +548,7 @@ var gCookiesWindow = {
++selectedCookieCount;
}
}
var item = this._view._getItemAtIndex(seln.currentIndex);
item = this._view._getItemAtIndex(seln.currentIndex);
if (item && seln.count == 1 && item.container && item.open)
selectedCookieCount += 2;
@ -612,7 +622,7 @@ var gCookiesWindow = {
var ci = seln.currentIndex;
nextSelected = ci;
var invalidateRow = -1;
var item = this._view._getItemAtIndex(ci);
let item = this._view._getItemAtIndex(ci);
if (item.container) {
rowCountImpact -= (item.open ? item.cookies.length : 0) + 1;
deleteItems = deleteItems.concat(item.cookies);
@ -665,8 +675,7 @@ var gCookiesWindow = {
if (Services.prefs.prefHasUserValue("network.cookie.blockFutureCookies"))
blockFutureCookies = Services.prefs
.getBoolPref("network.cookie.blockFutureCookies");
for (i = 0; i < deleteItems.length; ++i) {
var item = deleteItems[i];
for (let item of deleteItems) {
Services.cookies.remove(item.host, item.name, item.path,
item.originAttributes, blockFutureCookies);
}
@ -780,8 +789,8 @@ var gCookiesWindow = {
_filterCookies(aFilterValue) {
this._view._filterValue = aFilterValue;
var cookies = [];
for (var i = 0; i < gCookiesWindow._hostOrder.length; ++i) { // var host in gCookiesWindow._hosts) {
var currHost = gCookiesWindow._hosts[gCookiesWindow._hostOrder[i]]; // gCookiesWindow._hosts[host];
for (let i = 0; i < gCookiesWindow._hostOrder.length; ++i) {
let currHost = gCookiesWindow._hosts[gCookiesWindow._hostOrder[i]];
if (!currHost) continue;
for (var j = 0; j < currHost.cookies.length; ++j) {
var cookie = currHost.cookies[j];

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

@ -3,6 +3,9 @@
* 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/. */
// toolkit/mozapps/preferences/fontbuilder.js
/* globals FontBuilder */
var gDisplayPane = {
mInitialized: false,
mTagListBox: null,
@ -226,15 +229,13 @@ var gDisplayPane = {
if (index >= 0) {
var tagElToEdit = this.mTagListBox.getItemAtIndex(index);
var args = {result: "", keyToEdit: tagElToEdit.getAttribute("value"), okCallback: editTagCallback};
let dialog = gSubDialog.open("chrome://messenger/content/newTagDialog.xul",
"resizable=no", args);
gSubDialog.open("chrome://messenger/content/newTagDialog.xul", "resizable=no", args);
}
},
addTag() {
var args = {result: "", okCallback: addTagCallback};
let dialog = gSubDialog.open("chrome://messenger/content/newTagDialog.xul",
"resizable=no", args);
gSubDialog.open("chrome://messenger/content/newTagDialog.xul", "resizable=no", args);
},
onSelect() {

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

@ -1,67 +0,0 @@
# -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# 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/.
var requestAlways;
var requestAlwaysPref;
var requestOnSuccess;
var requestOnSuccessPref;
var requestOnFailure;
var requestOnFailurePref;
var requestOnDelay;
var requestOnDelayPref;
var requestNever;
var requestNeverPref;
function onInit()
{
requestAlways = document.getElementById("always_request_on");
requestAlwaysPref = document.getElementById("mail.dsn.always_request_on");
requestOnSuccess = document.getElementById("request_on_success_on");
requestOnSuccessPref = document.getElementById("mail.dsn.request_on_success_on");
requestOnFailure = document.getElementById("request_on_failure_on");
requestOnFailurePref = document.getElementById("mail.dsn.request_on_failure_on");
requestOnDelay = document.getElementById("request_on_delay_on");
requestOnDelayPref = document.getElementById("mail.dsn.request_on_delay_on");
requestNever = document.getElementById("request_never_on");
requestNeverPref = document.getElementById("mail.dsn.request_never_on");
EnableDisableAllowedDSNRequests(new Object());
return true;
}
function EnableDisableAllowedDSNRequests(target)
{
var s = requestOnSuccess.checked;
var f = requestOnFailure.checked;
var d = requestOnDelay.checked;
var n = requestNever.checked;
// Case when the checkbox requestAlways must be enabled
if (s || f || d || n) {
requestAlways.disabled = false;
// Case when the checkbox requestAlways must be disabled
} else if (!d && !n && !s && !f) {
requestAlwaysPref.value = false;
requestAlways.disabled = true;
}
// Checkbox requestNever is exclusive with checkboxes requestOnSuccess, requestOnFailure, requestOnDelay
if (target == requestNever) {
requestOnSuccessPref.value = requestOnFailurePref.value = requestOnDelayPref.value = false;
} else if (target == requestOnSuccess || target == requestOnFailure || target == requestOnDelay) {
requestNeverPref.value = false;
}
}

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

@ -1,100 +0,0 @@
<?xml version="1.0"?>
# -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# 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/.
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!DOCTYPE prefwindow [
<!ENTITY % dsnDTD SYSTEM "chrome://messenger/locale/preferences/dsn.dtd">
%dsnDTD;
]>
<prefwindow id="DSNDialog" type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
dlgbuttons="accept,cancel"
title="&dialog.title;">
<script type="application/javascript" src="chrome://messenger/content/preferences/dsn.js"/>
<prefpane id="DSNDialogPane" onpaneload="onInit();">
<preferences id="DSNPreferences">
<preference id="mail.dsn.request_on_success_on"
name="mail.dsn.request_on_success_on"
type="bool"/>
<preference id="mail.dsn.request_on_failure_on"
name="mail.dsn.request_on_failure_on"
type="bool"/>
<preference id="mail.dsn.request_on_delay_on"
name="mail.dsn.request_on_delay_on"
type="bool"/>
<preference id="mail.dsn.request_never_on"
name="mail.dsn.request_never_on"
type="bool"/>
<preference id="mail.dsn.always_request_on"
name="mail.dsn.always_request_on"
type="bool"/>
<preference id="mail.dsn.ret_full_on"
name="mail.dsn.ret_full_on"
type="bool"/>
</preferences>
<description>&optionTitle.label;</description>
<!-- When this checkbox is checked, DSN request is sent with SUCCESS option -->
<checkbox id="request_on_success_on"
label="&requestOnSucess.label;"
preference="mail.dsn.request_on_success_on"
accesskey="&requestOnSucess.accesskey;"
oncommand="EnableDisableAllowedDSNRequests(this)"/>
<!-- When this checkbox is checked, DSN request is sent with FAILURE option -->
<checkbox id="request_on_failure_on"
label="&requestOnFailure.label;"
preference="mail.dsn.request_on_failure_on"
accesskey="&requestOnFailure.accesskey;"
oncommand="EnableDisableAllowedDSNRequests(this)"/>
<!-- When this checkbox is checked, DSN request is sent with DELAY option -->
<checkbox id="request_on_delay_on"
label="&requestOnDelay.label;"
preference="mail.dsn.request_on_delay_on"
accesskey="&requestOnDelay.accesskey;"
oncommand="EnableDisableAllowedDSNRequests(this)"/>
<!-- When this checkbox is checked, DSN request is sent with NEVER option -->
<checkbox id="request_never_on"
label="&requestNever.label;"
preference="mail.dsn.request_never_on"
accesskey="&requestNever.accesskey;"
oncommand="EnableDisableAllowedDSNRequests(this)"/>
<separator class="thin"/>
<separator class="groove"/>
<separator class="thin"/>
<checkbox id="always_request_on"
label="&requestAlways.label;"
preference="mail.dsn.always_request_on"
accesskey="&requestAlways.accesskey;"/>
<separator class="thin"/>
<separator class="groove"/>
<separator class="thin"/>
<label value="&RET_FailureMessage.label;" control="ret_full_on"/>
<radiogroup id="ret_full_on" preference="mail.dsn.ret_full_on" orient="horizontal">
<radio value="true" label="&RET_FULL.label;" accesskey="&RET_FULL.accesskey;" />
<radio value="false" label="&RET_HDRS.label;" accesskey="&RET_HDRS.accesskey;" />
</radiogroup>
<separator class="thin"/>
</prefpane>
</prefwindow>

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

@ -3,6 +3,11 @@
* 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/. */
// toolkit/content/preferencesBindings.js
/* globals Preferences */
// toolkit/mozapps/preferences/fontbuilder.js
/* globals FontBuilder */
ChromeUtils.import("resource://gre/modules/Services.jsm");
var kDefaultFontType = "font.default.%LANG%";

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

@ -18,6 +18,8 @@
<!-- Overriding listitem -->
<property name="selected" onget="return this.getAttribute('selected') == 'true';">
<setter><![CDATA[
// applications.js
/* globals gApplicationsPane */
if (val) {
this.setAttribute("selected", "true");
gApplicationsPane.rebuildActionsMenu();

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

@ -4,7 +4,7 @@
var jsProtoHelper = {};
ChromeUtils.import("resource:///modules/jsProtoHelper.jsm", jsProtoHelper);
ChromeUtils.import("resource:///modules/imThemes.jsm");
const { getThemeByName, getThemeVariants } = ChromeUtils.import("resource:///modules/imThemes.jsm", null);
function Conversation(aName) {
this._name = aName;
@ -55,8 +55,6 @@ var previewObserver = {
previewObserver.conv = conv;
let themeName = document.getElementById("messagestyle-themename");
if (themeName.value && !themeName.selectedItem)
themeName.value = themeName.value;
previewObserver.browser = document.getElementById("previewbrowser");
document.getElementById("showHeaderCheckbox")
.addEventListener("CheckboxStateChange",

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

@ -13,7 +13,8 @@ var gOfflineDialog = {
offlineStartupStatePref.disabled = offlineAutoDetection.value;
if (offlineStartupStatePref.disabled) {
offlineStartupStatePref.value = kAutomatic;
} else if (offlineStartupStatePref.value == kAutomatic)
offlineStartupStatePref.value = kRememberLastState;
} else if (offlineStartupStatePref.value == kAutomatic) {
offlineStartupStatePref.value = kRememberLastState;
}
},
};

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

@ -2,6 +2,9 @@
* 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/. */
// toolkit/content/treeUtils.js
/* globals gTreeUtils */
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
@ -224,7 +227,7 @@ var gPermissionManager = {
var permissionsText = document.getElementById("permissionsText");
while (permissionsText.hasChildNodes())
permissionsText.removeChild(permissionsText.firstChild);
permissionsText.firstChild.remove();
permissionsText.appendChild(document.createTextNode(aParams.introText));
document.title = aParams.windowTitle;
@ -378,7 +381,6 @@ var gPermissionManager = {
this._permissions = [];
// load permissions into a table
var count = 0;
var enumerator = Services.perms.enumerator;
while (enumerator.hasMoreElements()) {
var nextPermission = enumerator.getNext().QueryInterface(Ci.nsIPermission);

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

@ -2,6 +2,9 @@
* 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/. */
// mail/base/content/specialTabs.js
/* globals contentTabBaseType, DOMLinkHandler */
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource:///modules/errUtils.js");

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

@ -60,13 +60,15 @@ var gPrivacyPane = {
*/
showCookieExceptions() {
let bundle = document.getElementById("bundlePreferences");
let params = { blockVisible: true,
sessionVisible: true,
allowVisible: true,
prefilledHost: "",
permissionType: "cookie",
windowTitle: bundle.getString("cookiepermissionstitle"),
introText: bundle.getString("cookiepermissionstext") };
let params = {
blockVisible: true,
sessionVisible: true,
allowVisible: true,
prefilledHost: "",
permissionType: "cookie",
windowTitle: bundle.getString("cookiepermissionstitle"),
introText: bundle.getString("cookiepermissionstext"),
};
gSubDialog.open("chrome://messenger/content/preferences/permissions.xul",
null, params);
},
@ -118,13 +120,15 @@ var gPrivacyPane = {
*/
showRemoteContentExceptions() {
let bundle = document.getElementById("bundlePreferences");
let params = { blockVisible: true,
sessionVisible: false,
allowVisible: true,
prefilledHost: "",
permissionType: "image",
windowTitle: bundle.getString("imagepermissionstitle"),
introText: bundle.getString("imagepermissionstext") };
let params = {
blockVisible: true,
sessionVisible: false,
allowVisible: true,
prefilledHost: "",
permissionType: "image",
windowTitle: bundle.getString("imagepermissionstitle"),
introText: bundle.getString("imagepermissionstext"),
};
gSubDialog.open("chrome://messenger/content/preferences/permissions.xul",
null, params);
},

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

@ -69,8 +69,9 @@ var gSecurityPane = {
*/
reloadMessageInOpener() {
if (Services.prefs.getBoolPref("browser.preferences.instantApply") &&
window.opener && typeof(window.opener.ReloadMessage) == "function")
window.opener && typeof(window.opener.ReloadMessage) == "function") {
window.opener.ReloadMessage();
}
},
/**
@ -147,7 +148,8 @@ var gSecurityPane = {
},
updateDownloadedPhishingListState() {
document.getElementById("useDownloadedList").disabled = !document.getElementById("enablePhishingDetector").checked;
document.getElementById("useDownloadedList").disabled =
!document.getElementById("enablePhishingDetector").checked;
},
};

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

@ -15,7 +15,6 @@ var gSendOptionsDialog = {
this.mHTMLListBox = document.getElementById("html_domains");
this.mPlainTextListBox = document.getElementById("plaintext_domains");
var htmlDomainPrefString = document.getElementById("mailnews.html_domains").value;
this.loadDomains(document.getElementById("mailnews.html_domains").value,
this.mHTMLListBox);
this.loadDomains(document.getElementById("mailnews.plaintext_domains").value,
@ -27,7 +26,7 @@ var gSendOptionsDialog = {
var num_domains = 0;
var pref_string = "";
for (var item = listbox.firstChild; item != null; item = item.nextSibling) {
for (let item = listbox.firstChild; item != null; item = item.nextSibling) {
var domainid = item.firstChild.getAttribute("value");
if (domainid.length > 1) {
num_domains++;
@ -44,13 +43,12 @@ var gSendOptionsDialog = {
},
loadDomains(aPrefString, aListBox) {
var arrayOfPrefs = aPrefString.split(",");
if (arrayOfPrefs)
for (var i = 0; i < arrayOfPrefs.length; i++) {
var str = arrayOfPrefs[i].replace(/ /g, "");
if (str)
this.addItemToDomainList(aListBox, str);
for (let str of aPrefString.split(",")) {
str = str.replace(/ /g, "");
if (str) {
this.addItemToDomainList(aListBox, str);
}
}
},
removeDomains(aHTML) {