Bug 1294989 - Enable eslint for browser/components/preferences. r=Gijs

MozReview-Commit-ID: 62ymdZhluHx

--HG--
extra : rebase_source : 330d512f91d840a47e48f39c21d70d13b2953d2d
This commit is contained in:
Jared Wein 2016-08-13 21:58:42 -04:00
Родитель 797f4c4fe4
Коммит 8d45b8762e
29 изменённых файлов: 872 добавлений и 860 удалений

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

@ -64,7 +64,6 @@ browser/base/content/test/**
browser/base/content/newtab/**
browser/components/downloads/**
browser/components/feeds/**
browser/components/preferences/**
browser/components/privatebrowsing/**
browser/components/sessionstore/**
browser/components/shell/**

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

@ -182,7 +182,7 @@ var gConnectionsDialog = {
.getService(Components.interfaces.nsIURIFixup);
try {
autoURLPref.value = autoURL.value = URIFixup.createFixupURI(autoURL.value, 0).spec;
} catch(ex) {}
} catch (ex) {}
},
sanitizeNoProxiesPref: function()

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

@ -61,9 +61,8 @@ var gCookiesWindow = {
window.arguments[0].filterString)
this.setFilter(window.arguments[0].filterString);
}
else {
if (document.getElementById("filter").value != "")
this.filter();
else if (document.getElementById("filter").value != "") {
this.filter();
}
this._updateRemoveAllButton();
@ -245,9 +244,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 (var j = 0; j < currHost.cookies.length; ++j) {
if (count == aIndex) {
var cookie = currHost.cookies[i];
var cookie = currHost.cookies[j];
cookie.parentIndex = hostIndex;
return cookie;
}
@ -265,22 +264,22 @@ var gCookiesWindow = {
else
++count;
for (var j = cacheStart; j < count; j++)
this._cacheItems[j] = cacheEntry;
for (var k = cacheStart; k < count; k++)
this._cacheItems[k] = cacheEntry;
this._cacheValid = count - 1;
}
return null;
},
_removeItemAtIndex: function (aIndex, aCount) {
var removeCount = aCount === undefined ? 1 : aCount;
let removeCount = aCount === undefined ? 1 : aCount;
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 (var j = 0; j < parent.cookies.length; ++j) {
for (let i = aIndex; i < aIndex + removeCount; ++i) {
let item = this._filterSet[i];
let parent = gCookiesWindow._hosts[item.rawHost];
for (let j = 0; j < parent.cookies.length; ++j) {
if (item == parent.cookies[j]) {
parent.cookies.splice(j, 1);
break;
@ -291,15 +290,15 @@ 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) {
var cookie = parent.cookies[i];
let parent = this._getItemAtIndex(item.parentIndex);
for (let i = 0; i < parent.cookies.length; ++i) {
let cookie = parent.cookies[i];
if (item.rawHost == cookie.rawHost &&
item.name == cookie.name &&
item.path == cookie.path &&
@ -325,11 +324,10 @@ var gCookiesWindow = {
else if (aColumn.id == "nameCol")
return item.name;
}
else {
if (aColumn.id == "domainCol")
return this._filterSet[aIndex].rawHost;
else if (aColumn.id == "nameCol")
return this._filterSet[aIndex].name;
else if (aColumn.id == "domainCol") {
return this._filterSet[aIndex].rawHost;
} else if (aColumn.id == "nameCol") {
return this._filterSet[aIndex].name;
}
return "";
},
@ -398,11 +396,9 @@ var gCookiesWindow = {
}
return false;
}
else {
var parent = this._getItemAtIndex(item.parentIndex);
if (parent && parent.container)
return aIndex < item.parentIndex + parent.cookies.length;
}
var parent = this._getItemAtIndex(item.parentIndex);
if (parent && parent.container)
return aIndex < item.parentIndex + parent.cookies.length;
}
}
return aIndex < this.rowCount - 1;
@ -761,12 +757,12 @@ var gCookiesWindow = {
},
onCookieKeyPress: function (aEvent) {
if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE
#ifdef XP_MACOSX
|| aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE
#endif
)
if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE) {
this.deleteCookie();
} else if (AppConstants.platform == "macosx" &&
aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE) {
this.deleteCookie();
}
},
_lastSortProperty : "",

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

@ -77,11 +77,6 @@ var gFontsDialog = {
onBeforeAccept: function ()
{
// Only care in in-content prefs
if (!window.frameElement) {
return true;
}
let preferences = document.querySelectorAll("preference[id*='font.minimum-size']");
// It would be good if we could avoid touching languages the pref pages won't use, but
// unfortunately the language group APIs (deducing language groups from language codes)
@ -91,7 +86,7 @@ var gFontsDialog = {
return prefEl.value > 24 && prefEl.value != prefEl.valueFromPreferences;
});
if (!preferences.length) {
return;
return true;
}
let strings = document.getElementById("bundlePreferences");

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

@ -30,23 +30,23 @@ var gAdvancedPane = {
if (preference.value !== null)
advancedPrefs.selectedIndex = preference.value;
#ifdef MOZ_UPDATER
let onUnload = function () {
window.removeEventListener("unload", onUnload, false);
Services.prefs.removeObserver("app.update.", this);
}.bind(this);
window.addEventListener("unload", onUnload, false);
Services.prefs.addObserver("app.update.", this, false);
this.updateReadPrefs();
#endif
if (AppConstants.MOZ_UPDATER) {
let onUnload = function () {
window.removeEventListener("unload", onUnload, false);
Services.prefs.removeObserver("app.update.", this);
}.bind(this);
window.addEventListener("unload", onUnload, false);
Services.prefs.addObserver("app.update.", this, false);
this.updateReadPrefs();
}
this.updateOfflineApps();
#ifdef MOZ_CRASHREPORTER
this.initSubmitCrashes();
#endif
if (AppConstants.MOZ_CRASHREPORTER) {
this.initSubmitCrashes();
}
this.initTelemetry();
#ifdef MOZ_TELEMETRY_REPORTING
this.initSubmitHealthReport();
#endif
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this.initSubmitHealthReport();
}
this.updateOnScreenKeyboardVisibility();
this.updateCacheSizeInputField();
this.updateActualCacheSize();
@ -56,14 +56,14 @@ var gAdvancedPane = {
gAdvancedPane.updateHardwareAcceleration);
setEventListener("advancedPrefs", "select",
gAdvancedPane.tabSelectionChanged);
#ifdef MOZ_TELEMETRY_REPORTING
setEventListener("submitHealthReportBox", "command",
gAdvancedPane.updateSubmitHealthReport);
#endif
#ifdef MOZ_CRASHREPORTER
setEventListener("submitCrashesBox", "command",
gAdvancedPane.updateSubmitCrashes);
#endif
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
setEventListener("submitHealthReportBox", "command",
gAdvancedPane.updateSubmitHealthReport);
}
if (AppConstants.MOZ_CRASHREPORTER) {
setEventListener("submitCrashesBox", "command",
gAdvancedPane.updateSubmitCrashes);
}
setEventListener("connectionSettings", "command",
gAdvancedPane.showConnections);
setEventListener("clearCacheButton", "command",
@ -79,12 +79,12 @@ var gAdvancedPane = {
.style.height = bundlePrefs.getString("offlineAppsList.height");
setEventListener("offlineAppsListRemove", "command",
gAdvancedPane.removeOfflineApp);
#ifdef MOZ_UPDATER
setEventListener("updateRadioGroup", "command",
gAdvancedPane.updateWritePrefs);
setEventListener("showUpdateHistory", "command",
gAdvancedPane.showUpdates);
#endif
if (AppConstants.MOZ_UPDATER) {
setEventListener("updateRadioGroup", "command",
gAdvancedPane.updateWritePrefs);
setEventListener("showUpdateHistory", "command",
gAdvancedPane.showUpdates);
}
setEventListener("viewCertificatesButton", "command",
gAdvancedPane.showCertificates);
setEventListener("viewSecurityDevicesButton", "command",
@ -92,14 +92,14 @@ var gAdvancedPane = {
setEventListener("cacheSize", "change",
gAdvancedPane.updateCacheSizePref);
#ifdef MOZ_WIDGET_GTK
// GTK tabbox' allow the scroll wheel to change the selected tab,
// but we don't want this behavior for the in-content preferences.
let tabsElement = document.getElementById("tabsElement");
tabsElement.addEventListener("DOMMouseScroll", event => {
event.stopPropagation();
}, true);
#endif
if (AppConstants.MOZ_WIDGET_GTK) {
// GTK tabbox' allow the scroll wheel to change the selected tab,
// but we don't want this behavior for the in-content preferences.
let tabsElement = document.getElementById("tabsElement");
tabsElement.addEventListener("DOMMouseScroll", event => {
event.stopPropagation();
}, true);
}
},
/**
@ -174,7 +174,13 @@ var gAdvancedPane = {
writeCheckSpelling: function ()
{
var checkbox = document.getElementById("checkSpelling");
return checkbox.checked ? (this._storedSpellCheck == 2 ? 2 : 1) : 0;
if (checkbox.checked) {
if (this._storedSpellCheck == 2) {
return 2;
}
return 1;
}
return 0;
},
/**
@ -206,11 +212,11 @@ var gAdvancedPane = {
*/
updateHardwareAcceleration: function()
{
#ifdef XP_WIN
var fromPref = document.getElementById("layers.acceleration.disabled");
var toPref = document.getElementById("gfx.direct2d.disabled");
toPref.value = fromPref.value;
#endif
if (AppConstants.platform = "win") {
var fromPref = document.getElementById("layers.acceleration.disabled");
var toPref = document.getElementById("gfx.direct2d.disabled");
toPref.value = fromPref.value;
}
},
// DATA CHOICES TAB
@ -268,9 +274,9 @@ var gAdvancedPane = {
*/
initTelemetry: function ()
{
#ifdef MOZ_TELEMETRY_REPORTING
this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
#endif
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
}
},
/**
@ -279,45 +285,47 @@ var gAdvancedPane = {
*/
setTelemetrySectionEnabled: function (aEnabled)
{
#ifdef MOZ_TELEMETRY_REPORTING
// If FHR is disabled, additional data sharing should be disabled as well.
let disabled = !aEnabled;
document.getElementById("submitTelemetryBox").disabled = disabled;
if (disabled) {
// If we disable FHR, untick the telemetry checkbox.
Services.prefs.setBoolPref("toolkit.telemetry.enabled", false);
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
// If FHR is disabled, additional data sharing should be disabled as well.
let disabled = !aEnabled;
document.getElementById("submitTelemetryBox").disabled = disabled;
if (disabled) {
// If we disable FHR, untick the telemetry checkbox.
Services.prefs.setBoolPref("toolkit.telemetry.enabled", false);
}
document.getElementById("telemetryDataDesc").disabled = disabled;
}
document.getElementById("telemetryDataDesc").disabled = disabled;
#endif
},
#ifdef MOZ_TELEMETRY_REPORTING
/**
* Initialize the health report service reference and checkbox.
*/
initSubmitHealthReport: function () {
this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
let checkbox = document.getElementById("submitHealthReportBox");
let checkbox = document.getElementById("submitHealthReportBox");
if (Services.prefs.prefIsLocked(PREF_UPLOAD_ENABLED)) {
checkbox.setAttribute("disabled", "true");
return;
if (Services.prefs.prefIsLocked(PREF_UPLOAD_ENABLED)) {
checkbox.setAttribute("disabled", "true");
return;
}
checkbox.checked = Services.prefs.getBoolPref(PREF_UPLOAD_ENABLED);
this.setTelemetrySectionEnabled(checkbox.checked);
}
checkbox.checked = Services.prefs.getBoolPref(PREF_UPLOAD_ENABLED);
this.setTelemetrySectionEnabled(checkbox.checked);
},
/**
* Update the health report preference with state from checkbox.
*/
updateSubmitHealthReport: function () {
let checkbox = document.getElementById("submitHealthReportBox");
Services.prefs.setBoolPref(PREF_UPLOAD_ENABLED, checkbox.checked);
this.setTelemetrySectionEnabled(checkbox.checked);
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
let checkbox = document.getElementById("submitHealthReportBox");
Services.prefs.setBoolPref(PREF_UPLOAD_ENABLED, checkbox.checked);
this.setTelemetrySectionEnabled(checkbox.checked);
}
},
#endif
updateOnScreenKeyboardVisibility() {
if (AppConstants.platform == "win") {
@ -463,7 +471,7 @@ var gAdvancedPane = {
var cache = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
cache.clear();
} catch(ex) {}
} catch (ex) {}
this.updateActualCacheSize();
},
@ -649,7 +657,6 @@ var gAdvancedPane = {
* - true if updates to search engines are enabled, false otherwise
*/
#ifdef MOZ_UPDATER
/**
* Selects the item of the radiogroup based on the pref values and locked
* states.
@ -669,43 +676,45 @@ var gAdvancedPane = {
*/
updateReadPrefs: function ()
{
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
if (AppConstants.MOZ_UPDATER) {
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
if (!enabledPref.value) // Don't care for autoPref.value in this case.
radiogroup.value="manual"; // 3. Never check for updates.
else if (autoPref.value) // enabledPref.value && autoPref.value
radiogroup.value="auto"; // 1. Automatically install updates
else // enabledPref.value && !autoPref.value
radiogroup.value="checkOnly"; // 2. Check, but let me choose
if (!enabledPref.value) // Don't care for autoPref.value in this case.
radiogroup.value="manual"; // 3. Never check for updates.
else if (autoPref.value) // enabledPref.value && autoPref.value
radiogroup.value="auto"; // 1. Automatically install updates
else // enabledPref.value && !autoPref.value
radiogroup.value="checkOnly"; // 2. Check, but let me choose
var canCheck = Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService).
canCheckForUpdates;
// canCheck is false if the enabledPref is false and locked,
// or the binary platform or OS version is not known.
// A locked pref is sufficient to disable the radiogroup.
radiogroup.disabled = !canCheck || enabledPref.locked || autoPref.locked;
var canCheck = Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService).
canCheckForUpdates;
// canCheck is false if the enabledPref is false and locked,
// or the binary platform or OS version is not known.
// A locked pref is sufficient to disable the radiogroup.
radiogroup.disabled = !canCheck || enabledPref.locked || autoPref.locked;
#ifdef MOZ_MAINTENANCE_SERVICE
// Check to see if the maintenance service is installed.
// If it is don't show the preference at all.
var installed;
try {
var wrk = Components.classes["@mozilla.org/windows-registry-key;1"]
.createInstance(Components.interfaces.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 (AppConstants.MOZ_MAINTENANCE_SERVICE) {
// Check to see if the maintenance service is installed.
// If it is don't show the preference at all.
var installed;
try {
var wrk = Components.classes["@mozilla.org/windows-registry-key;1"]
.createInstance(Components.interfaces.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;
}
}
}
if (installed != 1) {
document.getElementById("useService").hidden = true;
}
#endif
},
/**
@ -713,21 +722,23 @@ var gAdvancedPane = {
*/
updateWritePrefs: function ()
{
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
switch (radiogroup.value) {
case "auto": // 1. Automatically install updates for Desktop only
enabledPref.value = true;
autoPref.value = true;
break;
case "checkOnly": // 2. Check, but let me choose
enabledPref.value = true;
autoPref.value = false;
break;
case "manual": // 3. Never check for updates.
enabledPref.value = false;
autoPref.value = false;
if (AppConstants.MOZ_UPDATER) {
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
switch (radiogroup.value) {
case "auto": // 1. Automatically install updates for Desktop only
enabledPref.value = true;
autoPref.value = true;
break;
case "checkOnly": // 2. Check, but let me choose
enabledPref.value = true;
autoPref.value = false;
break;
case "manual": // 3. Never check for updates.
enabledPref.value = false;
autoPref.value = false;
}
}
},
@ -736,11 +747,12 @@ var gAdvancedPane = {
*/
showUpdates: function ()
{
var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
.createInstance(Components.interfaces.nsIUpdatePrompt);
prompter.showUpdateHistory(window);
if (AppConstants.MOZ_UPDATER) {
var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
.createInstance(Components.interfaces.nsIUpdatePrompt);
prompter.showUpdateHistory(window);
}
},
#endif
// ENCRYPTION TAB
@ -776,13 +788,13 @@ var gAdvancedPane = {
"modal=yes", null);
},
#ifdef MOZ_UPDATER
observe: function (aSubject, aTopic, aData) {
switch(aTopic) {
case "nsPref:changed":
this.updateReadPrefs();
break;
if (AppConstants.MOZ_UPDATER) {
switch (aTopic) {
case "nsPref:changed":
this.updateReadPrefs();
break;
}
}
},
#endif
};

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

@ -80,20 +80,20 @@ const APP_ICON_ATTR_NAME = "appHandlerIcon";
// Utilities
function getFileDisplayName(file) {
#ifdef XP_WIN
if (file instanceof Ci.nsILocalFileWin) {
try {
return file.getVersionInfoField("FileDescription");
} catch (e) {}
if (AppConstants.platform == "win") {
if (file instanceof Ci.nsILocalFileWin) {
try {
return file.getVersionInfoField("FileDescription");
} catch (e) {}
}
}
#endif
#ifdef XP_MACOSX
if (file instanceof Ci.nsILocalFileMac) {
try {
return file.bundleDisplayName;
} catch (e) {}
if (AppConstants.platform == "macosx") {
if (file instanceof Ci.nsILocalFileMac) {
try {
return file.bundleDisplayName;
} catch (e) {}
}
}
#endif
return file.leafName;
}
@ -271,8 +271,7 @@ HandlerInfoWrapper.prototype = {
!gApplicationsPane.isValidHandlerApp(this.preferredApplicationHandler)) {
if (this.wrappedHandlerInfo.hasDefaultHandler)
return Ci.nsIHandlerInfo.useSystemDefault;
else
return Ci.nsIHandlerInfo.saveToDisk;
return Ci.nsIHandlerInfo.saveToDisk;
}
return this.wrappedHandlerInfo.preferredAction;
@ -336,7 +335,7 @@ HandlerInfoWrapper.prototype = {
if (this.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo &&
this.wrappedHandlerInfo.primaryExtension)
return this.wrappedHandlerInfo.primaryExtension
} catch(ex) {}
} catch (ex) {}
return null;
},
@ -479,13 +478,7 @@ FeedHandlerInfo.prototype = {
Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"].
getService(Ci.nsIWebContentConverterService),
_shellSvc:
#ifdef HAVE_SHELL_SERVICE
getShellService(),
#else
null,
#endif
_shellSvc: AppConstants.HAVE_SHELL_SERVICE ? getShellService() : null,
//**************************************************************************//
// nsIHandlerInfo
@ -607,14 +600,14 @@ FeedHandlerInfo.prototype = {
return this.__defaultApplicationHandler;
var defaultFeedReader = null;
#ifdef HAVE_SHELL_SERVICE
try {
defaultFeedReader = this._shellSvc.defaultFeedReader;
if (AppConstants.HAVE_SHELL_SERVICE) {
try {
defaultFeedReader = this._shellSvc.defaultFeedReader;
}
catch (ex) {
// no default reader or _shellSvc is null
}
}
catch(ex) {
// no default reader or _shellSvc is null
}
#endif
if (defaultFeedReader) {
let handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
@ -633,15 +626,15 @@ FeedHandlerInfo.prototype = {
},
get hasDefaultHandler() {
#ifdef HAVE_SHELL_SERVICE
try {
if (this._shellSvc.defaultFeedReader)
return true;
if (AppConstants.HAVE_SHELL_SERVICE) {
try {
if (this._shellSvc.defaultFeedReader)
return true;
}
catch (ex) {
// no default reader or _shellSvc is null
}
}
catch(ex) {
// no default reader or _shellSvc is null
}
#endif
return false;
},
@ -1256,8 +1249,7 @@ var gApplicationsPane = {
if (isFeedType(aHandlerInfo.type))
return this._prefsBundle.getFormattedString("previewInApp",
[this._brandShortName]);
else
return this._prefsBundle.getString("alwaysAsk");
return this._prefsBundle.getString("alwaysAsk");
}
switch (aHandlerInfo.preferredAction) {
@ -1306,6 +1298,8 @@ var gApplicationsPane = {
return this._prefsBundle.getFormattedString("usePluginIn",
[aHandlerInfo.pluginName,
this._brandShortName]);
default:
throw new Error(`Unexpected preferredAction: ${aHandlerInfo.preferredAction}`);
}
},
@ -1352,21 +1346,21 @@ var gApplicationsPane = {
},
_isValidHandlerExecutable: function(aExecutable) {
let leafName;
if (AppConstants.platform == "win") {
leafName = `${AppConstants.MOZ_APP_NAME}.exe`;
} else if (AppConstants.platform == "macosx") {
leafName = AppConstants.MOZ_MACBUNDLE_NAME;
} else {
leafName = `${AppConstants.MOZ_APP_NAME}-bin`;
}
return aExecutable &&
aExecutable.exists() &&
aExecutable.isExecutable() &&
// XXXben - we need to compare this with the running instance executable
// just don't know how to do that via script...
// XXXmano TBD: can probably add this to nsIShellService
#ifdef XP_WIN
#expand aExecutable.leafName != "__MOZ_APP_NAME__.exe";
#else
#ifdef XP_MACOSX
#expand aExecutable.leafName != "__MOZ_MACBUNDLE_NAME__";
#else
#expand aExecutable.leafName != "__MOZ_APP_NAME__-bin";
#endif
#endif
aExecutable.leafName != leafName;
},
/**
@ -1386,7 +1380,7 @@ var gApplicationsPane = {
// Add the "Preview in Firefox" option for optional internal handlers.
if (handlerInfo instanceof InternalHandlerInfoWrapper) {
var internalMenuItem = document.createElement("menuitem");
let internalMenuItem = document.createElement("menuitem");
internalMenuItem.setAttribute("action", Ci.nsIHandlerInfo.handleInternally);
let label = this._prefsBundle.getFormattedString("previewInApp",
[this._brandShortName]);
@ -1428,7 +1422,7 @@ var gApplicationsPane = {
// If this is the feed type, add a Live Bookmarks item.
if (isFeedType(handlerInfo.type)) {
var internalMenuItem = document.createElement("menuitem");
let internalMenuItem = document.createElement("menuitem");
internalMenuItem.setAttribute("action", Ci.nsIHandlerInfo.handleInternally);
let label = this._prefsBundle.getFormattedString("addLiveBookmarksInApp",
[this._brandShortName]);
@ -1500,13 +1494,13 @@ var gApplicationsPane = {
// Create a menu item for selecting a local application.
let canOpenWithOtherApp = true;
#ifdef XP_WIN
// On Windows, selecting an application to open another application
// would be meaningless so we special case executables.
let executableType = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService)
.getTypeFromExtension("exe");
canOpenWithOtherApp = handlerInfo.type != executableType;
#endif
if (AppConstants.platform == "win") {
// On Windows, selecting an application to open another application
// would be meaningless so we special case executables.
let executableType = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService)
.getTypeFromExtension("exe");
canOpenWithOtherApp = handlerInfo.type != executableType;
}
if (canOpenWithOtherApp)
{
let menuItem = document.createElement("menuitem");
@ -1749,62 +1743,61 @@ var gApplicationsPane = {
}
}.bind(this);
#ifdef XP_WIN
var params = {};
var handlerInfo = this._handledTypes[this._list.selectedItem.type];
if (AppConstants.platform == "win") {
var params = {};
var handlerInfo = this._handledTypes[this._list.selectedItem.type];
if (isFeedType(handlerInfo.type)) {
// MIME info will be null, create a temp object.
params.mimeInfo = this._mimeSvc.getFromTypeAndExtension(handlerInfo.type,
handlerInfo.primaryExtension);
} else {
params.mimeInfo = handlerInfo.wrappedHandlerInfo;
}
params.title = this._prefsBundle.getString("fpTitleChooseApp");
params.description = handlerInfo.description;
params.filename = null;
params.handlerApp = null;
let onAppSelected = () => {
if (this.isValidHandlerApp(params.handlerApp)) {
handlerApp = params.handlerApp;
// Add the app to the type's list of possible handlers.
handlerInfo.addPossibleApplicationHandler(handlerApp);
if (isFeedType(handlerInfo.type)) {
// MIME info will be null, create a temp object.
params.mimeInfo = this._mimeSvc.getFromTypeAndExtension(handlerInfo.type,
handlerInfo.primaryExtension);
} else {
params.mimeInfo = handlerInfo.wrappedHandlerInfo;
}
chooseAppCallback(handlerApp);
};
params.title = this._prefsBundle.getString("fpTitleChooseApp");
params.description = handlerInfo.description;
params.filename = null;
params.handlerApp = null;
gSubDialog.open("chrome://global/content/appPicker.xul",
null, params, onAppSelected);
let onAppSelected = () => {
if (this.isValidHandlerApp(params.handlerApp)) {
handlerApp = params.handlerApp;
#else
let winTitle = this._prefsBundle.getString("fpTitleChooseApp");
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
let fpCallback = function fpCallback_done(aResult) {
if (aResult == Ci.nsIFilePicker.returnOK && fp.file &&
this._isValidHandlerExecutable(fp.file)) {
handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
createInstance(Ci.nsILocalHandlerApp);
handlerApp.name = getFileDisplayName(fp.file);
handlerApp.executable = fp.file;
// Add the app to the type's list of possible handlers.
let handlerInfo = this._handledTypes[this._list.selectedItem.type];
handlerInfo.addPossibleApplicationHandler(handlerApp);
// Add the app to the type's list of possible handlers.
handlerInfo.addPossibleApplicationHandler(handlerApp);
}
chooseAppCallback(handlerApp);
}
}.bind(this);
};
// Prompt the user to pick an app. If they pick one, and it's a valid
// selection, then add it to the list of possible handlers.
fp.init(window, winTitle, Ci.nsIFilePicker.modeOpen);
fp.appendFilters(Ci.nsIFilePicker.filterApps);
fp.open(fpCallback);
#endif
gSubDialog.open("chrome://global/content/appPicker.xul",
null, params, onAppSelected);
} else {
let winTitle = this._prefsBundle.getString("fpTitleChooseApp");
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
let fpCallback = function fpCallback_done(aResult) {
if (aResult == Ci.nsIFilePicker.returnOK && fp.file &&
this._isValidHandlerExecutable(fp.file)) {
handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
createInstance(Ci.nsILocalHandlerApp);
handlerApp.name = getFileDisplayName(fp.file);
handlerApp.executable = fp.file;
// Add the app to the type's list of possible handlers.
let handlerInfo = this._handledTypes[this._list.selectedItem.type];
handlerInfo.addPossibleApplicationHandler(handlerApp);
chooseAppCallback(handlerApp);
}
}.bind(this);
// Prompt the user to pick an app. If they pick one, and it's a valid
// selection, then add it to the list of possible handlers.
fp.init(window, winTitle, Ci.nsIFilePicker.modeOpen);
fp.appendFilters(Ci.nsIFilePicker.filterApps);
fp.open(fpCallback);
}
},
// Mark which item in the list was last selected so we can reselect it
@ -1858,7 +1851,7 @@ var gApplicationsPane = {
let preferredApp = aHandlerInfo.preferredApplicationHandler;
if (this.isValidHandlerApp(preferredApp))
return this._getIconURLForHandlerApp(preferredApp);
break;
// Explicit fall-through
// This should never happen, but if preferredAction is set to some weird
// value, then fall back to the generic application icon.
@ -1919,7 +1912,7 @@ var gApplicationsPane = {
if (url)
return url + "?size=16";
}
catch(ex) {}
catch (ex) {}
}
}

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

@ -7,10 +7,10 @@ browser.jar:
* content/browser/preferences/in-content/preferences.xul
content/browser/preferences/in-content/subdialogs.js
* content/browser/preferences/in-content/main.js
content/browser/preferences/in-content/main.js
content/browser/preferences/in-content/privacy.js
* content/browser/preferences/in-content/advanced.js
* content/browser/preferences/in-content/applications.js
content/browser/preferences/in-content/advanced.js
content/browser/preferences/in-content/applications.js
content/browser/preferences/in-content/content.js
content/browser/preferences/in-content/sync.js
content/browser/preferences/in-content/security.js

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

@ -11,10 +11,10 @@ Components.utils.import("resource:///modules/TransientPrefs.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
#ifdef E10S_TESTING_ONLY
XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
"resource://gre/modules/UpdateUtils.jsm");
#endif
if (AppConstants.E10S_TESTING_ONLY) {
XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
"resource://gre/modules/UpdateUtils.jsm");
}
var gMainPane = {
/**
@ -28,17 +28,17 @@ var gMainPane = {
.addEventListener(aEventType, aCallback.bind(gMainPane));
}
#ifdef HAVE_SHELL_SERVICE
this.updateSetDefaultBrowser();
#ifdef XP_WIN
// In Windows 8 we launch the control panel since it's the only
// way to get all file type association prefs. So we don't know
// when the user will select the default. We refresh here periodically
// in case the default changes. On other Windows OS's defaults can also
// be set while the prefs are open.
window.setInterval(this.updateSetDefaultBrowser.bind(this), 1000);
#endif
#endif
if (AppConstants.HAVE_SHELL_SERVICE) {
this.updateSetDefaultBrowser();
if (AppConstants.platform == "win") {
// In Windows 8 we launch the control panel since it's the only
// way to get all file type association prefs. So we don't know
// when the user will select the default. We refresh here periodically
// in case the default changes. On other Windows OS's defaults can also
// be set while the prefs are open.
window.setInterval(this.updateSetDefaultBrowser.bind(this), 1000);
}
}
// set up the "use current page" label-changing listener
this._updateUseCurrentButton();
@ -46,16 +46,16 @@ var gMainPane = {
this.updateBrowserStartupLastSession();
#ifdef XP_WIN
// Functionality for "Show tabs in taskbar" on Windows 7 and up.
try {
let sysInfo = Cc["@mozilla.org/system-info;1"].
getService(Ci.nsIPropertyBag2);
let ver = parseFloat(sysInfo.getProperty("version"));
let showTabsInTaskbar = document.getElementById("showTabsInTaskbar");
showTabsInTaskbar.hidden = ver < 6.1;
} catch (ex) {}
#endif
if (AppConstants.platform == "win") {
// Functionality for "Show tabs in taskbar" on Windows 7 and up.
try {
let sysInfo = Cc["@mozilla.org/system-info;1"].
getService(Ci.nsIPropertyBag2);
let ver = parseFloat(sysInfo.getProperty("version"));
let showTabsInTaskbar = document.getElementById("showTabsInTaskbar");
showTabsInTaskbar.hidden = ver < 6.1;
} catch (ex) {}
}
// The "closing multiple tabs" and "opening multiple tabs might slow down
// &brandShortName;" warnings provide options for not showing these
@ -70,10 +70,10 @@ var gMainPane = {
gMainPane.updateBrowserStartupLastSession);
setEventListener("browser.download.dir", "change",
gMainPane.displayDownloadDirPref);
#ifdef HAVE_SHELL_SERVICE
setEventListener("setDefaultButton", "command",
gMainPane.setDefaultBrowser);
#endif
if (AppConstants.HAVE_SHELL_SERVICE) {
setEventListener("setDefaultButton", "command",
gMainPane.setDefaultBrowser);
}
setEventListener("useCurrent", "command",
gMainPane.setHomePageToCurrent);
setEventListener("useBookmark", "command",
@ -83,38 +83,37 @@ var gMainPane = {
setEventListener("chooseFolder", "command",
gMainPane.chooseFolder);
#ifdef E10S_TESTING_ONLY
setEventListener("e10sAutoStart", "command",
gMainPane.enableE10SChange);
let e10sCheckbox = document.getElementById("e10sAutoStart");
if (AppConstants.E10S_TESTING_ONLY) {
setEventListener("e10sAutoStart", "command",
gMainPane.enableE10SChange);
let e10sCheckbox = document.getElementById("e10sAutoStart");
let e10sPref = document.getElementById("browser.tabs.remote.autostart");
let e10sTempPref = document.getElementById("e10sTempPref");
let e10sForceEnable = document.getElementById("e10sForceEnable");
let e10sPref = document.getElementById("browser.tabs.remote.autostart");
let e10sTempPref = document.getElementById("e10sTempPref");
let e10sForceEnable = document.getElementById("e10sForceEnable");
let preffedOn = e10sPref.value || e10sTempPref.value || e10sForceEnable.value;
let preffedOn = e10sPref.value || e10sTempPref.value || e10sForceEnable.value;
if (preffedOn) {
// The checkbox is checked if e10s is preffed on and enabled.
e10sCheckbox.checked = Services.appinfo.browserTabsRemoteAutostart;
if (preffedOn) {
// The checkbox is checked if e10s is preffed on and enabled.
e10sCheckbox.checked = Services.appinfo.browserTabsRemoteAutostart;
// but if it's force disabled, then the checkbox is disabled.
e10sCheckbox.disabled = !Services.appinfo.browserTabsRemoteAutostart;
// but if it's force disabled, then the checkbox is disabled.
e10sCheckbox.disabled = !Services.appinfo.browserTabsRemoteAutostart;
}
}
#endif
if (AppConstants.MOZ_DEV_EDITION) {
let uAppData = OS.Constants.Path.userApplicationDataDir;
let ignoreSeparateProfile = OS.Path.join(uAppData, "ignore-dev-edition-profile");
#ifdef MOZ_DEV_EDITION
let uAppData = OS.Constants.Path.userApplicationDataDir;
let ignoreSeparateProfile = OS.Path.join(uAppData, "ignore-dev-edition-profile");
setEventListener("separateProfileMode", "command", gMainPane.separateProfileModeChange);
let separateProfileModeCheckbox = document.getElementById("separateProfileMode");
setEventListener("getStarted", "click", gMainPane.onGetStarted);
setEventListener("separateProfileMode", "command", gMainPane.separateProfileModeChange);
let separateProfileModeCheckbox = document.getElementById("separateProfileMode");
setEventListener("getStarted", "click", gMainPane.onGetStarted);
OS.File.stat(ignoreSeparateProfile).then(() => separateProfileModeCheckbox.checked = false,
() => separateProfileModeCheckbox.checked = true);
#endif
OS.File.stat(ignoreSeparateProfile).then(() => separateProfileModeCheckbox.checked = false,
() => separateProfileModeCheckbox.checked = true);
}
// Notify observers that the UI is now ready
Components.classes["@mozilla.org/observer-service;1"]
@ -122,109 +121,111 @@ var gMainPane = {
.notifyObservers(window, "main-pane-loaded", null);
},
#ifdef E10S_TESTING_ONLY
enableE10SChange: function ()
{
let e10sCheckbox = document.getElementById("e10sAutoStart");
let e10sPref = document.getElementById("browser.tabs.remote.autostart");
let e10sTempPref = document.getElementById("e10sTempPref");
if (AppConstants.E10S_TESTING_ONLY) {
let e10sCheckbox = document.getElementById("e10sAutoStart");
let e10sPref = document.getElementById("browser.tabs.remote.autostart");
let e10sTempPref = document.getElementById("e10sTempPref");
let prefsToChange;
if (e10sCheckbox.checked) {
// Enabling e10s autostart
prefsToChange = [e10sPref];
} else {
// Disabling e10s autostart
prefsToChange = [e10sPref];
if (e10sTempPref.value) {
prefsToChange.push(e10sTempPref);
}
}
let buttonIndex = confirmRestartPrompt(e10sCheckbox.checked, 0,
true, false);
if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
const Cc = Components.classes, Ci = Components.interfaces;
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
.createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
"restart");
if (!cancelQuit.data) {
for (let prefToChange of prefsToChange) {
prefToChange.value = e10sCheckbox.checked;
}
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
}
}
// Revert the checkbox in case we didn't quit
e10sCheckbox.checked = e10sPref.value || e10sTempPref.value;
},
#endif
#ifdef MOZ_DEV_EDITION
separateProfileModeChange: function ()
{
function quitApp() {
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestartNotSameProfile);
}
function revertCheckbox(error) {
separateProfileModeCheckbox.checked = !separateProfileModeCheckbox.checked;
if (error) {
Cu.reportError("Failed to toggle separate profile mode: " + error);
}
}
function createOrRemoveSpecialDevEditionFile(onSuccess) {
let uAppData = OS.Constants.Path.userApplicationDataDir;
let ignoreSeparateProfile = OS.Path.join(uAppData, "ignore-dev-edition-profile");
if (separateProfileModeCheckbox.checked) {
OS.File.remove(ignoreSeparateProfile).then(onSuccess, revertCheckbox);
let prefsToChange;
if (e10sCheckbox.checked) {
// Enabling e10s autostart
prefsToChange = [e10sPref];
} else {
OS.File.writeAtomic(ignoreSeparateProfile, new Uint8Array()).then(onSuccess, revertCheckbox);
// Disabling e10s autostart
prefsToChange = [e10sPref];
if (e10sTempPref.value) {
prefsToChange.push(e10sTempPref);
}
}
}
let separateProfileModeCheckbox = document.getElementById("separateProfileMode");
let button_index = confirmRestartPrompt(separateProfileModeCheckbox.checked,
0, false, true);
switch (button_index) {
case CONFIRM_RESTART_PROMPT_CANCEL:
revertCheckbox();
return;
case CONFIRM_RESTART_PROMPT_RESTART_NOW:
let buttonIndex = confirmRestartPrompt(e10sCheckbox.checked, 0,
true, false);
if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
const Cc = Components.classes, Ci = Components.interfaces;
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
.createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
"restart");
"restart");
if (!cancelQuit.data) {
createOrRemoveSpecialDevEditionFile(quitApp);
return;
}
for (let prefToChange of prefsToChange) {
prefToChange.value = e10sCheckbox.checked;
}
// Revert the checkbox in case we didn't quit
revertCheckbox();
return;
case CONFIRM_RESTART_PROMPT_RESTART_LATER:
createOrRemoveSpecialDevEditionFile();
return;
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
}
}
// Revert the checkbox in case we didn't quit
e10sCheckbox.checked = e10sPref.value || e10sTempPref.value;
}
},
separateProfileModeChange: function ()
{
if (AppConstants.MOZ_DEV_EDITION) {
function quitApp() {
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestartNotSameProfile);
}
function revertCheckbox(error) {
separateProfileModeCheckbox.checked = !separateProfileModeCheckbox.checked;
if (error) {
Cu.reportError("Failed to toggle separate profile mode: " + error);
}
}
function createOrRemoveSpecialDevEditionFile(onSuccess) {
let uAppData = OS.Constants.Path.userApplicationDataDir;
let ignoreSeparateProfile = OS.Path.join(uAppData, "ignore-dev-edition-profile");
if (separateProfileModeCheckbox.checked) {
OS.File.remove(ignoreSeparateProfile).then(onSuccess, revertCheckbox);
} else {
OS.File.writeAtomic(ignoreSeparateProfile, new Uint8Array()).then(onSuccess, revertCheckbox);
}
}
let separateProfileModeCheckbox = document.getElementById("separateProfileMode");
let button_index = confirmRestartPrompt(separateProfileModeCheckbox.checked,
0, false, true);
switch (button_index) {
case CONFIRM_RESTART_PROMPT_CANCEL:
revertCheckbox();
return;
case CONFIRM_RESTART_PROMPT_RESTART_NOW:
const Cc = Components.classes, Ci = Components.interfaces;
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
.createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
"restart");
if (!cancelQuit.data) {
createOrRemoveSpecialDevEditionFile(quitApp);
return;
}
// Revert the checkbox in case we didn't quit
revertCheckbox();
return;
case CONFIRM_RESTART_PROMPT_RESTART_LATER:
createOrRemoveSpecialDevEditionFile();
return;
}
}
},
onGetStarted: function (aEvent) {
const Cc = Components.classes, Ci = Components.interfaces;
let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
let win = wm.getMostRecentWindow("navigator:browser");
if (AppConstants.MOZ_DEV_EDITION) {
const Cc = Components.classes, Ci = Components.interfaces;
let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
let win = wm.getMostRecentWindow("navigator:browser");
if (win) {
let accountsTab = win.gBrowser.addTab("about:accounts?action=signin&entrypoint=dev-edition-setup");
win.gBrowser.selectedTab = accountsTab;
if (win) {
let accountsTab = win.gBrowser.addTab("about:accounts?action=signin&entrypoint=dev-edition-setup");
win.gBrowser.selectedTab = accountsTab;
}
}
},
#endif
// HOME PAGE
@ -334,8 +335,8 @@ var gMainPane = {
useCurrent.label = useCurrent.getAttribute("label1");
// In this case, the button's disabled state is set by preferences.xml.
if (document.getElementById
("pref.browser.homepage.disable_button.current_page").locked)
let prefName = "pref.browser.homepage.disable_button.current_page";
if (document.getElementById(prefName).locked)
return;
useCurrent.disabled = !tabs.length
@ -663,10 +664,7 @@ var gMainPane = {
writeLinkTarget: function() {
var linkTargeting = document.getElementById("linkTargeting");
return linkTargeting.checked ? 3 : 2;
}
#ifdef HAVE_SHELL_SERVICE
,
},
/*
* Preferences:
*
@ -681,18 +679,20 @@ var gMainPane = {
*/
updateSetDefaultBrowser: function()
{
let shellSvc = getShellService();
let defaultBrowserBox = document.getElementById("defaultBrowserBox");
if (!shellSvc) {
defaultBrowserBox.hidden = true;
return;
if (AppConstants.HAVE_SHELL_SERVICE) {
let shellSvc = getShellService();
let defaultBrowserBox = document.getElementById("defaultBrowserBox");
if (!shellSvc) {
defaultBrowserBox.hidden = true;
return;
}
let setDefaultPane = document.getElementById("setDefaultPane");
let isDefault = shellSvc.isDefaultBrowser(false, true);
setDefaultPane.selectedIndex = isDefault ? 1 : 0;
let alwaysCheck = document.getElementById("alwaysCheckDefault");
alwaysCheck.disabled = alwaysCheck.disabled ||
isDefault && alwaysCheck.checked;
}
let setDefaultPane = document.getElementById("setDefaultPane");
let isDefault = shellSvc.isDefaultBrowser(false, true);
setDefaultPane.selectedIndex = isDefault ? 1 : 0;
let alwaysCheck = document.getElementById("alwaysCheckDefault");
alwaysCheck.disabled = alwaysCheck.disabled ||
isDefault && alwaysCheck.checked;
},
/**
@ -700,21 +700,22 @@ var gMainPane = {
*/
setDefaultBrowser: function()
{
let alwaysCheckPref = document.getElementById("browser.shell.checkDefaultBrowser");
alwaysCheckPref.value = true;
if (AppConstants.HAVE_SHELL_SERVICE) {
let alwaysCheckPref = document.getElementById("browser.shell.checkDefaultBrowser");
alwaysCheckPref.value = true;
let shellSvc = getShellService();
if (!shellSvc)
return;
try {
shellSvc.setDefaultBrowser(true, false);
} catch (ex) {
Cu.reportError(ex);
return;
let shellSvc = getShellService();
if (!shellSvc)
return;
try {
shellSvc.setDefaultBrowser(true, false);
} catch (ex) {
Cu.reportError(ex);
return;
}
let selectedIndex = shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
document.getElementById("setDefaultPane").selectedIndex = selectedIndex;
}
let selectedIndex = shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
document.getElementById("setDefaultPane").selectedIndex = selectedIndex;
}
#endif
},
};

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

@ -221,7 +221,7 @@ function confirmRestartPrompt(aRestartToEnable, aDefaultButtonIndex,
Services.prompt.BUTTON_TITLE_IS_STRING);
}
switch(aDefaultButtonIndex) {
switch (aDefaultButtonIndex) {
case 0:
buttonFlags += Services.prompt.BUTTON_POS_0_DEFAULT;
break;

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

@ -144,9 +144,13 @@ var gPrivacyPane = {
let radiogroup = document.getElementById("trackingProtectionRadioGroup");
// Global enable takes precedence over enabled in Private Browsing.
radiogroup.value = enabledPref.value ? "always" :
pbmPref.value ? "private" :
"never";
if (enabledPref.value) {
radiogroup.value = "always";
} else if (pbmPref.value) {
radiogroup.value = "private";
} else {
radiogroup.value = "never";
}
},
/**

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

@ -530,9 +530,8 @@ EngineView.prototype = {
if (dropIndex > sourceIndex) {
if (orientation == nsITreeView.DROP_BEFORE)
dropIndex--;
} else {
if (orientation == nsITreeView.DROP_AFTER)
dropIndex++;
} else if (orientation == nsITreeView.DROP_AFTER) {
dropIndex++;
}
this._engineStore.moveEngine(sourceEngine, dropIndex);

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

@ -115,11 +115,10 @@ var gSecurityPane = {
document.getElementById("savePasswords").disabled = true;
excepts.disabled = true;
return false;
} else {
excepts.disabled = !pref.value;
// don't override pref value in UI
return undefined;
}
excepts.disabled = !pref.value;
// don't override pref value in UI
return undefined;
},
/**

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

@ -364,6 +364,7 @@ var gSyncPane = {
if (isVerified) {
return fxAccounts.getSignedInUserProfile();
}
return null;
}).then(data => {
let fxaLoginStatus = document.getElementById("fxaLoginStatus");
if (data && profileInfoEnabled) {
@ -548,13 +549,9 @@ var gSyncPane = {
clickOrSpaceOrEnterPressed: function(event) {
// Note: charCode is deprecated, but 'char' not yet implemented.
// Replace charCode with char when implemented, see Bug 680830
if ((event.type == "click" && event.button == 0) || // button 0 = 'main button', typically left click.
(event.type == "keypress" &&
(event.charCode == KeyEvent.DOM_VK_SPACE || event.keyCode == KeyEvent.DOM_VK_RETURN))) {
return true;
} else {
return false;
}
return ((event.type == "click" && event.button == 0) ||
(event.type == "keypress" &&
(event.charCode == KeyEvent.DOM_VK_SPACE || event.keyCode == KeyEvent.DOM_VK_RETURN)));
},
openChangeProfileImage: function(event) {

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

@ -4,7 +4,7 @@ registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.preferences.instantApply");
});
add_task(function() {
add_task(function*() {
yield openPreferencesViaOpenPreferencesAPI("paneContent", null, {leaveOpen: true});
let doc = gBrowser.contentDocument;
var langGroup = Services.prefs.getComplexValue("font.language.group", Ci.nsIPrefLocalizedString).data

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

@ -8,7 +8,7 @@ registerCleanupFunction(function() {
gBrowser.removeTab(gBrowser.tabs[1]);
});
add_task(function() {
add_task(function*() {
originalWindowHeight = window.outerHeight;
window.resizeTo(window.outerWidth, 300);
let prefs = yield openPreferencesViaOpenPreferencesAPI("paneApplications", undefined, {leaveOpen: true});

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

@ -7,7 +7,7 @@ registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.preferences.instantApply");
});
add_task(function() {
add_task(function*() {
let prefs = yield openPreferencesViaOpenPreferencesAPI("paneContent");
is(prefs.selectedPane, "paneContent", "Content pane was selected");
prefs = yield openPreferencesViaOpenPreferencesAPI("advanced", "updateTab");

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

@ -60,13 +60,13 @@ function runTest(win, searchTerm, cookies, matches) {
// number of cookies should match injected cookies
var cnt = 0,
enumerator = cm.enumerator;
while (enumerator.hasMoreElements()) {
cnt++;
enumerator.getNext();
var injectedCookies = 0,
injectedEnumerator = cm.enumerator;
while (injectedEnumerator.hasMoreElements()) {
injectedCookies++;
injectedEnumerator.getNext();
}
is(cnt, cookies, "Number of cookies match injected cookies");
is(injectedCookies, cookies, "Number of cookies match injected cookies");
// "delete all cookies" should be enabled
isDisabled(win, false);
@ -126,13 +126,13 @@ function runTest(win, searchTerm, cookies, matches) {
is(win.gCookiesWindow._view.rowCount, 0, "Deleted all cookies");
// check that datastore is also at 0
var cnt = 0,
enumerator = cm.enumerator;
while (enumerator.hasMoreElements()) {
cnt++;
enumerator.getNext();
var remainingCookies = 0,
remainingEnumerator = cm.enumerator;
while (remainingEnumerator.hasMoreElements()) {
remainingCookies++;
remainingEnumerator.getNext();
}
is(cnt, 0, "Zero cookies remain");
is(remainingCookies, 0, "Zero cookies remain");
// "delete all cookies" should be disabled
isDisabled(win, true);

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

@ -40,7 +40,7 @@ function test() {
}
try {
Services.ww.unregisterNotification(observer);
} catch(e) {
} catch (e) {
// Do nothing, if the test was successful the above line should fail silently.
}
});

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

@ -1,4 +1,4 @@
add_task(function() {
add_task(function*() {
is(gBrowser.currentURI.spec, "about:blank", "Test starts with about:blank open");
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home");
yield openPreferencesViaOpenPreferencesAPI("paneGeneral", null, {leaveOpen: true});

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

@ -7,7 +7,7 @@ registerCleanupFunction(function() {
gBrowser.removeTab(gBrowser.tabs[1]);
});
add_task(function() {
add_task(function*() {
let prefs = yield openPreferencesViaOpenPreferencesAPI("paneContent", undefined, {leaveOpen: true});
is(prefs.selectedPane, "paneContent", "Content pane was selected");

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

@ -25,12 +25,12 @@ add_task(function setup() {
});
});
add_task(function test_preference_enabled_when_unlocked() {
add_task(function* test_preference_enabled_when_unlocked() {
yield openPreferencesViaOpenPreferencesAPI("panePrivacy", undefined, {leaveOpen: true});
testPrefStateMatchesLockedState();
});
add_task(function test_preference_disabled_when_locked() {
add_task(function* test_preference_disabled_when_locked() {
Services.prefs.lockPref("privacy.sanitize.sanitizeOnShutdown");
yield openPreferencesViaOpenPreferencesAPI("panePrivacy", undefined, {leaveOpen: true});
testPrefStateMatchesLockedState();

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

@ -9,7 +9,7 @@ browser.jar:
content/browser/preferences/blocklists.js
* content/browser/preferences/colors.xul
* content/browser/preferences/cookies.xul
* content/browser/preferences/cookies.js
content/browser/preferences/cookies.js
* content/browser/preferences/connection.xul
content/browser/preferences/connection.js
content/browser/preferences/donottrack.xul
@ -20,7 +20,7 @@ browser.jar:
* content/browser/preferences/languages.xul
content/browser/preferences/languages.js
content/browser/preferences/permissions.xul
* content/browser/preferences/permissions.js
content/browser/preferences/permissions.js
content/browser/preferences/sanitize.xul
content/browser/preferences/sanitize.js
content/browser/preferences/selectBookmark.xul

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

@ -72,7 +72,7 @@ var gLanguagesDialog = {
try {
language = bundleLanguages.getString(ab);
}
catch (e) { continue; };
catch (e) { continue; }
var region = "";
if (useABCDFormat) {
@ -178,7 +178,7 @@ var gLanguagesDialog = {
var selectedID = this._availableLanguages.selectedItem.id;
var preference = document.getElementById("intl.accept_languages");
var arrayOfPrefs = preference.value.toLowerCase().split(/\s*,\s*/);
for (var i = 0; i < arrayOfPrefs.length; ++i ){
for (var i = 0; i < arrayOfPrefs.length; ++i ) {
if (arrayOfPrefs[i] == selectedID)
return;
}

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

@ -44,14 +44,14 @@ var gPermissionManager = {
isSeparator: function(aIndex) { return false; },
isSorted: function() { return false; },
isContainer: function(aIndex) { return false; },
setTree: function(aTree){},
setTree: function(aTree) {},
getImageSrc: function(aRow, aColumn) {},
getProgressMode: function(aRow, aColumn) {},
getCellValue: function(aRow, aColumn) {},
cycleHeader: function(column) {},
getRowProperties: function(row){ return ""; },
getColumnProperties: function(column){ return ""; },
getCellProperties: function(row,column){
getRowProperties: function(row) { return ""; },
getColumnProperties: function(column) { return ""; },
getCellProperties: function(row,column) {
if (column.element.getAttribute("id") == "siteCol")
return "ltr";
@ -98,13 +98,13 @@ var gPermissionManager = {
principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
// If we have ended up with an unknown scheme, the following will throw.
principal.origin;
} catch(ex) {
} catch (ex) {
uri = Services.io.newURI("http://" + input_url, null, null);
principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
// If we have ended up with an unknown scheme, the following will throw.
principal.origin;
}
} catch(ex) {
} catch (ex) {
var message = this._bundle.getString("invalidURI");
var title = this._bundle.getString("invalidURITitle");
Services.prompt.alert(window, title, message);
@ -349,12 +349,12 @@ var gPermissionManager = {
onPermissionKeyPress: function (aEvent)
{
if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE
#ifdef XP_MACOSX
|| aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE
#endif
)
if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE) {
this.onPermissionDeleted();
} else if (AppConstants.platform == "macosx" &&
aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE) {
this.onPermissionDeleted();
}
},
_lastPermissionSortColumn: "",

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

@ -130,6 +130,13 @@ this.AppConstants = Object.freeze({
false,
#endif
MOZ_WIDGET_GTK:
#ifdef MOZ_WIDGET_GTK
true,
#else
false,
#endif
# MOZ_B2G covers both device and desktop b2g
MOZ_B2G:
#ifdef MOZ_B2G
@ -325,4 +332,11 @@ this.AppConstants = Object.freeze({
#else
false,
#endif
HAVE_SHELL_SERVICE:
#ifdef HAVE_SHELL_SERVICE
true,
#else
false,
#endif
});

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

@ -102,6 +102,9 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3'):
DEFINES['MENUBAR_CAN_AUTOHIDE'] = 1
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3', 'cocoa'):
DEFINES['HAVE_SHELL_SERVICE'] = 1
EXTRA_PP_JS_MODULES += [
'AppConstants.jsm',
]