From 5b169467ceb8019ca7b0d5120917735ca4c2bdd9 Mon Sep 17 00:00:00 2001 From: Geoff Lankow Date: Thu, 6 Sep 2018 11:24:50 +1200 Subject: [PATCH] Bug 1478572 - Turn on ESLint in mail/components/preferences (manual changes). r=aceman --- mail/components/preferences/.eslintrc.js | 14 ++ .../preferences/aboutPreferences.xml | 6 +- mail/components/preferences/advanced.js | 144 ++++++++---------- .../preferences/applicationManager.js | 3 + mail/components/preferences/applications.js | 92 +++++------ .../preferences/attachmentReminder.js | 4 +- mail/components/preferences/chat.js | 6 +- mail/components/preferences/compose.js | 2 +- mail/components/preferences/cookies.js | 113 +++++++------- mail/components/preferences/display.js | 9 +- mail/components/preferences/dsn.js | 67 -------- mail/components/preferences/dsn.xul | 100 ------------ mail/components/preferences/fonts.js | 5 + mail/components/preferences/handlers.xml | 2 + mail/components/preferences/messagestyle.js | 4 +- mail/components/preferences/offline.js | 5 +- mail/components/preferences/permissions.js | 6 +- mail/components/preferences/preferencesTab.js | 3 + mail/components/preferences/privacy.js | 32 ++-- mail/components/preferences/security.js | 6 +- mail/components/preferences/sendoptions.js | 14 +- 21 files changed, 247 insertions(+), 390 deletions(-) create mode 100644 mail/components/preferences/.eslintrc.js delete mode 100644 mail/components/preferences/dsn.js delete mode 100644 mail/components/preferences/dsn.xul diff --git a/mail/components/preferences/.eslintrc.js b/mail/components/preferences/.eslintrc.js new file mode 100644 index 0000000000..9be94d8110 --- /dev/null +++ b/mail/components/preferences/.eslintrc.js @@ -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, + }, +}; diff --git a/mail/components/preferences/aboutPreferences.xml b/mail/components/preferences/aboutPreferences.xml index d3a2215809..fbf987b4a2 100644 --- a/mail/components/preferences/aboutPreferences.xml +++ b/mail/components/preferences/aboutPreferences.xml @@ -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"; } diff --git a/mail/components/preferences/advanced.js b/mail/components/preferences/advanced.js index df234ad64a..840fe34b19 100644 --- a/mail/components/preferences/advanced.js +++ b/mail/components/preferences/advanced.js @@ -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"); diff --git a/mail/components/preferences/applicationManager.js b/mail/components/preferences/applicationManager.js index 862bd53374..8da7fbee1c 100644 --- a/mail/components/preferences/applicationManager.js +++ b/mail/components/preferences/applicationManager.js @@ -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: [], diff --git a/mail/components/preferences/applications.js b/mail/components/preferences/applications.js index b0d58ac92a..e10637d4bb 100644 --- a/mail/components/preferences/applications.js +++ b/mail/components/preferences/applications.js @@ -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; diff --git a/mail/components/preferences/attachmentReminder.js b/mail/components/preferences/attachmentReminder.js index 60fdbb5510..d7f43b38ab 100644 --- a/mail/components/preferences/attachmentReminder.js +++ b/mail/components/preferences/attachmentReminder.js @@ -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]); } diff --git a/mail/components/preferences/chat.js b/mail/components/preferences/chat.js index b4bdcb33fe..a90d0958d1 100644 --- a/mail/components/preferences/chat.js +++ b/mail/components/preferences/chat.js @@ -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() { diff --git a/mail/components/preferences/compose.js b/mail/components/preferences/compose.js index b7e2950e28..d4f17aeca3 100644 --- a/mail/components/preferences/compose.js +++ b/mail/components/preferences/compose.js @@ -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") diff --git a/mail/components/preferences/cookies.js b/mail/components/preferences/cookies.js index 9ebe22b2f2..3f39b7408d 100644 --- a/mail/components/preferences/cookies.js +++ b/mail/components/preferences/cookies.js @@ -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]; diff --git a/mail/components/preferences/display.js b/mail/components/preferences/display.js index 79a8f28234..c119860332 100644 --- a/mail/components/preferences/display.js +++ b/mail/components/preferences/display.js @@ -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() { diff --git a/mail/components/preferences/dsn.js b/mail/components/preferences/dsn.js deleted file mode 100644 index feb580995a..0000000000 --- a/mail/components/preferences/dsn.js +++ /dev/null @@ -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; - } -} diff --git a/mail/components/preferences/dsn.xul b/mail/components/preferences/dsn.xul deleted file mode 100644 index 2143340ad0..0000000000 --- a/mail/components/preferences/dsn.xul +++ /dev/null @@ -1,100 +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/. - - - - -%dsnDTD; -]> - - - -