Bug 1325464 - Use ES6 method syntax for preferences. r=MattN

MozReview-Commit-ID: k3Bkm39TtT

--HG--
extra : rebase_source : a3e78734613429ec157e56cf9ef5a087f3f4da61
This commit is contained in:
Jared Wein 2016-12-22 15:57:40 -05:00
parent 8e8534e2d5
commit 69215fad47
10 changed files with 261 additions and 261 deletions

View File

@ -18,7 +18,7 @@ var gAdvancedPane = {
/**
* Brings the appropriate tab to the front and initializes various bits of UI.
*/
init: function()
init()
{
function setEventListener(aId, aEventType, aCallback)
{
@ -120,7 +120,7 @@ var gAdvancedPane = {
* Stores the identity of the current tab in preferences so that the selected
* tab can be persisted between openings of the preferences window.
*/
tabSelectionChanged: function()
tabSelectionChanged()
{
if (!this._inited)
return;
@ -182,7 +182,7 @@ var gAdvancedPane = {
* the current value to enable proper pref restoration if the checkbox is
* never changed.
*/
readCheckSpelling: function()
readCheckSpelling()
{
var pref = document.getElementById("layout.spellcheckDefault");
this._storedSpellCheck = pref.value;
@ -195,7 +195,7 @@ var gAdvancedPane = {
* preserving the preference's "hidden" value if the preference is
* unchanged and represents a value not strictly allowed in UI.
*/
writeCheckSpelling: function()
writeCheckSpelling()
{
var checkbox = document.getElementById("checkSpelling");
if (checkbox.checked) {
@ -211,7 +211,7 @@ var gAdvancedPane = {
* security.OCSP.enabled is an integer value for legacy reasons.
* A value of 1 means OCSP is enabled. Any other value means it is disabled.
*/
readEnableOCSP: function()
readEnableOCSP()
{
var preference = document.getElementById("security.OCSP.enabled");
// This is the case if the preference is the default value.
@ -224,7 +224,7 @@ var gAdvancedPane = {
/**
* See documentation for readEnableOCSP.
*/
writeEnableOCSP: function()
writeEnableOCSP()
{
var checkbox = document.getElementById("enableOCSP");
return checkbox.checked ? 1 : 0;
@ -234,7 +234,7 @@ var gAdvancedPane = {
* When the user toggles the layers.acceleration.disabled pref,
* sync its new value to the gfx.direct2d.disabled pref too.
*/
updateHardwareAcceleration: function()
updateHardwareAcceleration()
{
if (AppConstants.platform = "win") {
var fromPref = document.getElementById("layers.acceleration.disabled");
@ -248,7 +248,7 @@ var gAdvancedPane = {
/**
* Set up or hide the Learn More links for various data collection options
*/
_setupLearnMoreLink: function(pref, element) {
_setupLearnMoreLink(pref, element) {
// set up the Learn More link with the correct URL
let url = Services.prefs.getCharPref(pref);
let el = document.getElementById(element);
@ -263,7 +263,7 @@ var gAdvancedPane = {
/**
*
*/
initSubmitCrashes: function()
initSubmitCrashes()
{
this._setupLearnMoreLink("toolkit.crashreporter.infoURL",
"crashReporterLearnMore");
@ -274,7 +274,7 @@ var gAdvancedPane = {
*
* In all cases, set up the Learn More link sanely.
*/
initTelemetry: function()
initTelemetry()
{
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
@ -285,7 +285,7 @@ var gAdvancedPane = {
* Set the status of the telemetry controls based on the input argument.
* @param {Boolean} aEnabled False disables the controls, true enables them.
*/
setTelemetrySectionEnabled: function(aEnabled)
setTelemetrySectionEnabled(aEnabled)
{
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
// If FHR is disabled, additional data sharing should be disabled as well.
@ -302,7 +302,7 @@ var gAdvancedPane = {
/**
* Initialize the health report service reference and checkbox.
*/
initSubmitHealthReport: function() {
initSubmitHealthReport() {
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
@ -321,7 +321,7 @@ var gAdvancedPane = {
/**
* Update the health report preference with state from checkbox.
*/
updateSubmitHealthReport: function() {
updateSubmitHealthReport() {
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
let checkbox = document.getElementById("submitHealthReportBox");
Services.prefs.setBoolPref(PREF_UPLOAD_ENABLED, checkbox.checked);
@ -351,16 +351,16 @@ var gAdvancedPane = {
/**
* Displays a dialog in which proxy settings may be changed.
*/
showConnections: function()
showConnections()
{
gSubDialog.open("chrome://browser/content/preferences/connection.xul");
},
showSiteDataSettings: function() {
showSiteDataSettings() {
gSubDialog.open("chrome://browser/content/preferences/siteDataSettings.xul");
},
updateTotalSiteDataSize: function() {
updateTotalSiteDataSize() {
SiteDataManager.getTotalUsage()
.then(usage => {
let size = DownloadUtils.convertByteUnits(usage);
@ -373,14 +373,14 @@ var gAdvancedPane = {
},
// Retrieves the amount of space currently used by disk cache
updateActualCacheSize: function()
updateActualCacheSize()
{
var actualSizeLabel = document.getElementById("actualDiskCacheSize");
var prefStrBundle = document.getElementById("bundlePreferences");
// Needs to root the observer since cache service keeps only a weak reference.
this.observer = {
onNetworkCacheDiskConsumption: function(consumption) {
onNetworkCacheDiskConsumption(consumption) {
var size = DownloadUtils.convertByteUnits(consumption);
// The XBL binding for the string bundle may have been destroyed if
// the page was closed before this callback was executed.
@ -407,10 +407,10 @@ var gAdvancedPane = {
},
// Retrieves the amount of space currently used by offline cache
updateActualAppCacheSize: function()
updateActualAppCacheSize()
{
var visitor = {
onCacheStorageInfo: function(aEntryCount, aConsumption, aCapacity, aDiskDirectory)
onCacheStorageInfo(aEntryCount, aConsumption, aCapacity, aDiskDirectory)
{
var actualSizeLabel = document.getElementById("actualAppCacheSize");
var sizeStrings = DownloadUtils.convertByteUnits(aConsumption);
@ -434,14 +434,14 @@ var gAdvancedPane = {
} catch (e) {}
},
updateCacheSizeUI: function(smartSizeEnabled)
updateCacheSizeUI(smartSizeEnabled)
{
document.getElementById("useCacheBefore").disabled = smartSizeEnabled;
document.getElementById("cacheSize").disabled = smartSizeEnabled;
document.getElementById("useCacheAfter").disabled = smartSizeEnabled;
},
readSmartSizeEnabled: function()
readSmartSizeEnabled()
{
// The smart_size.enabled preference element is inverted="true", so its
// value is the opposite of the actual pref value
@ -480,7 +480,7 @@ var gAdvancedPane = {
/**
* Clears the cache.
*/
clearCache: function()
clearCache()
{
try {
var cache = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
@ -493,7 +493,7 @@ var gAdvancedPane = {
/**
* Clears the application cache.
*/
clearOfflineAppCache: function()
clearOfflineAppCache()
{
Components.utils.import("resource:///modules/offlineAppCache.jsm");
OfflineAppCacheHelper.clear();
@ -502,7 +502,7 @@ var gAdvancedPane = {
this.updateOfflineApps();
},
clearSiteData: function() {
clearSiteData() {
let flags =
Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0 +
Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1 +
@ -519,7 +519,7 @@ var gAdvancedPane = {
}
},
readOfflineNotify: function()
readOfflineNotify()
{
var pref = document.getElementById("browser.offline-apps.notify");
var button = document.getElementById("offlineNotifyExceptions");
@ -527,7 +527,7 @@ var gAdvancedPane = {
return pref.value;
},
showOfflineExceptions: function()
showOfflineExceptions()
{
var bundlePreferences = document.getElementById("bundlePreferences");
var params = { blockVisible : false,
@ -569,7 +569,7 @@ var gAdvancedPane = {
/**
* Updates the list of offline applications
*/
updateOfflineApps: function()
updateOfflineApps()
{
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
@ -610,7 +610,7 @@ var gAdvancedPane = {
}
},
offlineAppSelected: function()
offlineAppSelected()
{
var removeButton = document.getElementById("offlineAppsListRemove");
var list = document.getElementById("offlineAppsList");
@ -621,7 +621,7 @@ var gAdvancedPane = {
}
},
removeOfflineApp: function()
removeOfflineApp()
{
var list = document.getElementById("offlineAppsList");
var item = list.selectedItem;
@ -702,7 +702,7 @@ var gAdvancedPane = {
* ii t/f f false
* ii t/f *t* *true*
*/
updateReadPrefs: function()
updateReadPrefs()
{
if (AppConstants.MOZ_UPDATER) {
var enabledPref = document.getElementById("app.update.enabled");
@ -748,7 +748,7 @@ var gAdvancedPane = {
/**
* Sets the pref values based on the selected item of the radiogroup.
*/
updateWritePrefs: function()
updateWritePrefs()
{
if (AppConstants.MOZ_UPDATER) {
var enabledPref = document.getElementById("app.update.enabled");
@ -773,7 +773,7 @@ var gAdvancedPane = {
/**
* Displays the history of installed updates.
*/
showUpdates: function()
showUpdates()
{
gSubDialog.open("chrome://mozapps/content/update/history.xul");
},
@ -795,7 +795,7 @@ var gAdvancedPane = {
/**
* Displays the user's certificates and associated options.
*/
showCertificates: function()
showCertificates()
{
gSubDialog.open("chrome://pippki/content/certManager.xul");
},
@ -803,12 +803,12 @@ var gAdvancedPane = {
/**
* Displays a dialog from which the user can manage his security devices.
*/
showSecurityDevices: function()
showSecurityDevices()
{
gSubDialog.open("chrome://pippki/content/device_manager.xul");
},
observe: function(aSubject, aTopic, aData) {
observe(aSubject, aTopic, aData) {
if (AppConstants.MOZ_UPDATER) {
switch (aTopic) {
case "nsPref:changed":

View File

@ -119,11 +119,11 @@ function ArrayEnumerator(aItems) {
ArrayEnumerator.prototype = {
_index: 0,
hasMoreElements: function() {
hasMoreElements() {
return this._index < this._contents.length;
},
getNext: function() {
getNext() {
return this._contents[this._index++];
}
};
@ -172,7 +172,7 @@ HandlerInfoWrapper.prototype = {
_categoryMgr: Cc["@mozilla.org/categorymanager;1"].
getService(Ci.nsICategoryManager),
element: function(aID) {
element(aID) {
return document.getElementById(aID);
},
@ -214,7 +214,7 @@ HandlerInfoWrapper.prototype = {
return this.wrappedHandlerInfo.possibleApplicationHandlers;
},
addPossibleApplicationHandler: function(aNewHandler) {
addPossibleApplicationHandler(aNewHandler) {
var possibleApps = this.possibleApplicationHandlers.enumerate();
while (possibleApps.hasMoreElements()) {
if (possibleApps.getNext().equals(aNewHandler))
@ -223,7 +223,7 @@ HandlerInfoWrapper.prototype = {
this.possibleApplicationHandlers.appendElement(aNewHandler, false);
},
removePossibleApplicationHandler: function(aHandler) {
removePossibleApplicationHandler(aHandler) {
var defaultApp = this.preferredApplicationHandler;
if (defaultApp && aHandler.equals(defaultApp)) {
// If the app we remove was the default app, we must make sure
@ -362,7 +362,7 @@ HandlerInfoWrapper.prototype = {
return this._getDisabledPluginTypes().indexOf(this.type) != -1;
},
_getDisabledPluginTypes: function() {
_getDisabledPluginTypes() {
var types = "";
if (this._prefSvc.prefHasUserValue(PREF_DISABLED_PLUGIN_TYPES))
@ -376,7 +376,7 @@ HandlerInfoWrapper.prototype = {
return [];
},
disablePluginType: function() {
disablePluginType() {
var disabledPluginTypes = this._getDisabledPluginTypes();
if (disabledPluginTypes.indexOf(this.type) == -1)
@ -391,7 +391,7 @@ HandlerInfoWrapper.prototype = {
false);
},
enablePluginType: function() {
enablePluginType() {
var disabledPluginTypes = this._getDisabledPluginTypes();
var type = this.type;
@ -412,7 +412,7 @@ HandlerInfoWrapper.prototype = {
// Storage
store: function() {
store() {
this._handlerSvc.store(this.wrappedHandlerInfo);
},
@ -423,7 +423,7 @@ HandlerInfoWrapper.prototype = {
return this._getIcon(16);
},
_getIcon: function(aSize) {
_getIcon(aSize) {
if (this.primaryExtension)
return "moz-icon://goat." + this.primaryExtension + "?size=" + aSize;
@ -529,7 +529,7 @@ FeedHandlerInfo.prototype = {
_inner: [],
_removed: [],
QueryInterface: function(aIID) {
QueryInterface(aIID) {
if (aIID.equals(Ci.nsIMutableArray) ||
aIID.equals(Ci.nsIArray) ||
aIID.equals(Ci.nsISupports))
@ -542,20 +542,20 @@ FeedHandlerInfo.prototype = {
return this._inner.length;
},
enumerate: function() {
enumerate() {
return new ArrayEnumerator(this._inner);
},
appendElement: function(aHandlerApp, aWeak) {
appendElement(aHandlerApp, aWeak) {
this._inner.push(aHandlerApp);
},
removeElementAt: function(aIndex) {
removeElementAt(aIndex) {
this._removed.push(this._inner[aIndex]);
this._inner.splice(aIndex, 1);
},
queryElementAt: function(aIndex, aInterface) {
queryElementAt(aIndex, aInterface) {
return this._inner[aIndex].QueryInterface(aInterface);
}
};
@ -725,7 +725,7 @@ FeedHandlerInfo.prototype = {
// so we when the controller calls store() after modifying the handlers,
// the only thing we need to store is the removal of possible handlers
// XXX Should we hold off on making the changes until this method gets called?
store: function() {
store() {
for (let app of this._possibleApplicationHandlers._removed) {
if (app instanceof Ci.nsILocalHandlerApp) {
let pref = this.element(PREF_FEED_SELECTED_APP);
@ -800,7 +800,7 @@ InternalHandlerInfoWrapper.prototype = {
// Override store so we so we can notify any code listening for registration
// or unregistration of this handler.
store: function() {
store() {
HandlerInfoWrapper.prototype.store.call(this);
Services.obs.notifyObservers(null, this._handlerChanged, null);
},
@ -873,7 +873,7 @@ var gApplicationsPane = {
// Initialization & Destruction
init: function() {
init() {
function setEventListener(aId, aEventType, aCallback)
{
document.getElementById(aId)
@ -952,7 +952,7 @@ var gApplicationsPane = {
setTimeout(_delayedPaneLoad, 0, this);
},
destroy: function() {
destroy() {
window.removeEventListener("unload", this, false);
this._prefSvc.removeObserver(PREF_SHOW_PLUGINS_IN_LIST, this);
this._prefSvc.removeObserver(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS, this);
@ -975,7 +975,7 @@ var gApplicationsPane = {
// nsISupports
QueryInterface: function(aIID) {
QueryInterface(aIID) {
if (aIID.equals(Ci.nsIObserver) ||
aIID.equals(Ci.nsIDOMEventListener ||
aIID.equals(Ci.nsISupports)))
@ -987,7 +987,7 @@ var gApplicationsPane = {
// nsIObserver
observe: function(aSubject, aTopic, aData) {
observe(aSubject, aTopic, aData) {
// Rebuild the list when there are changes to preferences that influence
// whether or not to show certain entries in the list.
if (aTopic == "nsPref:changed" && !this._storingAction) {
@ -1008,7 +1008,7 @@ var gApplicationsPane = {
// nsIDOMEventListener
handleEvent: function(aEvent) {
handleEvent(aEvent) {
if (aEvent.type == "unload") {
this.destroy();
}
@ -1017,14 +1017,14 @@ var gApplicationsPane = {
// Composed Model Construction
_loadData: function() {
_loadData() {
this._loadFeedHandler();
this._loadInternalHandlers();
this._loadPluginHandlers();
this._loadApplicationHandlers();
},
_loadFeedHandler: function() {
_loadFeedHandler() {
this._handledTypes[TYPE_MAYBE_FEED] = feedHandlerInfo;
feedHandlerInfo.handledOnlyByPlugin = false;
@ -1039,7 +1039,7 @@ var gApplicationsPane = {
* Load higher level internal handlers so they can be turned on/off in the
* applications menu.
*/
_loadInternalHandlers: function() {
_loadInternalHandlers() {
var internalHandlers = [pdfHandlerInfo];
for (let internalHandler of internalHandlers) {
if (internalHandler.enabled) {
@ -1066,7 +1066,7 @@ var gApplicationsPane = {
* enabledPlugin to get the plugin that would be used, we'd still need to
* check the pref ourselves to find out if it's enabled.
*/
_loadPluginHandlers: function() {
_loadPluginHandlers() {
"use strict";
let mimeTypes = navigator.mimeTypes;
@ -1089,7 +1089,7 @@ var gApplicationsPane = {
/**
* Load the set of handlers defined by the application datastore.
*/
_loadApplicationHandlers: function() {
_loadApplicationHandlers() {
var wrappedHandlerInfos = this._handlerSvc.enumerate();
while (wrappedHandlerInfos.hasMoreElements()) {
let wrappedHandlerInfo =
@ -1111,7 +1111,7 @@ var gApplicationsPane = {
// View Construction
_rebuildVisibleTypes: function() {
_rebuildVisibleTypes() {
// Reset the list of visible types and the visible type description counts.
this._visibleTypes = [];
this._visibleTypeDescriptionCount = {};
@ -1150,7 +1150,7 @@ var gApplicationsPane = {
}
},
_rebuildView: function() {
_rebuildView() {
// Clear the list of entries.
while (this._list.childNodes.length > 1)
this._list.removeChild(this._list.lastChild);
@ -1181,7 +1181,7 @@ var gApplicationsPane = {
this._selectLastSelectedType();
},
_matchesFilter: function(aType) {
_matchesFilter(aType) {
var filterValue = this._filter.value.toLowerCase();
return this._describeType(aType).toLowerCase().indexOf(filterValue) != -1 ||
this._describePreferredAction(aType).toLowerCase().indexOf(filterValue) != -1;
@ -1197,7 +1197,7 @@ var gApplicationsPane = {
* @param aHandlerInfo {nsIHandlerInfo} the type being described
* @returns {string} a description of the type
*/
_describeType: function(aHandlerInfo) {
_describeType(aHandlerInfo) {
if (this._visibleTypeDescriptionCount[aHandlerInfo.description] > 1)
return this._prefsBundle.getFormattedString("typeDescriptionWithType",
[aHandlerInfo.description,
@ -1218,7 +1218,7 @@ var gApplicationsPane = {
* is being described
* @returns {string} a description of the action
*/
_describePreferredAction: function(aHandlerInfo) {
_describePreferredAction(aHandlerInfo) {
// alwaysAskBeforeHandling overrides the preferred action, so if that flag
// is set, then describe that behavior instead. For most types, this is
// the "alwaysAsk" string, but for the feed type we show something special.
@ -1280,7 +1280,7 @@ var gApplicationsPane = {
}
},
_selectLastSelectedType: function() {
_selectLastSelectedType() {
// If the list is disabled by the pref.downloads.disable_button.edit_actions
// preference being locked, then don't select the type, as that would cause
// it to appear selected, with a different background and an actions menu
@ -1306,7 +1306,7 @@ var gApplicationsPane = {
*
* @returns {boolean} whether or not it's valid
*/
isValidHandlerApp: function(aHandlerApp) {
isValidHandlerApp(aHandlerApp) {
if (!aHandlerApp)
return false;
@ -1322,7 +1322,7 @@ var gApplicationsPane = {
return false;
},
_isValidHandlerExecutable: function(aExecutable) {
_isValidHandlerExecutable(aExecutable) {
let leafName;
if (AppConstants.platform == "win") {
leafName = `${AppConstants.MOZ_APP_NAME}.exe`;
@ -1344,7 +1344,7 @@ var gApplicationsPane = {
* Rebuild the actions menu for the selected entry. Gets called by
* the richlistitem constructor when an entry in the list gets selected.
*/
rebuildActionsMenu: function() {
rebuildActionsMenu() {
var typeItem = this._list.selectedItem;
var handlerInfo = this._handledTypes[typeItem.type];
var menu =
@ -1539,7 +1539,7 @@ var gApplicationsPane = {
/**
* Sort the list when the user clicks on a column header.
*/
sort: function(event) {
sort(event) {
var column = event.target;
// If the user clicked on a new sort column, remove the direction indicator
@ -1562,7 +1562,7 @@ var gApplicationsPane = {
/**
* Sort the list of visible types by the current sort column/direction.
*/
_sortVisibleTypes: function() {
_sortVisibleTypes() {
if (!this._sortColumn)
return;
@ -1594,11 +1594,11 @@ var gApplicationsPane = {
/**
* Filter the list when the user enters a filter term into the filter field.
*/
filter: function() {
filter() {
this._rebuildView();
},
focusFilterBox: function() {
focusFilterBox() {
this._filter.focus();
this._filter.select();
},
@ -1606,7 +1606,7 @@ var gApplicationsPane = {
// Changes
onSelectAction: function(aActionItem) {
onSelectAction(aActionItem) {
this._storingAction = true;
try {
@ -1617,7 +1617,7 @@ var gApplicationsPane = {
}
},
_storeAction: function(aActionItem) {
_storeAction(aActionItem) {
var typeItem = this._list.selectedItem;
var handlerInfo = this._handledTypes[typeItem.type];
@ -1662,7 +1662,7 @@ var gApplicationsPane = {
}
},
manageApp: function(aEvent) {
manageApp(aEvent) {
// Don't let the normal "on select action" handler get this event,
// as we handle it specially ourselves.
aEvent.stopPropagation();
@ -1689,7 +1689,7 @@ var gApplicationsPane = {
},
chooseApp: function(aEvent) {
chooseApp(aEvent) {
// Don't let the normal "on select action" handler get this event,
// as we handle it specially ourselves.
aEvent.stopPropagation();
@ -1777,13 +1777,13 @@ var gApplicationsPane = {
// Mark which item in the list was last selected so we can reselect it
// when we rebuild the list or when the user returns to the prefpane.
onSelectionChanged: function() {
onSelectionChanged() {
if (this._list.selectedItem)
this._list.setAttribute("lastSelectedType",
this._list.selectedItem.getAttribute("type"));
},
_setIconClassForPreferredAction: function(aHandlerInfo, aElement) {
_setIconClassForPreferredAction(aHandlerInfo, aElement) {
// If this returns true, the attribute that CSS sniffs for was set to something
// so you shouldn't manually set an icon URI.
// This removes the existing actionIcon attribute if any, even if returning false.
@ -1817,7 +1817,7 @@ var gApplicationsPane = {
return false;
},
_getIconURLForPreferredAction: function(aHandlerInfo) {
_getIconURLForPreferredAction(aHandlerInfo) {
switch (aHandlerInfo.preferredAction) {
case Ci.nsIHandlerInfo.useSystemDefault:
return this._getIconURLForSystemDefault(aHandlerInfo);
@ -1835,7 +1835,7 @@ var gApplicationsPane = {
}
},
_getIconURLForHandlerApp: function(aHandlerApp) {
_getIconURLForHandlerApp(aHandlerApp) {
if (aHandlerApp instanceof Ci.nsILocalHandlerApp)
return this._getIconURLForFile(aHandlerApp.executable);
@ -1849,7 +1849,7 @@ var gApplicationsPane = {
return "";
},
_getIconURLForFile: function(aFile) {
_getIconURLForFile(aFile) {
var fph = this._ioSvc.getProtocolHandler("file").
QueryInterface(Ci.nsIFileProtocolHandler);
var urlSpec = fph.getURLSpecFromFile(aFile);
@ -1857,7 +1857,7 @@ var gApplicationsPane = {
return "moz-icon://" + urlSpec + "?size=16";
},
_getIconURLForWebApp: function(aWebAppURITemplate) {
_getIconURLForWebApp(aWebAppURITemplate) {
var uri = this._ioSvc.newURI(aWebAppURITemplate, null, null);
// Unfortunately we can't use the favicon service to get the favicon,
@ -1873,7 +1873,7 @@ var gApplicationsPane = {
return "";
},
_getIconURLForSystemDefault: function(aHandlerInfo) {
_getIconURLForSystemDefault(aHandlerInfo) {
// Handler info objects for MIME types on some OSes implement a property bag
// interface from which we can get an icon for the default app, so if we're
// dealing with a MIME type on one of those OSes, then try to get the icon.

View File

@ -16,7 +16,7 @@ XPCOMUtils.defineLazyGetter(this, "AlertsServiceDND", function() {
});
var gContentPane = {
init: function()
init()
{
function setEventListener(aId, aEventType, aCallback)
{
@ -99,7 +99,7 @@ var gContentPane = {
* Utility function to enable/disable the button specified by aButtonID based
* on the value of the Boolean preference specified by aPreferenceID.
*/
updateButtons: function(aButtonID, aPreferenceID)
updateButtons(aButtonID, aPreferenceID)
{
var button = document.getElementById(aButtonID);
var preference = document.getElementById(aPreferenceID);
@ -145,7 +145,7 @@ var gContentPane = {
* Displays the popup exceptions dialog where specific site popup preferences
* can be set.
*/
showPopupExceptions: function()
showPopupExceptions()
{
var bundlePreferences = document.getElementById("bundlePreferences");
var params = { blockVisible: false, sessionVisible: false, allowVisible: true,
@ -162,7 +162,7 @@ var gContentPane = {
/**
* Populates the default font list in UI.
*/
_rebuildFonts: function()
_rebuildFonts()
{
var preferences = document.getElementById("contentPreferences");
// Ensure preferences are "visible" to ensure bindings work.
@ -177,7 +177,7 @@ var gContentPane = {
/**
*
*/
_selectDefaultLanguageGroup: function(aLanguageGroup, aIsSerif)
_selectDefaultLanguageGroup(aLanguageGroup, aIsSerif)
{
const kFontNameFmtSerif = "font.name.serif.%LANG%";
const kFontNameFmtSansSerif = "font.name.sans-serif.%LANG%";
@ -228,7 +228,7 @@ var gContentPane = {
* Returns the type of the current default font for the language denoted by
* aLanguageGroup.
*/
_readDefaultFontTypeForLanguage: function(aLanguageGroup)
_readDefaultFontTypeForLanguage(aLanguageGroup)
{
const kDefaultFontType = "font.default.%LANG%";
var defaultFontTypePref = kDefaultFontType.replace(/%LANG%/, aLanguageGroup);
@ -248,7 +248,7 @@ var gContentPane = {
* Displays the fonts dialog, where web page font names and sizes can be
* configured.
*/
configureFonts: function()
configureFonts()
{
gSubDialog.open("chrome://browser/content/preferences/fonts.xul", "resizable=no");
},
@ -257,7 +257,7 @@ var gContentPane = {
* Displays the colors dialog, where default web page/link/etc. colors can be
* configured.
*/
configureColors: function()
configureColors()
{
gSubDialog.open("chrome://browser/content/preferences/colors.xul", "resizable=no");
},
@ -267,7 +267,7 @@ var gContentPane = {
/**
* Shows a dialog in which the preferred language for web content may be set.
*/
showLanguages: function()
showLanguages()
{
gSubDialog.open("chrome://browser/content/preferences/languages.xul");
},
@ -276,18 +276,18 @@ var gContentPane = {
* Displays the translation exceptions dialog where specific site and language
* translation preferences can be set.
*/
showTranslationExceptions: function()
showTranslationExceptions()
{
gSubDialog.open("chrome://browser/content/preferences/translation.xul");
},
openTranslationProviderAttribution: function()
openTranslationProviderAttribution()
{
Components.utils.import("resource:///modules/translation/Translation.jsm");
Translation.openProviderAttribution();
},
toggleDoNotDisturbNotifications: function(event)
toggleDoNotDisturbNotifications(event)
{
AlertsServiceDND.manualDoNotDisturb = event.target.checked;
},

View File

@ -20,7 +20,7 @@ var gMainPane = {
/**
* Initialization of this.
*/
init: function()
init()
{
function setEventListener(aId, aEventType, aCallback)
{
@ -121,7 +121,7 @@ var gMainPane = {
.notifyObservers(window, "main-pane-loaded", null);
},
enableE10SChange: function()
enableE10SChange()
{
if (AppConstants.E10S_TESTING_ONLY) {
let e10sCheckbox = document.getElementById("e10sAutoStart");
@ -155,7 +155,7 @@ var gMainPane = {
}
},
separateProfileModeChange: function()
separateProfileModeChange()
{
if (AppConstants.MOZ_DEV_EDITION) {
function quitApp() {
@ -206,7 +206,7 @@ var gMainPane = {
}
},
onGetStarted: function(aEvent) {
onGetStarted(aEvent) {
if (AppConstants.MOZ_DEV_EDITION) {
const Cc = Components.classes, Ci = Components.interfaces;
let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
@ -241,7 +241,7 @@ var gMainPane = {
* option is preserved.
*/
syncFromHomePref: function()
syncFromHomePref()
{
let homePref = document.getElementById("browser.startup.homepage");
@ -267,7 +267,7 @@ var gMainPane = {
return undefined;
},
syncToHomePref: function(value)
syncToHomePref(value)
{
// If the value is "", use about:home.
if (value == "")
@ -282,7 +282,7 @@ var gMainPane = {
* most recent browser window contains multiple tabs), updating preference
* window UI to reflect this.
*/
setHomePageToCurrent: function()
setHomePageToCurrent()
{
let homePage = document.getElementById("browser.startup.homepage");
let tabs = this._getTabsForHomePage();
@ -300,7 +300,7 @@ var gMainPane = {
* page. If the user selects a bookmark, that bookmark's name is displayed in
* UI and the bookmark's address is stored to the home page preference.
*/
setHomePageToBookmark: function()
setHomePageToBookmark()
{
var rv = { urls: null, names: null };
gSubDialog.open("chrome://browser/content/preferences/selectBookmark.xul",
@ -308,7 +308,7 @@ var gMainPane = {
this._setHomePageToBookmarkClosed.bind(this, rv));
},
_setHomePageToBookmarkClosed: function(rv, aEvent) {
_setHomePageToBookmarkClosed(rv, aEvent) {
if (aEvent.detail.button != "accept")
return;
if (rv.urls && rv.names) {
@ -323,7 +323,7 @@ var gMainPane = {
* Switches the "Use Current Page" button between its singular and plural
* forms.
*/
_updateUseCurrentButton: function() {
_updateUseCurrentButton() {
let useCurrent = document.getElementById("useCurrent");
@ -342,7 +342,7 @@ var gMainPane = {
useCurrent.disabled = !tabs.length
},
_getTabsForHomePage: function()
_getTabsForHomePage()
{
var win;
var tabs = [];
@ -366,7 +366,7 @@ var gMainPane = {
/**
* Check to see if a tab is not about:preferences
*/
isNotAboutPreferences: function(aElement, aIndex, aArray)
isNotAboutPreferences(aElement, aIndex, aArray)
{
return !aElement.linkedBrowser.currentURI.spec.startsWith("about:preferences");
},
@ -374,7 +374,7 @@ var gMainPane = {
/**
* Restores the default home page as the user's home page.
*/
restoreDefaultHomePage: function()
restoreDefaultHomePage()
{
var homePage = document.getElementById("browser.startup.homepage");
homePage.value = homePage.defaultValue;
@ -416,7 +416,7 @@ var gMainPane = {
* Enables/disables the folder field and Browse button based on whether a
* default download directory is being used.
*/
readUseDownloadDir: function()
readUseDownloadDir()
{
var downloadFolder = document.getElementById("downloadFolder");
var chooseFolder = document.getElementById("chooseFolder");
@ -529,7 +529,7 @@ var gMainPane = {
/**
* Returns the textual path of a folder in readable form.
*/
_getDisplayNameOfFile: function(aFolder)
_getDisplayNameOfFile(aFolder)
{
// TODO: would like to add support for 'Downloads on Macintosh HD'
// for OS X users.
@ -603,7 +603,7 @@ var gMainPane = {
* Hide/show the "Show my windows and tabs from last time" option based
* on the value of the browser.privatebrowsing.autostart pref.
*/
updateBrowserStartupLastSession: function()
updateBrowserStartupLastSession()
{
let pbAutoStartPref = document.getElementById("browser.privatebrowsing.autostart");
let startupPref = document.getElementById("browser.startup.page");
@ -650,7 +650,7 @@ var gMainPane = {
*
* @returns |true| if such links should be opened in new tabs
*/
readLinkTarget: function() {
readLinkTarget() {
var openNewWindow = document.getElementById("browser.link.open_newwindow");
return openNewWindow.value != 2;
},
@ -661,7 +661,7 @@ var gMainPane = {
* @returns 2 if such links should be opened in new windows,
* 3 if such links should be opened in new tabs
*/
writeLinkTarget: function() {
writeLinkTarget() {
var linkTargeting = document.getElementById("linkTargeting");
return linkTargeting.checked ? 3 : 2;
},
@ -677,7 +677,7 @@ var gMainPane = {
* Show button for setting browser as default browser or information that
* browser is already the default browser.
*/
updateSetDefaultBrowser: function()
updateSetDefaultBrowser()
{
if (AppConstants.HAVE_SHELL_SERVICE) {
let shellSvc = getShellService();
@ -698,7 +698,7 @@ var gMainPane = {
/**
* Set browser as the operating system default browser.
*/
setDefaultBrowser: function()
setDefaultBrowser()
{
if (AppConstants.HAVE_SHELL_SERVICE) {
let alwaysCheckPref = document.getElementById("browser.shell.checkDefaultBrowser");

View File

@ -42,7 +42,7 @@ function init_category_if_required(category) {
function register_module(categoryName, categoryObject) {
gCategoryInits.set(categoryName, {
inited: false,
init: function() {
init() {
categoryObject.init();
this.inited = true;
}

View File

@ -26,7 +26,7 @@ var gPrivacyPane = {
* Show the Tracking Protection UI depending on the
* privacy.trackingprotection.ui.enabled pref, and linkify its Learn More link
*/
_initTrackingProtection: function() {
_initTrackingProtection() {
if (!Services.prefs.getBoolPref("privacy.trackingprotection.ui.enabled")) {
return;
}
@ -45,7 +45,7 @@ var gPrivacyPane = {
* Linkify the Learn More link of the Private Browsing Mode Tracking
* Protection UI.
*/
_initTrackingProtectionPBM: function() {
_initTrackingProtectionPBM() {
let link = document.getElementById("trackingProtectionPBMLearnMore");
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "tracking-protection-pbm";
link.setAttribute("href", url);
@ -54,7 +54,7 @@ var gPrivacyPane = {
/**
* Initialize autocomplete to ensure prefs are in sync.
*/
_initAutocomplete: function() {
_initAutocomplete() {
Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
.getService(Components.interfaces.mozIPlacesAutoComplete);
},
@ -62,7 +62,7 @@ var gPrivacyPane = {
/**
* Show the Containers UI depending on the privacy.userContext.ui.enabled pref.
*/
_initBrowserContainers: function() {
_initBrowserContainers() {
if (!Services.prefs.getBoolPref("privacy.userContext.ui.enabled")) {
return;
}
@ -76,7 +76,7 @@ var gPrivacyPane = {
Services.prefs.getBoolPref("privacy.userContext.enabled");
},
_checkBrowserContainers: function(event) {
_checkBrowserContainers(event) {
let checkbox = document.getElementById("browserContainersCheckbox");
if (checkbox.checked) {
Services.prefs.setBoolPref("privacy.userContext.enabled", true);
@ -116,7 +116,7 @@ var gPrivacyPane = {
* Sets up the UI for the number of days of history to keep, and updates the
* label of the "Clear Now..." button.
*/
init: function()
init()
{
function setEventListener(aId, aEventType, aCallback)
{
@ -271,7 +271,7 @@ var gPrivacyPane = {
* @returns boolean true if all of the prefs are set to keep history,
* false otherwise
*/
_checkHistoryValues: function(aPrefs) {
_checkHistoryValues(aPrefs) {
for (let pref of Object.keys(aPrefs)) {
if (document.getElementById(pref).value != aPrefs[pref])
return false;
@ -282,7 +282,7 @@ var gPrivacyPane = {
/**
* Initialize the history mode menulist based on the privacy preferences
*/
initializeHistoryMode: function PPP_initializeHistoryMode()
initializeHistoryMode()
{
let mode;
let getVal = aPref => document.getElementById(aPref).value;
@ -304,7 +304,7 @@ var gPrivacyPane = {
/**
* Update the selected pane based on the history mode menulist
*/
updateHistoryModePane: function PPP_updateHistoryModePane()
updateHistoryModePane()
{
let selectedIndex = -1;
switch (document.getElementById("historyMode").value) {
@ -326,7 +326,7 @@ var gPrivacyPane = {
* Update the private browsing auto-start pref and the history mode
* micro-management prefs based on the history mode menulist
*/
updateHistoryModePrefs: function PPP_updateHistoryModePrefs()
updateHistoryModePrefs()
{
let pref = document.getElementById("browser.privatebrowsing.autostart");
switch (document.getElementById("historyMode").value) {
@ -361,7 +361,7 @@ var gPrivacyPane = {
* Update the privacy micro-management controls based on the
* value of the private browsing auto-start checkbox.
*/
updatePrivacyMicroControls: function PPP_updatePrivacyMicroControls()
updatePrivacyMicroControls()
{
if (document.getElementById("historyMode").value == "custom") {
let disabled = this._autoStartPrivateBrowsing =
@ -413,7 +413,7 @@ var gPrivacyPane = {
/**
* Initialize the starting state for the auto-start private browsing mode pref reverter.
*/
initAutoStartPrivateBrowsingReverter: function PPP_initAutoStartPrivateBrowsingReverter()
initAutoStartPrivateBrowsingReverter()
{
let mode = document.getElementById("historyMode");
let autoStart = document.getElementById("privateBrowsingAutoStart");
@ -423,7 +423,7 @@ var gPrivacyPane = {
_lastMode: null,
_lastCheckState: null,
updateAutostart: function PPP_updateAutostart() {
updateAutostart() {
let mode = document.getElementById("historyMode");
let autoStart = document.getElementById("privateBrowsingAutoStart");
let pref = document.getElementById("browser.privatebrowsing.autostart");
@ -490,7 +490,7 @@ var gPrivacyPane = {
/**
* Displays the available block lists for tracking protection.
*/
showBlockLists: function()
showBlockLists()
{
var bundlePreferences = document.getElementById("bundlePreferences");
let brandName = document.getElementById("bundleBrand")
@ -545,7 +545,7 @@ var gPrivacyPane = {
* enables/disables the rest of the cookie UI accordingly, returning true
* if cookies are enabled.
*/
readAcceptCookies: function()
readAcceptCookies()
{
var pref = document.getElementById("network.cookie.cookieBehavior");
var acceptThirdPartyLabel = document.getElementById("acceptThirdPartyLabel");
@ -566,7 +566,7 @@ var gPrivacyPane = {
* Enables/disables the "keep until" label and menulist in response to the
* "accept cookies" checkbox being checked or unchecked.
*/
writeAcceptCookies: function()
writeAcceptCookies()
{
var accept = document.getElementById("acceptCookies");
var acceptThirdPartyMenu = document.getElementById("acceptThirdPartyMenu");
@ -581,7 +581,7 @@ var gPrivacyPane = {
/**
* Converts between network.cookie.cookieBehavior and the third-party cookie UI
*/
readAcceptThirdPartyCookies: function()
readAcceptThirdPartyCookies()
{
var pref = document.getElementById("network.cookie.cookieBehavior");
switch (pref.value)
@ -599,7 +599,7 @@ var gPrivacyPane = {
}
},
writeAcceptThirdPartyCookies: function()
writeAcceptThirdPartyCookies()
{
var accept = document.getElementById("acceptThirdPartyMenu").selectedItem;
switch (accept.value)
@ -618,7 +618,7 @@ var gPrivacyPane = {
/**
* Displays fine-grained, per-site preferences for cookies.
*/
showCookieExceptions: function()
showCookieExceptions()
{
var bundlePreferences = document.getElementById("bundlePreferences");
var params = { blockVisible : true,
@ -635,7 +635,7 @@ var gPrivacyPane = {
/**
* Displays all the user's cookies in a dialog.
*/
showCookies: function(aCategory)
showCookies(aCategory)
{
gSubDialog.open("chrome://browser/content/preferences/cookies.xul");
},
@ -653,7 +653,7 @@ var gPrivacyPane = {
/**
* Displays the Clear Private Data settings dialog.
*/
showClearPrivateDataSettings: function()
showClearPrivateDataSettings()
{
gSubDialog.open("chrome://browser/content/preferences/sanitize.xul", "resizable=no");
},
@ -663,7 +663,7 @@ var gPrivacyPane = {
* Displays a dialog from which individual parts of private data may be
* cleared.
*/
clearPrivateDataNow: function(aClearEverything) {
clearPrivateDataNow(aClearEverything) {
var ts = document.getElementById("privacy.sanitize.timeSpan");
var timeSpanOrig = ts.value;
@ -685,7 +685,7 @@ var gPrivacyPane = {
* Enables or disables the "Settings..." button depending
* on the privacy.sanitize.sanitizeOnShutdown preference value
*/
_updateSanitizeSettingsButton: function() {
_updateSanitizeSettingsButton() {
var settingsButton = document.getElementById("clearDataSettings");
var sanitizeOnShutdownPref = document.getElementById("privacy.sanitize.sanitizeOnShutdown");
@ -704,7 +704,7 @@ var gPrivacyPane = {
/**
* Enables/disables the Settings button used to configure containers
*/
readBrowserContainersCheckbox: function()
readBrowserContainersCheckbox()
{
var pref = document.getElementById("privacy.userContext.enabled");
var settings = document.getElementById("browserContainersSettings");

View File

@ -17,12 +17,12 @@ var gSearchPane = {
/**
* Initialize autocomplete to ensure prefs are in sync.
*/
_initAutocomplete: function() {
_initAutocomplete() {
Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
.getService(Components.interfaces.mozIPlacesAutoComplete);
},
init: function()
init()
{
gEngineView = new EngineView(new EngineStore());
document.getElementById("engineList").view = gEngineView;
@ -75,7 +75,7 @@ var gSearchPane = {
permanentPBLabel.hidden = urlbarSuggests.hidden || !permanentPB;
},
buildDefaultEngineDropDown: function() {
buildDefaultEngineDropDown() {
// This is called each time something affects the list of engines.
let list = document.getElementById("defaultEngine");
// Set selection to the current default engine.
@ -100,7 +100,7 @@ var gSearchPane = {
});
},
handleEvent: function(aEvent) {
handleEvent(aEvent) {
switch (aEvent.type) {
case "click":
if (aEvent.target.id != "engineChildren" &&
@ -162,7 +162,7 @@ var gSearchPane = {
}
},
observe: function(aEngine, aTopic, aVerb) {
observe(aEngine, aTopic, aVerb) {
if (aTopic == "browser-search-engine-modified") {
aEngine.QueryInterface(Components.interfaces.nsISearchEngine);
switch (aVerb) {
@ -194,7 +194,7 @@ var gSearchPane = {
}
},
onInputBlur: function(aEvent) {
onInputBlur(aEvent) {
let tree = document.getElementById("engineList");
if (!tree.hasAttribute("editing"))
return;
@ -204,12 +204,12 @@ var gSearchPane = {
tree.stopEditing(accept);
},
onTreeSelect: function() {
onTreeSelect() {
document.getElementById("removeEngineButton").disabled =
!gEngineView.isEngineSelectedAndRemovable();
},
onTreeKeyPress: function(aEvent) {
onTreeKeyPress(aEvent) {
let index = gEngineView.selectedIndex;
let tree = document.getElementById("engineList");
if (tree.hasAttribute("editing"))
@ -238,17 +238,17 @@ var gSearchPane = {
}
},
onRestoreDefaults: function() {
onRestoreDefaults() {
let num = gEngineView._engineStore.restoreDefaultEngines();
gEngineView.rowCountChanged(0, num);
gEngineView.invalidate();
},
showRestoreDefaults: function(aEnable) {
showRestoreDefaults(aEnable) {
document.getElementById("restoreDefaultSearchEngines").disabled = !aEnable;
},
remove: function(aEngine) {
remove(aEngine) {
let index = gEngineView._engineStore.removeEngine(aEngine);
gEngineView.rowCountChanged(index, -1);
gEngineView.invalidate();
@ -294,7 +294,7 @@ var gSearchPane = {
return true;
}),
saveOneClickEnginesList: function() {
saveOneClickEnginesList() {
let hiddenList = [];
for (let engine of gEngineView._engineStore.engines) {
if (!engine.shown)
@ -304,7 +304,7 @@ var gSearchPane = {
hiddenList.join(",");
},
setDefaultEngine: function() {
setDefaultEngine() {
Services.search.currentEngine =
document.getElementById("defaultEngine").selectedItem.engine;
}
@ -345,15 +345,15 @@ EngineStore.prototype = {
return val;
},
_getIndexForEngine: function ES_getIndexForEngine(aEngine) {
_getIndexForEngine(aEngine) {
return this._engines.indexOf(aEngine);
},
_getEngineByName: function ES_getEngineByName(aName) {
_getEngineByName(aName) {
return this._engines.find(engine => engine.name == aName);
},
_cloneEngine: function ES_cloneEngine(aEngine) {
_cloneEngine(aEngine) {
var clonedObj = {};
for (var i in aEngine)
clonedObj[i] = aEngine[i];
@ -363,15 +363,15 @@ EngineStore.prototype = {
},
// Callback for Array's some(). A thisObj must be passed to some()
_isSameEngine: function ES_isSameEngine(aEngineClone) {
_isSameEngine(aEngineClone) {
return aEngineClone.originalEngine == this.originalEngine;
},
addEngine: function ES_addEngine(aEngine) {
addEngine(aEngine) {
this._engines.push(this._cloneEngine(aEngine));
},
moveEngine: function ES_moveEngine(aEngine, aNewIndex) {
moveEngine(aEngine, aNewIndex) {
if (aNewIndex < 0 || aNewIndex > this._engines.length - 1)
throw new Error("ES_moveEngine: invalid aNewIndex!");
var index = this._getIndexForEngine(aEngine);
@ -388,7 +388,7 @@ EngineStore.prototype = {
Services.search.moveEngine(aEngine.originalEngine, aNewIndex);
},
removeEngine: function ES_removeEngine(aEngine) {
removeEngine(aEngine) {
if (this._engines.length == 1) {
throw new Error("Cannot remove last engine!");
}
@ -407,7 +407,7 @@ EngineStore.prototype = {
return index;
},
restoreDefaultEngines: function ES_restoreDefaultEngines() {
restoreDefaultEngines() {
var added = 0;
for (var i = 0; i < this._defaultEngines.length; ++i) {
@ -436,7 +436,7 @@ EngineStore.prototype = {
return added;
},
changeEngine: function ES_changeEngine(aEngine, aProp, aNewValue) {
changeEngine(aEngine, aProp, aNewValue) {
var index = this._getIndexForEngine(aEngine);
if (index == -1)
throw new Error("invalid engine?");
@ -445,7 +445,7 @@ EngineStore.prototype = {
aEngine.originalEngine[aProp] = aNewValue;
},
reloadIcons: function ES_reloadIcons() {
reloadIcons() {
this._engines.forEach(function(e) {
e.uri = e.originalEngine.uri;
});
@ -476,27 +476,27 @@ EngineView.prototype = {
},
// Helpers
rowCountChanged: function(index, count) {
rowCountChanged(index, count) {
this.tree.rowCountChanged(index, count);
},
invalidate: function() {
invalidate() {
this.tree.invalidate();
},
ensureRowIsVisible: function(index) {
ensureRowIsVisible(index) {
this.tree.ensureRowIsVisible(index);
},
getSourceIndexFromDrag: function(dataTransfer) {
getSourceIndexFromDrag(dataTransfer) {
return parseInt(dataTransfer.getData(ENGINE_FLAVOR));
},
isCheckBox: function(index, column) {
isCheckBox(index, column) {
return column.id == "engineShown";
},
isEngineSelectedAndRemovable: function() {
isEngineSelectedAndRemovable() {
return this.selectedIndex != -1 && this.lastIndex != 0;
},
@ -505,7 +505,7 @@ EngineView.prototype = {
return this._engineStore.engines.length;
},
getImageSrc: function(index, column) {
getImageSrc(index, column) {
if (column.id == "engineName") {
if (this._engineStore.engines[index].iconURI)
return this._engineStore.engines[index].iconURI.spec;
@ -518,7 +518,7 @@ EngineView.prototype = {
return "";
},
getCellText: function(index, column) {
getCellText(index, column) {
if (column.id == "engineName")
return this._engineStore.engines[index].name;
else if (column.id == "engineKeyword")
@ -526,18 +526,18 @@ EngineView.prototype = {
return "";
},
setTree: function(tree) {
setTree(tree) {
this.tree = tree;
},
canDrop: function(targetIndex, orientation, dataTransfer) {
canDrop(targetIndex, orientation, dataTransfer) {
var sourceIndex = this.getSourceIndexFromDrag(dataTransfer);
return (sourceIndex != -1 &&
sourceIndex != targetIndex &&
sourceIndex != targetIndex + orientation);
},
drop: function(dropIndex, orientation, dataTransfer) {
drop(dropIndex, orientation, dataTransfer) {
var sourceIndex = this.getSourceIndexFromDrag(dataTransfer);
var sourceEngine = this._engineStore.engines[sourceIndex];
@ -559,37 +559,37 @@ EngineView.prototype = {
},
selection: null,
getRowProperties: function(index) { return ""; },
getCellProperties: function(index, column) { return ""; },
getColumnProperties: function(column) { return ""; },
isContainer: function(index) { return false; },
isContainerOpen: function(index) { return false; },
isContainerEmpty: function(index) { return false; },
isSeparator: function(index) { return false; },
isSorted: function(index) { return false; },
getParentIndex: function(index) { return -1; },
hasNextSibling: function(parentIndex, index) { return false; },
getLevel: function(index) { return 0; },
getProgressMode: function(index, column) { },
getCellValue: function(index, column) {
getRowProperties(index) { return ""; },
getCellProperties(index, column) { return ""; },
getColumnProperties(column) { return ""; },
isContainer(index) { return false; },
isContainerOpen(index) { return false; },
isContainerEmpty(index) { return false; },
isSeparator(index) { return false; },
isSorted(index) { return false; },
getParentIndex(index) { return -1; },
hasNextSibling(parentIndex, index) { return false; },
getLevel(index) { return 0; },
getProgressMode(index, column) { },
getCellValue(index, column) {
if (column.id == "engineShown")
return this._engineStore.engines[index].shown;
return undefined;
},
toggleOpenState: function(index) { },
cycleHeader: function(column) { },
selectionChanged: function() { },
cycleCell: function(row, column) { },
isEditable: function(index, column) { return column.id != "engineName"; },
isSelectable: function(index, column) { return false; },
setCellValue: function(index, column, value) {
toggleOpenState(index) { },
cycleHeader(column) { },
selectionChanged() { },
cycleCell(row, column) { },
isEditable(index, column) { return column.id != "engineName"; },
isSelectable(index, column) { return false; },
setCellValue(index, column, value) {
if (column.id == "engineShown") {
this._engineStore.engines[index].shown = value == "true";
gEngineView.invalidate();
gSearchPane.saveOneClickEnginesList();
}
},
setCellText: function(index, column, value) {
setCellText(index, column, value) {
if (column.id == "engineKeyword") {
gSearchPane.editKeyword(this._engineStore.engines[index], value)
.then(valid => {
@ -598,7 +598,7 @@ EngineView.prototype = {
});
}
},
performAction: function(action) { },
performActionOnRow: function(action, index) { },
performActionOnCell: function(action, index, column) { }
performAction(action) { },
performActionOnRow(action, index) { },
performActionOnCell(action, index, column) { }
};

View File

@ -13,7 +13,7 @@ var gSecurityPane = {
/**
* Initializes master password UI.
*/
init: function()
init()
{
function setEventListener(aId, aEventType, aCallback)
{
@ -52,7 +52,7 @@ var gSecurityPane = {
* Enables/disables the add-ons Exceptions button depending on whether
* or not add-on installation warnings are displayed.
*/
readWarnAddonInstall: function()
readWarnAddonInstall()
{
var warn = document.getElementById("xpinstall.whitelist.required");
var exceptions = document.getElementById("addonExceptions");
@ -66,7 +66,7 @@ var gSecurityPane = {
/**
* Displays the exceptions lists for add-on installation warnings.
*/
showAddonExceptions: function()
showAddonExceptions()
{
var bundlePrefs = document.getElementById("bundlePreferences");
@ -106,7 +106,7 @@ var gSecurityPane = {
* passwords are never saved. When browser is set to start in Private
* Browsing mode, the "Remember passwords" UI is useless, so we disable it.
*/
readSavePasswords: function()
readSavePasswords()
{
var pref = document.getElementById("signon.rememberSignons");
var excepts = document.getElementById("passwordExceptions");
@ -125,7 +125,7 @@ var gSecurityPane = {
* Displays a dialog in which the user can view and modify the list of sites
* where passwords are never saved.
*/
showPasswordExceptions: function()
showPasswordExceptions()
{
var bundlePrefs = document.getElementById("bundlePreferences");
var params = {
@ -149,7 +149,7 @@ var gSecurityPane = {
* The master password is controlled by various bits of NSS functionality, so
* the UI for it can't be controlled by the normal preference bindings.
*/
_initMasterPasswordUI: function()
_initMasterPasswordUI()
{
var noMP = !LoginHelper.isMasterPasswordSet();
@ -238,7 +238,7 @@ var gSecurityPane = {
* "use master password" checkbox, and prompts for master password removal if
* one is set.
*/
updateMasterPasswordButton: function()
updateMasterPasswordButton()
{
var checkbox = document.getElementById("useMasterPassword");
var button = document.getElementById("changeMasterPassword");
@ -262,7 +262,7 @@ var gSecurityPane = {
* the current master password. When the dialog is dismissed, master password
* UI is automatically updated.
*/
_removeMasterPassword: function()
_removeMasterPassword()
{
var secmodDB = Cc["@mozilla.org/security/pkcs11moduledb;1"].
getService(Ci.nsIPKCS11ModuleDB);
@ -284,7 +284,7 @@ var gSecurityPane = {
/**
* Displays a dialog in which the master password may be changed.
*/
changeMasterPassword: function()
changeMasterPassword()
{
gSubDialog.open("chrome://mozapps/content/preferences/changemp.xul",
"resizable=no", null, this._initMasterPasswordUI.bind(this));
@ -294,7 +294,7 @@ var gSecurityPane = {
* Shows the sites where the user has saved passwords and the associated login
* information.
*/
showPasswords: function()
showPasswords()
{
gSubDialog.open("chrome://passwordmgr/content/passwordManager.xul");
}

View File

@ -19,20 +19,20 @@ var gSubDialog = {
],
_resizeObserver: null,
init: function() {
init() {
this._frame = document.getElementById("dialogFrame");
this._overlay = document.getElementById("dialogOverlay");
this._box = document.getElementById("dialogBox");
this._closeButton = document.getElementById("dialogClose");
},
updateTitle: function(aEvent) {
updateTitle(aEvent) {
if (aEvent.target != gSubDialog._frame.contentDocument)
return;
document.getElementById("dialogTitle").textContent = gSubDialog._frame.contentDocument.title;
},
injectXMLStylesheet: function(aStylesheetURL) {
injectXMLStylesheet(aStylesheetURL) {
let contentStylesheet = this._frame.contentDocument.createProcessingInstruction(
'xml-stylesheet',
'href="' + aStylesheetURL + '" type="text/css"'
@ -41,7 +41,7 @@ var gSubDialog = {
this._frame.contentDocument.documentElement);
},
open: function(aURL, aFeatures = null, aParams = null, aClosingCallback = null) {
open(aURL, aFeatures = null, aParams = null, aClosingCallback = null) {
// If we're already open/opening on this URL, do nothing.
if (this._openedURL == aURL && !this._isClosing) {
return;
@ -76,7 +76,7 @@ var gSubDialog = {
featureParams.get("resizable") != "0");
},
close: function(aEvent = null) {
close(aEvent = null) {
if (this._isClosing) {
return;
}
@ -122,7 +122,7 @@ var gSubDialog = {
}, 0);
},
handleEvent: function(aEvent) {
handleEvent(aEvent) {
switch (aEvent.type) {
case "command":
this._frame.contentWindow.close();
@ -153,13 +153,13 @@ var gSubDialog = {
/* Private methods */
_onUnload: function(aEvent) {
_onUnload(aEvent) {
if (aEvent.target.location.href == this._openedURL) {
this._frame.contentWindow.close();
}
},
_onContentLoaded: function(aEvent) {
_onContentLoaded(aEvent) {
if (aEvent.target != this._frame || aEvent.target.contentWindow.location == "about:blank") {
return;
}
@ -209,7 +209,7 @@ var gSubDialog = {
this._overlay.style.opacity = "0.01";
},
_onLoad: function(aEvent) {
_onLoad(aEvent) {
if (aEvent.target.contentWindow.location == "about:blank") {
return;
}
@ -293,7 +293,7 @@ var gSubDialog = {
this._trapFocus();
},
_onResize: function(mutations) {
_onResize(mutations) {
let frame = gSubDialog._frame;
// The width and height styles are needed for the initial
// layout of the frame, but afterward they need to be removed
@ -319,12 +319,12 @@ var gSubDialog = {
}
},
_onDialogClosing: function(aEvent) {
_onDialogClosing(aEvent) {
this._frame.contentWindow.removeEventListener("dialogclosing", this);
this._closingEvent = aEvent;
},
_onKeyDown: function(aEvent) {
_onKeyDown(aEvent) {
if (aEvent.currentTarget == window && aEvent.keyCode == aEvent.DOM_VK_ESCAPE &&
!aEvent.defaultPrevented) {
this.close(aEvent);
@ -362,7 +362,7 @@ var gSubDialog = {
}
},
_onParentWinFocus: function(aEvent) {
_onParentWinFocus(aEvent) {
// Explicitly check for the focus target of |window| to avoid triggering this when the window
// is refocused
if (aEvent.target != this._closeButton && aEvent.target != window) {
@ -370,7 +370,7 @@ var gSubDialog = {
}
},
_addDialogEventListeners: function() {
_addDialogEventListeners() {
// Make the close button work.
this._closeButton.addEventListener("command", this);
@ -392,7 +392,7 @@ var gSubDialog = {
window.addEventListener("keydown", this, true);
},
_removeDialogEventListeners: function() {
_removeDialogEventListeners() {
let chromeBrowser = this._getBrowser();
chromeBrowser.removeEventListener("DOMTitleChanged", this, true);
chromeBrowser.removeEventListener("unload", this, true);
@ -410,7 +410,7 @@ var gSubDialog = {
this._untrapFocus();
},
_trapFocus: function() {
_trapFocus() {
let fm = Services.focus;
fm.moveFocus(this._frame.contentWindow, null, fm.MOVEFOCUS_FIRST, 0);
this._frame.contentDocument.addEventListener("keydown", this, true);
@ -419,13 +419,13 @@ var gSubDialog = {
window.addEventListener("focus", this, true);
},
_untrapFocus: function() {
_untrapFocus() {
this._frame.contentDocument.removeEventListener("keydown", this, true);
this._closeButton.removeEventListener("keydown", this);
window.removeEventListener("focus", this);
},
_getBrowser: function() {
_getBrowser() {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)

View File

@ -42,14 +42,14 @@ var gSyncPane = {
return Weave.Svc.Prefs.isSet("serverURL");
},
needsUpdate: function() {
needsUpdate() {
this.page = PAGE_NEEDS_UPDATE;
let label = document.getElementById("loginError");
label.textContent = Weave.Utils.getErrorString(Weave.Status.login);
label.className = "error";
},
init: function() {
init() {
this._setupEventListeners();
// If the Service hasn't finished initializing, wait for it.
@ -85,7 +85,7 @@ var gSyncPane = {
xps.ensureLoaded();
},
_showLoadPage: function(xps) {
_showLoadPage(xps) {
let username;
try {
username = Services.prefs.getCharPref("services.sync.username");
@ -109,7 +109,7 @@ var gSyncPane = {
}
},
_init: function() {
_init() {
let topics = ["weave:service:login:error",
"weave:service:login:finish",
"weave:service:start-over:finish",
@ -161,7 +161,7 @@ var gSyncPane = {
this._initProfileImageUI();
},
_toggleComputerNameControls: function(editMode) {
_toggleComputerNameControls(editMode) {
let textbox = document.getElementById("fxaSyncComputerName");
textbox.disabled = !editMode;
document.getElementById("fxaChangeDeviceName").hidden = editMode;
@ -169,25 +169,25 @@ var gSyncPane = {
document.getElementById("fxaSaveChangeDeviceName").hidden = !editMode;
},
_focusComputerNameTextbox: function() {
_focusComputerNameTextbox() {
let textbox = document.getElementById("fxaSyncComputerName");
let valLength = textbox.value.length;
textbox.focus();
textbox.setSelectionRange(valLength, valLength);
},
_blurComputerNameTextbox: function() {
_blurComputerNameTextbox() {
document.getElementById("fxaSyncComputerName").blur();
},
_focusAfterComputerNameTextbox: function() {
_focusAfterComputerNameTextbox() {
// Focus the most appropriate element that's *not* the "computer name" box.
Services.focus.moveFocus(window,
document.getElementById("fxaSyncComputerName"),
Services.focus.MOVEFOCUS_FORWARD, 0);
},
_updateComputerNameValue: function(save) {
_updateComputerNameValue(save) {
if (save) {
let textbox = document.getElementById("fxaSyncComputerName");
Weave.Service.clientsEngine.localName = textbox.value;
@ -195,7 +195,7 @@ var gSyncPane = {
this._populateComputerName(Weave.Service.clientsEngine.localName);
},
_setupEventListeners: function() {
_setupEventListeners() {
function setEventListener(aId, aEventType, aCallback)
{
document.getElementById(aId)
@ -294,7 +294,7 @@ var gSyncPane = {
});
},
_initProfileImageUI: function() {
_initProfileImageUI() {
try {
if (Services.prefs.getBoolPref("identity.fxaccounts.profile_image.enabled")) {
document.getElementById("fxaProfileImage").hidden = false;
@ -302,7 +302,7 @@ var gSyncPane = {
} catch (e) { }
},
updateWeavePrefs: function() {
updateWeavePrefs() {
let service = Components.classes["@mozilla.org/weave/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;
@ -427,7 +427,7 @@ var gSyncPane = {
}
},
startOver: function(showDialog) {
startOver(showDialog) {
if (showDialog) {
let flags = Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING +
Services.prompt.BUTTON_POS_1 * Services.prompt.BUTTON_TITLE_CANCEL +
@ -449,26 +449,26 @@ var gSyncPane = {
this.updateWeavePrefs();
},
updatePass: function() {
updatePass() {
if (Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED)
gSyncUtils.changePassword();
else
gSyncUtils.updatePassphrase();
},
resetPass: function() {
resetPass() {
if (Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED)
gSyncUtils.resetPassword();
else
gSyncUtils.resetPassphrase();
},
_getEntryPoint: function() {
_getEntryPoint() {
let params = new URLSearchParams(document.URL.split("#")[0].split("?")[1] || "");
return params.get("entrypoint") || "preferences";
},
_openAboutAccounts: function(action) {
_openAboutAccounts(action) {
let entryPoint = this._getEntryPoint();
let params = new URLSearchParams();
if (action) {
@ -488,7 +488,7 @@ var gSyncPane = {
* "pair" -- pair a device first
* "reset" -- reset sync
*/
openSetup: function(wizardType) {
openSetup(wizardType) {
let service = Components.classes["@mozilla.org/weave/service;1"]
.getService(Components.interfaces.nsISupports)
.wrappedJSObject;
@ -507,7 +507,7 @@ var gSyncPane = {
}
},
openContentInBrowser: function(url, options) {
openContentInBrowser(url, options) {
let win = Services.wm.getMostRecentWindow("navigator:browser");
if (!win) {
// no window to use, so use _openLink to create a new one. We don't
@ -530,20 +530,20 @@ var gSyncPane = {
browser.loadURI(url);
},
signUp: function() {
signUp() {
this._openAboutAccounts("signup");
},
signIn: function() {
signIn() {
this._openAboutAccounts("signin");
},
reSignIn: function() {
reSignIn() {
this._openAboutAccounts("reauth");
},
clickOrSpaceOrEnterPressed: function(event) {
clickOrSpaceOrEnterPressed(event) {
// Note: charCode is deprecated, but 'char' not yet implemented.
// Replace charCode with char when implemented, see Bug 680830
return ((event.type == "click" && event.button == 0) ||
@ -551,7 +551,7 @@ var gSyncPane = {
(event.charCode == KeyEvent.DOM_VK_SPACE || event.keyCode == KeyEvent.DOM_VK_RETURN)));
},
openChangeProfileImage: function(event) {
openChangeProfileImage(event) {
if (this.clickOrSpaceOrEnterPressed(event)) {
fxAccounts.promiseAccountsChangeProfileURI(this._getEntryPoint(), "avatar")
.then(url => {
@ -564,7 +564,7 @@ var gSyncPane = {
}
},
openManageFirefoxAccount: function(event) {
openManageFirefoxAccount(event) {
if (this.clickOrSpaceOrEnterPressed(event)) {
this.manageFirefoxAccount();
// Prevent page from scrolling on the space key.
@ -572,7 +572,7 @@ var gSyncPane = {
}
},
manageFirefoxAccount: function() {
manageFirefoxAccount() {
fxAccounts.promiseAccountsManageURI(this._getEntryPoint())
.then(url => {
this.openContentInBrowser(url, {
@ -581,7 +581,7 @@ var gSyncPane = {
});
},
verifyFirefoxAccount: function() {
verifyFirefoxAccount() {
let showVerifyNotification = (data) => {
let isError = !data;
let maybeNot = isError ? "Not" : "";
@ -609,12 +609,12 @@ var gSyncPane = {
.then(onSuccess, onError);
},
openOldSyncSupportPage: function() {
openOldSyncSupportPage() {
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "old-sync";
this.openContentInBrowser(url);
},
unlinkFirefoxAccount: function(confirm) {
unlinkFirefoxAccount(confirm) {
if (confirm) {
// We use a string bundle shared with aboutAccounts.
let sb = Services.strings.createBundle("chrome://browser/locale/syncSetup.properties");
@ -646,7 +646,7 @@ var gSyncPane = {
});
},
openAddDevice: function() {
openAddDevice() {
if (!Weave.Utils.ensureMPUnlocked())
return;
@ -658,7 +658,7 @@ var gSyncPane = {
"syncAddDevice", "centerscreen,chrome,resizable=no");
},
resetSync: function() {
resetSync() {
this.openSetup("reset");
},