зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1294989 - Enable eslint for browser/components/preferences. r=Gijs
MozReview-Commit-ID: 62ymdZhluHx --HG-- extra : rebase_source : 330d512f91d840a47e48f39c21d70d13b2953d2d
This commit is contained in:
Родитель
797f4c4fe4
Коммит
8d45b8762e
|
@ -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/**
|
||||
|
|
|
@ -46,9 +46,9 @@ var gConnectionsDialog = {
|
|||
proxyPortPref.value = httpProxyPortPref.value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.sanitizeNoProxiesPref();
|
||||
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -57,7 +57,7 @@ var gConnectionsDialog = {
|
|||
if ("@mozilla.org/system-proxy-settings;1" in Components.classes)
|
||||
document.getElementById("systemPref").removeAttribute("hidden");
|
||||
},
|
||||
|
||||
|
||||
proxyTypeChanged: function ()
|
||||
{
|
||||
var proxyTypePref = document.getElementById("network.proxy.type");
|
||||
|
@ -83,7 +83,7 @@ var gConnectionsDialog = {
|
|||
|
||||
this.updateReloadButton();
|
||||
},
|
||||
|
||||
|
||||
updateDNSPref: function ()
|
||||
{
|
||||
var socksVersionPref = document.getElementById("network.proxy.socks_version");
|
||||
|
@ -93,7 +93,7 @@ var gConnectionsDialog = {
|
|||
socksDNSPref.disabled = (isDefinitelySocks4 || proxyTypePref.value == 0);
|
||||
return undefined;
|
||||
},
|
||||
|
||||
|
||||
updateReloadButton: function ()
|
||||
{
|
||||
// Disable the "Reload PAC" button if the selected proxy type is not PAC or
|
||||
|
@ -115,13 +115,13 @@ var gConnectionsDialog = {
|
|||
disableReloadPref.disabled =
|
||||
(proxyTypeCur != 2 || proxyType != 2 || typedURL != pacURL);
|
||||
},
|
||||
|
||||
|
||||
readProxyType: function ()
|
||||
{
|
||||
this.proxyTypeChanged();
|
||||
return undefined;
|
||||
},
|
||||
|
||||
|
||||
updateProtocolPrefs: function ()
|
||||
{
|
||||
var proxyTypePref = document.getElementById("network.proxy.type");
|
||||
|
@ -130,8 +130,8 @@ var gConnectionsDialog = {
|
|||
for (var i = 0; i < proxyPrefs.length; ++i) {
|
||||
var proxyServerURLPref = document.getElementById("network.proxy." + proxyPrefs[i]);
|
||||
var proxyPortPref = document.getElementById("network.proxy." + proxyPrefs[i] + "_port");
|
||||
|
||||
// Restore previous per-proxy custom settings, if present.
|
||||
|
||||
// Restore previous per-proxy custom settings, if present.
|
||||
if (!shareProxiesPref.value) {
|
||||
var backupServerURLPref = document.getElementById("network.proxy.backup." + proxyPrefs[i]);
|
||||
var backupPortPref = document.getElementById("network.proxy.backup." + proxyPrefs[i] + "_port");
|
||||
|
@ -155,15 +155,15 @@ var gConnectionsDialog = {
|
|||
this.updateDNSPref();
|
||||
return undefined;
|
||||
},
|
||||
|
||||
|
||||
readProxyProtocolPref: function (aProtocol, aIsPort)
|
||||
{
|
||||
var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
|
||||
if (shareProxiesPref.value) {
|
||||
var pref = document.getElementById("network.proxy.http" + (aIsPort ? "_port" : ""));
|
||||
var pref = document.getElementById("network.proxy.http" + (aIsPort ? "_port" : ""));
|
||||
return pref.value;
|
||||
}
|
||||
|
||||
|
||||
var backupPref = document.getElementById("network.proxy.backup." + aProtocol + (aIsPort ? "_port" : ""));
|
||||
return backupPref.hasUserValue ? backupPref.value : undefined;
|
||||
},
|
||||
|
@ -173,7 +173,7 @@ var gConnectionsDialog = {
|
|||
Components.classes["@mozilla.org/network/protocol-proxy-service;1"].
|
||||
getService().reloadPAC();
|
||||
},
|
||||
|
||||
|
||||
doAutoconfigURLFixup: function ()
|
||||
{
|
||||
var autoURL = document.getElementById("networkProxyAutoconfigURL");
|
||||
|
@ -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()
|
||||
|
@ -191,10 +191,10 @@ var gConnectionsDialog = {
|
|||
// replace substrings of ; and \n with commas if they're neither immediately
|
||||
// preceded nor followed by a valid separator character
|
||||
noProxiesPref.value = noProxiesPref.value.replace(/([^, \n;])[;\n]+(?![,\n;])/g, '$1,');
|
||||
// replace any remaining ; and \n since some may follow commas, etc.
|
||||
// replace any remaining ; and \n since some may follow commas, etc.
|
||||
noProxiesPref.value = noProxiesPref.value.replace(/[;\n]/g, '');
|
||||
},
|
||||
|
||||
|
||||
readHTTPProxyServer: function ()
|
||||
{
|
||||
var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
|
||||
|
@ -202,7 +202,7 @@ var gConnectionsDialog = {
|
|||
this.updateProtocolPrefs();
|
||||
return undefined;
|
||||
},
|
||||
|
||||
|
||||
readHTTPProxyPort: function ()
|
||||
{
|
||||
var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
|
||||
|
|
|
@ -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;
|
||||
|
@ -711,7 +707,7 @@ var gCookiesWindow = {
|
|||
}
|
||||
else {
|
||||
var rangeCount = seln.getRangeCount();
|
||||
// Traverse backwards through selections to avoid messing
|
||||
// Traverse backwards through selections to avoid messing
|
||||
// up the indices when they are deleted.
|
||||
// See bug 388079.
|
||||
for (var i = rangeCount - 1; i >= 0; --i) {
|
||||
|
@ -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 : "",
|
||||
|
|
|
@ -40,14 +40,14 @@ var gFontsDialog = {
|
|||
preference.setAttribute("type", prefs[i].type);
|
||||
preferences.appendChild(preference);
|
||||
}
|
||||
|
||||
|
||||
if (!prefs[i].element)
|
||||
continue;
|
||||
|
||||
|
||||
var element = document.getElementById(prefs[i].element);
|
||||
if (element) {
|
||||
element.setAttribute("preference", preference.id);
|
||||
|
||||
|
||||
if (prefs[i].fonttype)
|
||||
FontBuilder.buildFontList(aLanguageGroup, prefs[i].fonttype, element);
|
||||
|
||||
|
@ -55,20 +55,20 @@ var gFontsDialog = {
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
readFontLanguageGroup: function ()
|
||||
{
|
||||
var languagePref = document.getElementById("font.language.group");
|
||||
this._selectLanguageGroup(languagePref.value);
|
||||
return undefined;
|
||||
},
|
||||
|
||||
|
||||
readUseDocumentFonts: function ()
|
||||
{
|
||||
var preference = document.getElementById("browser.display.use_document_fonts");
|
||||
return preference.value == 1;
|
||||
},
|
||||
|
||||
|
||||
writeUseDocumentFonts: function ()
|
||||
{
|
||||
var useDocumentFonts = document.getElementById("useDocumentFonts");
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ function getLocalHandlerApp(aFile) {
|
|||
* An enumeration of items in a JS array.
|
||||
*
|
||||
* FIXME: use ArrayConverter once it lands (bug 380839).
|
||||
*
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function ArrayEnumerator(aItems) {
|
||||
|
@ -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;
|
||||
},
|
||||
|
@ -455,10 +454,10 @@ HandlerInfoWrapper.prototype = {
|
|||
* This object implements nsIHandlerInfo for the feed types. It's a separate
|
||||
* object because we currently store handling information for the feed type
|
||||
* in a set of preferences rather than the nsIHandlerService-managed datastore.
|
||||
*
|
||||
*
|
||||
* This object inherits from HandlerInfoWrapper in order to get functionality
|
||||
* that isn't special to the feed type.
|
||||
*
|
||||
*
|
||||
* XXX Should we inherit from HandlerInfoWrapper? After all, we override
|
||||
* most of that wrapper's properties and methods, and we have to dance around
|
||||
* the fact that the wrapper expects to have a wrappedHandlerInfo, which we
|
||||
|
@ -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;
|
||||
},
|
||||
|
@ -777,9 +770,9 @@ FeedHandlerInfo.prototype = {
|
|||
|
||||
var feedHandlerInfo = {
|
||||
__proto__: new FeedHandlerInfo(TYPE_MAYBE_FEED),
|
||||
_prefSelectedApp: PREF_FEED_SELECTED_APP,
|
||||
_prefSelectedWeb: PREF_FEED_SELECTED_WEB,
|
||||
_prefSelectedAction: PREF_FEED_SELECTED_ACTION,
|
||||
_prefSelectedApp: PREF_FEED_SELECTED_APP,
|
||||
_prefSelectedWeb: PREF_FEED_SELECTED_WEB,
|
||||
_prefSelectedAction: PREF_FEED_SELECTED_ACTION,
|
||||
_prefSelectedReader: PREF_FEED_SELECTED_READER,
|
||||
_smallIcon: "chrome://browser/skin/feeds/feedIcon16.png",
|
||||
_appPrefLabel: "webFeed"
|
||||
|
@ -787,9 +780,9 @@ var feedHandlerInfo = {
|
|||
|
||||
var videoFeedHandlerInfo = {
|
||||
__proto__: new FeedHandlerInfo(TYPE_MAYBE_VIDEO_FEED),
|
||||
_prefSelectedApp: PREF_VIDEO_FEED_SELECTED_APP,
|
||||
_prefSelectedWeb: PREF_VIDEO_FEED_SELECTED_WEB,
|
||||
_prefSelectedAction: PREF_VIDEO_FEED_SELECTED_ACTION,
|
||||
_prefSelectedApp: PREF_VIDEO_FEED_SELECTED_APP,
|
||||
_prefSelectedWeb: PREF_VIDEO_FEED_SELECTED_WEB,
|
||||
_prefSelectedAction: PREF_VIDEO_FEED_SELECTED_ACTION,
|
||||
_prefSelectedReader: PREF_VIDEO_FEED_SELECTED_READER,
|
||||
_smallIcon: "chrome://browser/skin/feeds/videoFeedIcon16.png",
|
||||
_appPrefLabel: "videoPodcastFeed"
|
||||
|
@ -797,9 +790,9 @@ var videoFeedHandlerInfo = {
|
|||
|
||||
var audioFeedHandlerInfo = {
|
||||
__proto__: new FeedHandlerInfo(TYPE_MAYBE_AUDIO_FEED),
|
||||
_prefSelectedApp: PREF_AUDIO_FEED_SELECTED_APP,
|
||||
_prefSelectedWeb: PREF_AUDIO_FEED_SELECTED_WEB,
|
||||
_prefSelectedAction: PREF_AUDIO_FEED_SELECTED_ACTION,
|
||||
_prefSelectedApp: PREF_AUDIO_FEED_SELECTED_APP,
|
||||
_prefSelectedWeb: PREF_AUDIO_FEED_SELECTED_WEB,
|
||||
_prefSelectedAction: PREF_AUDIO_FEED_SELECTED_ACTION,
|
||||
_prefSelectedReader: PREF_AUDIO_FEED_SELECTED_READER,
|
||||
_smallIcon: "chrome://browser/skin/feeds/audioFeedIcon16.png",
|
||||
_appPrefLabel: "audioPodcastFeed"
|
||||
|
@ -853,7 +846,7 @@ var gApplicationsPane = {
|
|||
// The set of types the app knows how to handle. A hash of HandlerInfoWrapper
|
||||
// objects, indexed by type.
|
||||
_handledTypes: {},
|
||||
|
||||
|
||||
// The list of types we can show, sorted by the sort column/direction.
|
||||
// An array of HandlerInfoWrapper objects. We build this list when we first
|
||||
// load the data and then rebuild it when users change a pref that affects
|
||||
|
@ -954,7 +947,7 @@ var gApplicationsPane = {
|
|||
// column, we should remove it.
|
||||
document.getElementById("typeColumn").removeAttribute("sortDirection");
|
||||
}
|
||||
else
|
||||
else
|
||||
this._sortColumn = document.getElementById("typeColumn");
|
||||
|
||||
// Load the data and build the list of handlers.
|
||||
|
@ -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");
|
||||
|
@ -1548,7 +1542,7 @@ var gApplicationsPane = {
|
|||
break;
|
||||
case Ci.nsIHandlerInfo.useHelperApp:
|
||||
if (preferredApp)
|
||||
menu.selectedItem =
|
||||
menu.selectedItem =
|
||||
possibleAppMenuItems.filter(v => v.handlerApp.equals(preferredApp))[0];
|
||||
break;
|
||||
case kActionUsePlugin:
|
||||
|
@ -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) {
|
||||
|
@ -422,7 +423,7 @@ var gSyncPane = {
|
|||
startOver: function (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 +
|
||||
Services.prompt.BUTTON_POS_1 * Services.prompt.BUTTON_TITLE_CANCEL +
|
||||
Services.prompt.BUTTON_POS_1_DEFAULT;
|
||||
let buttonChoice =
|
||||
Services.prompt.confirmEx(window,
|
||||
|
@ -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) {
|
||||
|
@ -651,11 +648,11 @@ var gSyncPane = {
|
|||
openAddDevice: function () {
|
||||
if (!Weave.Utils.ensureMPUnlocked())
|
||||
return;
|
||||
|
||||
|
||||
let win = Services.wm.getMostRecentWindow("Sync:AddDevice");
|
||||
if (win)
|
||||
win.focus();
|
||||
else
|
||||
else
|
||||
window.openDialog("chrome://browser/content/sync/addDevice.xul",
|
||||
"syncAddDevice", "centerscreen,chrome,resizable=no");
|
||||
},
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
var originalWindowHeight;
|
||||
registerCleanupFunction(function() {
|
||||
window.resizeTo(window.outerWidth, originalWindowHeight);
|
||||
while (gBrowser.tabs[1])
|
||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||
});
|
||||
|
||||
add_task(function() {
|
||||
originalWindowHeight = window.outerHeight;
|
||||
window.resizeTo(window.outerWidth, 300);
|
||||
let prefs = yield openPreferencesViaOpenPreferencesAPI("paneApplications", undefined, {leaveOpen: true});
|
||||
is(prefs.selectedPane, "paneApplications", "Applications pane was selected");
|
||||
let mainContent = gBrowser.contentDocument.querySelector(".main-content");
|
||||
mainContent.scrollTop = 50;
|
||||
is(mainContent.scrollTop, 50, "main-content should be scrolled 50 pixels");
|
||||
|
||||
gBrowser.contentWindow.gotoPref("paneGeneral");
|
||||
is(mainContent.scrollTop, 0,
|
||||
"Switching to a different category should reset the scroll position");
|
||||
});
|
||||
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
var originalWindowHeight;
|
||||
registerCleanupFunction(function() {
|
||||
window.resizeTo(window.outerWidth, originalWindowHeight);
|
||||
while (gBrowser.tabs[1])
|
||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||
});
|
||||
|
||||
add_task(function*() {
|
||||
originalWindowHeight = window.outerHeight;
|
||||
window.resizeTo(window.outerWidth, 300);
|
||||
let prefs = yield openPreferencesViaOpenPreferencesAPI("paneApplications", undefined, {leaveOpen: true});
|
||||
is(prefs.selectedPane, "paneApplications", "Applications pane was selected");
|
||||
let mainContent = gBrowser.contentDocument.querySelector(".main-content");
|
||||
mainContent.scrollTop = 50;
|
||||
is(mainContent.scrollTop, 50, "main-content should be scrolled 50 pixels");
|
||||
|
||||
gBrowser.contentWindow.gotoPref("paneGeneral");
|
||||
is(mainContent.scrollTop, 0,
|
||||
"Switching to a different category should reset the scroll position");
|
||||
});
|
||||
|
||||
|
|
|
@ -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,103 +1,103 @@
|
|||
"use strict";
|
||||
|
||||
const CHECK_DEFAULT_INITIAL = Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser");
|
||||
|
||||
add_task(function* clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences");
|
||||
|
||||
yield test_with_mock_shellservice({isDefault: false}, function*() {
|
||||
let setDefaultPane = content.document.getElementById("setDefaultPane");
|
||||
Assert.equal(setDefaultPane.selectedIndex, "0",
|
||||
"The 'make default' pane should be visible when not default");
|
||||
let alwaysCheck = content.document.getElementById("alwaysCheckDefault");
|
||||
Assert.ok(!alwaysCheck.checked, "Always Check is unchecked by default");
|
||||
Assert.ok(!Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"),
|
||||
"alwaysCheck pref should be false by default in test runs");
|
||||
|
||||
let setDefaultButton = content.document.getElementById("setDefaultButton");
|
||||
setDefaultButton.click();
|
||||
content.window.gMainPane.updateSetDefaultBrowser();
|
||||
|
||||
yield ContentTaskUtils.waitForCondition(() => alwaysCheck.checked,
|
||||
"'Always Check' checkbox should get checked after clicking the 'Set Default' button");
|
||||
|
||||
Assert.ok(alwaysCheck.checked,
|
||||
"Clicking 'Make Default' checks the 'Always Check' checkbox");
|
||||
Assert.ok(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"),
|
||||
"Checking the checkbox should set the pref to true");
|
||||
Assert.ok(alwaysCheck.disabled,
|
||||
"'Always Check' checkbox is locked with default browser and alwaysCheck=true");
|
||||
Assert.equal(setDefaultPane.selectedIndex, "1",
|
||||
"The 'make default' pane should not be visible when default");
|
||||
Assert.ok(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"),
|
||||
"checkDefaultBrowser pref is now enabled");
|
||||
});
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
Services.prefs.clearUserPref("browser.shell.checkDefaultBrowser");
|
||||
});
|
||||
|
||||
add_task(function* clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
Services.prefs.lockPref("browser.shell.checkDefaultBrowser");
|
||||
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences");
|
||||
|
||||
yield test_with_mock_shellservice({isDefault: false}, function*() {
|
||||
let setDefaultPane = content.document.getElementById("setDefaultPane");
|
||||
Assert.equal(setDefaultPane.selectedIndex, "0",
|
||||
"The 'make default' pane should be visible when not default");
|
||||
let alwaysCheck = content.document.getElementById("alwaysCheckDefault");
|
||||
Assert.ok(alwaysCheck.disabled, "Always Check is disabled when locked");
|
||||
Assert.ok(alwaysCheck.checked,
|
||||
"Always Check is checked because defaultPref is true and pref is locked");
|
||||
Assert.ok(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"),
|
||||
"alwaysCheck pref should ship with 'true' by default");
|
||||
|
||||
let setDefaultButton = content.document.getElementById("setDefaultButton");
|
||||
setDefaultButton.click();
|
||||
content.window.gMainPane.updateSetDefaultBrowser();
|
||||
|
||||
yield ContentTaskUtils.waitForCondition(() => setDefaultPane.selectedIndex == "1",
|
||||
"Browser is now default");
|
||||
|
||||
Assert.ok(alwaysCheck.checked,
|
||||
"'Always Check' is still checked because it's locked");
|
||||
Assert.ok(alwaysCheck.disabled,
|
||||
"'Always Check is disabled because it's locked");
|
||||
Assert.ok(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"),
|
||||
"The pref is locked and so doesn't get changed");
|
||||
});
|
||||
|
||||
Services.prefs.unlockPref("browser.shell.checkDefaultBrowser");
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.unlockPref("browser.shell.checkDefaultBrowser");
|
||||
Services.prefs.setBoolPref("browser.shell.checkDefaultBrowser", CHECK_DEFAULT_INITIAL);
|
||||
});
|
||||
|
||||
function* test_with_mock_shellservice(options, testFn) {
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, options, function*(options) {
|
||||
let doc = content.document;
|
||||
let win = doc.defaultView;
|
||||
win.oldShellService = win.getShellService();
|
||||
let mockShellService = {
|
||||
_isDefault: false,
|
||||
isDefaultBrowser() {
|
||||
return this._isDefault;
|
||||
},
|
||||
setDefaultBrowser() {
|
||||
this._isDefault = true;
|
||||
},
|
||||
};
|
||||
win.getShellService = function() {
|
||||
return mockShellService;
|
||||
}
|
||||
mockShellService._isDefault = options.isDefault;
|
||||
win.gMainPane.updateSetDefaultBrowser();
|
||||
});
|
||||
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, null, testFn);
|
||||
|
||||
Services.prefs.setBoolPref("browser.shell.checkDefaultBrowser", CHECK_DEFAULT_INITIAL);
|
||||
}
|
||||
"use strict";
|
||||
|
||||
const CHECK_DEFAULT_INITIAL = Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser");
|
||||
|
||||
add_task(function* clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences");
|
||||
|
||||
yield test_with_mock_shellservice({isDefault: false}, function*() {
|
||||
let setDefaultPane = content.document.getElementById("setDefaultPane");
|
||||
Assert.equal(setDefaultPane.selectedIndex, "0",
|
||||
"The 'make default' pane should be visible when not default");
|
||||
let alwaysCheck = content.document.getElementById("alwaysCheckDefault");
|
||||
Assert.ok(!alwaysCheck.checked, "Always Check is unchecked by default");
|
||||
Assert.ok(!Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"),
|
||||
"alwaysCheck pref should be false by default in test runs");
|
||||
|
||||
let setDefaultButton = content.document.getElementById("setDefaultButton");
|
||||
setDefaultButton.click();
|
||||
content.window.gMainPane.updateSetDefaultBrowser();
|
||||
|
||||
yield ContentTaskUtils.waitForCondition(() => alwaysCheck.checked,
|
||||
"'Always Check' checkbox should get checked after clicking the 'Set Default' button");
|
||||
|
||||
Assert.ok(alwaysCheck.checked,
|
||||
"Clicking 'Make Default' checks the 'Always Check' checkbox");
|
||||
Assert.ok(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"),
|
||||
"Checking the checkbox should set the pref to true");
|
||||
Assert.ok(alwaysCheck.disabled,
|
||||
"'Always Check' checkbox is locked with default browser and alwaysCheck=true");
|
||||
Assert.equal(setDefaultPane.selectedIndex, "1",
|
||||
"The 'make default' pane should not be visible when default");
|
||||
Assert.ok(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"),
|
||||
"checkDefaultBrowser pref is now enabled");
|
||||
});
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
Services.prefs.clearUserPref("browser.shell.checkDefaultBrowser");
|
||||
});
|
||||
|
||||
add_task(function* clicking_make_default_checks_alwaysCheck_checkbox() {
|
||||
Services.prefs.lockPref("browser.shell.checkDefaultBrowser");
|
||||
yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences");
|
||||
|
||||
yield test_with_mock_shellservice({isDefault: false}, function*() {
|
||||
let setDefaultPane = content.document.getElementById("setDefaultPane");
|
||||
Assert.equal(setDefaultPane.selectedIndex, "0",
|
||||
"The 'make default' pane should be visible when not default");
|
||||
let alwaysCheck = content.document.getElementById("alwaysCheckDefault");
|
||||
Assert.ok(alwaysCheck.disabled, "Always Check is disabled when locked");
|
||||
Assert.ok(alwaysCheck.checked,
|
||||
"Always Check is checked because defaultPref is true and pref is locked");
|
||||
Assert.ok(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"),
|
||||
"alwaysCheck pref should ship with 'true' by default");
|
||||
|
||||
let setDefaultButton = content.document.getElementById("setDefaultButton");
|
||||
setDefaultButton.click();
|
||||
content.window.gMainPane.updateSetDefaultBrowser();
|
||||
|
||||
yield ContentTaskUtils.waitForCondition(() => setDefaultPane.selectedIndex == "1",
|
||||
"Browser is now default");
|
||||
|
||||
Assert.ok(alwaysCheck.checked,
|
||||
"'Always Check' is still checked because it's locked");
|
||||
Assert.ok(alwaysCheck.disabled,
|
||||
"'Always Check is disabled because it's locked");
|
||||
Assert.ok(Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser"),
|
||||
"The pref is locked and so doesn't get changed");
|
||||
});
|
||||
|
||||
Services.prefs.unlockPref("browser.shell.checkDefaultBrowser");
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.unlockPref("browser.shell.checkDefaultBrowser");
|
||||
Services.prefs.setBoolPref("browser.shell.checkDefaultBrowser", CHECK_DEFAULT_INITIAL);
|
||||
});
|
||||
|
||||
function* test_with_mock_shellservice(options, testFn) {
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, options, function*(options) {
|
||||
let doc = content.document;
|
||||
let win = doc.defaultView;
|
||||
win.oldShellService = win.getShellService();
|
||||
let mockShellService = {
|
||||
_isDefault: false,
|
||||
isDefaultBrowser() {
|
||||
return this._isDefault;
|
||||
},
|
||||
setDefaultBrowser() {
|
||||
this._isDefault = true;
|
||||
},
|
||||
};
|
||||
win.getShellService = function() {
|
||||
return mockShellService;
|
||||
}
|
||||
mockShellService._isDefault = options.isDefault;
|
||||
win.gMainPane.updateSetDefaultBrowser();
|
||||
});
|
||||
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, null, testFn);
|
||||
|
||||
Services.prefs.setBoolPref("browser.shell.checkDefaultBrowser", CHECK_DEFAULT_INITIAL);
|
||||
}
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
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});
|
||||
let doc = gBrowser.contentDocument;
|
||||
is(gBrowser.currentURI.spec, "about:preferences#general",
|
||||
"#general should be in the URI for about:preferences");
|
||||
let oldHomepagePref = Services.prefs.getCharPref("browser.startup.homepage");
|
||||
|
||||
let useCurrent = doc.getElementById("useCurrent");
|
||||
useCurrent.click();
|
||||
|
||||
is(gBrowser.tabs.length, 3, "Three tabs should be open");
|
||||
is(Services.prefs.getCharPref("browser.startup.homepage"), "about:blank|about:home",
|
||||
"about:blank and about:home should be the only homepages set");
|
||||
|
||||
Services.prefs.setCharPref("browser.startup.homepage", oldHomepagePref);
|
||||
yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
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});
|
||||
let doc = gBrowser.contentDocument;
|
||||
is(gBrowser.currentURI.spec, "about:preferences#general",
|
||||
"#general should be in the URI for about:preferences");
|
||||
let oldHomepagePref = Services.prefs.getCharPref("browser.startup.homepage");
|
||||
|
||||
let useCurrent = doc.getElementById("useCurrent");
|
||||
useCurrent.click();
|
||||
|
||||
is(gBrowser.tabs.length, 3, "Three tabs should be open");
|
||||
is(Services.prefs.getCharPref("browser.startup.homepage"), "about:blank|about:home",
|
||||
"about:blank and about:home should be the only homepages set");
|
||||
|
||||
Services.prefs.setCharPref("browser.startup.homepage", oldHomepagePref);
|
||||
yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
while (gBrowser.tabs[1])
|
||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||
});
|
||||
|
||||
add_task(function() {
|
||||
let prefs = yield openPreferencesViaOpenPreferencesAPI("paneContent", undefined, {leaveOpen: true});
|
||||
is(prefs.selectedPane, "paneContent", "Content pane was selected");
|
||||
|
||||
let doc = gBrowser.contentDocument;
|
||||
let notificationsDoNotDisturbRow = doc.getElementById("notificationsDoNotDisturbRow");
|
||||
if (notificationsDoNotDisturbRow.hidden) {
|
||||
todo(false, "Do not disturb is not available on this platform");
|
||||
return;
|
||||
}
|
||||
|
||||
let alertService;
|
||||
try {
|
||||
alertService = Cc["@mozilla.org/alerts-service;1"]
|
||||
.getService(Ci.nsIAlertsService)
|
||||
.QueryInterface(Ci.nsIAlertsDoNotDisturb);
|
||||
} catch (ex) {
|
||||
ok(true, "Do not disturb is not available on this platform: " + ex.message);
|
||||
return;
|
||||
}
|
||||
|
||||
let checkbox = doc.getElementById("notificationsDoNotDisturb");
|
||||
ok(!checkbox.checked, "Checkbox should not be checked by default");
|
||||
ok(!alertService.manualDoNotDisturb, "Do not disturb should be off by default");
|
||||
|
||||
let checkboxChanged = waitForEvent(checkbox, "command")
|
||||
checkbox.click();
|
||||
yield checkboxChanged;
|
||||
ok(alertService.manualDoNotDisturb, "Do not disturb should be enabled when checked");
|
||||
|
||||
checkboxChanged = waitForEvent(checkbox, "command")
|
||||
checkbox.click();
|
||||
yield checkboxChanged;
|
||||
ok(!alertService.manualDoNotDisturb, "Do not disturb should be disabled when unchecked");
|
||||
});
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
while (gBrowser.tabs[1])
|
||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||
});
|
||||
|
||||
add_task(function*() {
|
||||
let prefs = yield openPreferencesViaOpenPreferencesAPI("paneContent", undefined, {leaveOpen: true});
|
||||
is(prefs.selectedPane, "paneContent", "Content pane was selected");
|
||||
|
||||
let doc = gBrowser.contentDocument;
|
||||
let notificationsDoNotDisturbRow = doc.getElementById("notificationsDoNotDisturbRow");
|
||||
if (notificationsDoNotDisturbRow.hidden) {
|
||||
todo(false, "Do not disturb is not available on this platform");
|
||||
return;
|
||||
}
|
||||
|
||||
let alertService;
|
||||
try {
|
||||
alertService = Cc["@mozilla.org/alerts-service;1"]
|
||||
.getService(Ci.nsIAlertsService)
|
||||
.QueryInterface(Ci.nsIAlertsDoNotDisturb);
|
||||
} catch (ex) {
|
||||
ok(true, "Do not disturb is not available on this platform: " + ex.message);
|
||||
return;
|
||||
}
|
||||
|
||||
let checkbox = doc.getElementById("notificationsDoNotDisturb");
|
||||
ok(!checkbox.checked, "Checkbox should not be checked by default");
|
||||
ok(!alertService.manualDoNotDisturb, "Do not disturb should be off by default");
|
||||
|
||||
let checkboxChanged = waitForEvent(checkbox, "command")
|
||||
checkbox.click();
|
||||
yield checkboxChanged;
|
||||
ok(alertService.manualDoNotDisturb, "Do not disturb should be enabled when checked");
|
||||
|
||||
checkboxChanged = waitForEvent(checkbox, "command")
|
||||
checkbox.click();
|
||||
yield checkboxChanged;
|
||||
ok(!alertService.manualDoNotDisturb, "Do not disturb should be disabled when unchecked");
|
||||
});
|
||||
|
|
|
@ -1,45 +1,45 @@
|
|||
"use strict";
|
||||
|
||||
const PERMISSIONS_URL = "chrome://browser/content/preferences/permissions.xul";
|
||||
|
||||
add_task(function* urlFieldVisibleForPopupPermissions(finish) {
|
||||
yield openPreferencesViaOpenPreferencesAPI("paneContent", null, {leaveOpen: true});
|
||||
let win = gBrowser.selectedBrowser.contentWindow;
|
||||
let doc = win.document;
|
||||
let popupPolicyCheckbox = doc.getElementById("popupPolicy");
|
||||
ok(!popupPolicyCheckbox.checked, "popupPolicyCheckbox should be unchecked by default");
|
||||
popupPolicyCheckbox.click();
|
||||
let popupPolicyButton = doc.getElementById("popupPolicyButton");
|
||||
ok(popupPolicyButton, "popupPolicyButton found");
|
||||
let dialogPromise = promiseLoadSubDialog(PERMISSIONS_URL);
|
||||
popupPolicyButton.click();
|
||||
let dialog = yield dialogPromise;
|
||||
ok(dialog, "dialog loaded");
|
||||
|
||||
let urlLabel = dialog.document.getElementById("urlLabel");
|
||||
ok(!urlLabel.hidden, "urlLabel should be visible when one of block/session/allow visible");
|
||||
let url = dialog.document.getElementById("url");
|
||||
ok(!url.hidden, "url should be visible when one of block/session/allow visible");
|
||||
|
||||
popupPolicyCheckbox.click();
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
||||
add_task(function* urlFieldHiddenForNotificationPermissions() {
|
||||
yield openPreferencesViaOpenPreferencesAPI("paneContent", null, {leaveOpen: true});
|
||||
let win = gBrowser.selectedBrowser.contentWindow;
|
||||
let doc = win.document;
|
||||
let notificationsPolicyButton = doc.getElementById("notificationsPolicyButton");
|
||||
ok(notificationsPolicyButton, "notificationsPolicyButton found");
|
||||
let dialogPromise = promiseLoadSubDialog(PERMISSIONS_URL);
|
||||
notificationsPolicyButton.click();
|
||||
let dialog = yield dialogPromise;
|
||||
ok(dialog, "dialog loaded");
|
||||
|
||||
let urlLabel = dialog.document.getElementById("urlLabel");
|
||||
ok(urlLabel.hidden, "urlLabel should be hidden as requested");
|
||||
let url = dialog.document.getElementById("url");
|
||||
ok(url.hidden, "url should be hidden as requested");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
"use strict";
|
||||
|
||||
const PERMISSIONS_URL = "chrome://browser/content/preferences/permissions.xul";
|
||||
|
||||
add_task(function* urlFieldVisibleForPopupPermissions(finish) {
|
||||
yield openPreferencesViaOpenPreferencesAPI("paneContent", null, {leaveOpen: true});
|
||||
let win = gBrowser.selectedBrowser.contentWindow;
|
||||
let doc = win.document;
|
||||
let popupPolicyCheckbox = doc.getElementById("popupPolicy");
|
||||
ok(!popupPolicyCheckbox.checked, "popupPolicyCheckbox should be unchecked by default");
|
||||
popupPolicyCheckbox.click();
|
||||
let popupPolicyButton = doc.getElementById("popupPolicyButton");
|
||||
ok(popupPolicyButton, "popupPolicyButton found");
|
||||
let dialogPromise = promiseLoadSubDialog(PERMISSIONS_URL);
|
||||
popupPolicyButton.click();
|
||||
let dialog = yield dialogPromise;
|
||||
ok(dialog, "dialog loaded");
|
||||
|
||||
let urlLabel = dialog.document.getElementById("urlLabel");
|
||||
ok(!urlLabel.hidden, "urlLabel should be visible when one of block/session/allow visible");
|
||||
let url = dialog.document.getElementById("url");
|
||||
ok(!url.hidden, "url should be visible when one of block/session/allow visible");
|
||||
|
||||
popupPolicyCheckbox.click();
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
||||
add_task(function* urlFieldHiddenForNotificationPermissions() {
|
||||
yield openPreferencesViaOpenPreferencesAPI("paneContent", null, {leaveOpen: true});
|
||||
let win = gBrowser.selectedBrowser.contentWindow;
|
||||
let doc = win.document;
|
||||
let notificationsPolicyButton = doc.getElementById("notificationsPolicyButton");
|
||||
ok(notificationsPolicyButton, "notificationsPolicyButton found");
|
||||
let dialogPromise = promiseLoadSubDialog(PERMISSIONS_URL);
|
||||
notificationsPolicyButton.click();
|
||||
let dialog = yield dialogPromise;
|
||||
ok(dialog, "dialog loaded");
|
||||
|
||||
let urlLabel = dialog.document.getElementById("urlLabel");
|
||||
ok(urlLabel.hidden, "urlLabel should be hidden as requested");
|
||||
let url = dialog.document.getElementById("url");
|
||||
ok(url.hidden, "url should be hidden as requested");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
"use strict";
|
||||
|
||||
function switchToCustomHistoryMode(doc) {
|
||||
// Select the last item in the menulist.
|
||||
let menulist = doc.getElementById("historyMode");
|
||||
menulist.focus();
|
||||
EventUtils.sendKey("UP");
|
||||
}
|
||||
|
||||
function testPrefStateMatchesLockedState() {
|
||||
let win = gBrowser.contentWindow;
|
||||
let doc = win.document;
|
||||
switchToCustomHistoryMode(doc);
|
||||
|
||||
let checkbox = doc.getElementById("alwaysClear");
|
||||
let preference = doc.getElementById("privacy.sanitize.sanitizeOnShutdown");
|
||||
is(checkbox.disabled, preference.locked, "Always Clear checkbox should be enabled when preference is not locked.");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
}
|
||||
|
||||
add_task(function setup() {
|
||||
registerCleanupFunction(function resetPreferences() {
|
||||
Services.prefs.unlockPref("privacy.sanitize.sanitizeOnShutdown");
|
||||
});
|
||||
});
|
||||
|
||||
add_task(function test_preference_enabled_when_unlocked() {
|
||||
yield openPreferencesViaOpenPreferencesAPI("panePrivacy", undefined, {leaveOpen: true});
|
||||
testPrefStateMatchesLockedState();
|
||||
});
|
||||
|
||||
add_task(function test_preference_disabled_when_locked() {
|
||||
Services.prefs.lockPref("privacy.sanitize.sanitizeOnShutdown");
|
||||
yield openPreferencesViaOpenPreferencesAPI("panePrivacy", undefined, {leaveOpen: true});
|
||||
testPrefStateMatchesLockedState();
|
||||
});
|
||||
"use strict";
|
||||
|
||||
function switchToCustomHistoryMode(doc) {
|
||||
// Select the last item in the menulist.
|
||||
let menulist = doc.getElementById("historyMode");
|
||||
menulist.focus();
|
||||
EventUtils.sendKey("UP");
|
||||
}
|
||||
|
||||
function testPrefStateMatchesLockedState() {
|
||||
let win = gBrowser.contentWindow;
|
||||
let doc = win.document;
|
||||
switchToCustomHistoryMode(doc);
|
||||
|
||||
let checkbox = doc.getElementById("alwaysClear");
|
||||
let preference = doc.getElementById("privacy.sanitize.sanitizeOnShutdown");
|
||||
is(checkbox.disabled, preference.locked, "Always Clear checkbox should be enabled when preference is not locked.");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
}
|
||||
|
||||
add_task(function setup() {
|
||||
registerCleanupFunction(function resetPreferences() {
|
||||
Services.prefs.unlockPref("privacy.sanitize.sanitizeOnShutdown");
|
||||
});
|
||||
});
|
||||
|
||||
add_task(function* test_preference_enabled_when_unlocked() {
|
||||
yield openPreferencesViaOpenPreferencesAPI("panePrivacy", undefined, {leaveOpen: true});
|
||||
testPrefStateMatchesLockedState();
|
||||
});
|
||||
|
||||
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
|
||||
|
|
|
@ -7,9 +7,9 @@ var gLanguagesDialog = {
|
|||
|
||||
_availableLanguagesList : [],
|
||||
_acceptLanguages : { },
|
||||
|
||||
|
||||
_selectedItemID : null,
|
||||
|
||||
|
||||
init: function ()
|
||||
{
|
||||
if (!this._availableLanguagesList.length)
|
||||
|
@ -28,12 +28,12 @@ var gLanguagesDialog = {
|
|||
{
|
||||
return document.getElementById("activeLanguages");
|
||||
},
|
||||
|
||||
|
||||
get _availableLanguages()
|
||||
{
|
||||
return document.getElementById("availableLanguages");
|
||||
},
|
||||
|
||||
|
||||
_loadAvailableLanguages: function ()
|
||||
{
|
||||
// This is a parser for: resource://gre/res/language.properties
|
||||
|
@ -59,7 +59,7 @@ var gLanguagesDialog = {
|
|||
var currString = strings.getNext();
|
||||
if (!(currString instanceof Components.interfaces.nsIPropertyElement))
|
||||
break;
|
||||
|
||||
|
||||
var property = currString.key.split("."); // ab[-cd].accept
|
||||
if (property[1] == "accept") {
|
||||
var abCD = property[0];
|
||||
|
@ -71,9 +71,9 @@ var gLanguagesDialog = {
|
|||
var language = "";
|
||||
try {
|
||||
language = bundleLanguages.getString(ab);
|
||||
}
|
||||
catch (e) { continue; };
|
||||
|
||||
}
|
||||
catch (e) { continue; }
|
||||
|
||||
var region = "";
|
||||
if (useABCDFormat) {
|
||||
try {
|
||||
|
@ -81,17 +81,17 @@ var gLanguagesDialog = {
|
|||
}
|
||||
catch (e) { continue; }
|
||||
}
|
||||
|
||||
|
||||
var name = "";
|
||||
if (useABCDFormat)
|
||||
name = bundlePreferences.getFormattedString("languageRegionCodeFormat",
|
||||
name = bundlePreferences.getFormattedString("languageRegionCodeFormat",
|
||||
[language, region, abCD]);
|
||||
else
|
||||
name = bundlePreferences.getFormattedString("languageCodeFormat",
|
||||
name = bundlePreferences.getFormattedString("languageCodeFormat",
|
||||
[language, abCD]);
|
||||
|
||||
|
||||
if (name && abCD) {
|
||||
var isVisible = currString.value == "true" &&
|
||||
var isVisible = currString.value == "true" &&
|
||||
(!(abCD in this._acceptLanguages) || !this._acceptLanguages[abCD]);
|
||||
var li = new LanguageInfo(name, abCD, isVisible);
|
||||
this._availableLanguagesList.push(li);
|
||||
|
@ -101,22 +101,22 @@ var gLanguagesDialog = {
|
|||
}
|
||||
this._buildAvailableLanguageList();
|
||||
},
|
||||
|
||||
|
||||
_buildAvailableLanguageList: function ()
|
||||
{
|
||||
var availableLanguagesPopup = document.getElementById("availableLanguagesPopup");
|
||||
while (availableLanguagesPopup.hasChildNodes())
|
||||
availableLanguagesPopup.removeChild(availableLanguagesPopup.firstChild);
|
||||
|
||||
|
||||
// Sort the list of languages by name
|
||||
this._availableLanguagesList.sort(function (a, b) {
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
|
||||
|
||||
// Load the UI with the data
|
||||
for (var i = 0; i < this._availableLanguagesList.length; ++i) {
|
||||
var abCD = this._availableLanguagesList[i].abcd;
|
||||
if (this._availableLanguagesList[i].isVisible &&
|
||||
if (this._availableLanguagesList[i].isVisible &&
|
||||
(!(abCD in this._acceptLanguages) || !this._acceptLanguages[abCD])) {
|
||||
var menuitem = document.createElement("menuitem");
|
||||
menuitem.id = this._availableLanguagesList[i].abcd;
|
||||
|
@ -125,15 +125,15 @@ var gLanguagesDialog = {
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
readAcceptLanguages: function ()
|
||||
{
|
||||
while (this._activeLanguages.hasChildNodes())
|
||||
this._activeLanguages.removeChild(this._activeLanguages.firstChild);
|
||||
|
||||
|
||||
var selectedIndex = 0;
|
||||
var preference = document.getElementById("intl.accept_languages");
|
||||
if (preference.value == "")
|
||||
if (preference.value == "")
|
||||
return undefined;
|
||||
var languages = preference.value.toLowerCase().split(/\s*,\s*/);
|
||||
for (var i = 0; i < languages.length; ++i) {
|
||||
|
@ -148,7 +148,7 @@ var gLanguagesDialog = {
|
|||
listitem.setAttribute("label", name);
|
||||
|
||||
// Hash this language as an "Active" language so we don't
|
||||
// show it in the list that can be added.
|
||||
// show it in the list that can be added.
|
||||
this._acceptLanguages[languages[i]] = true;
|
||||
}
|
||||
|
||||
|
@ -159,135 +159,135 @@ var gLanguagesDialog = {
|
|||
|
||||
return undefined;
|
||||
},
|
||||
|
||||
|
||||
writeAcceptLanguages: function ()
|
||||
{
|
||||
return undefined;
|
||||
},
|
||||
|
||||
|
||||
onAvailableLanguageSelect: function ()
|
||||
{
|
||||
var addButton = document.getElementById("addButton");
|
||||
addButton.disabled = false;
|
||||
|
||||
|
||||
this._availableLanguages.removeAttribute("accesskey");
|
||||
},
|
||||
|
||||
|
||||
addLanguage: function ()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
this._selectedItemID = selectedID;
|
||||
|
||||
if (preference.value == "")
|
||||
if (preference.value == "")
|
||||
preference.value = selectedID;
|
||||
else {
|
||||
arrayOfPrefs.unshift(selectedID);
|
||||
preference.value = arrayOfPrefs.join(",");
|
||||
}
|
||||
|
||||
|
||||
this._acceptLanguages[selectedID] = true;
|
||||
this._availableLanguages.selectedItem = null;
|
||||
|
||||
|
||||
// Rebuild the available list with the added item removed...
|
||||
this._buildAvailableLanguageList();
|
||||
|
||||
this._buildAvailableLanguageList();
|
||||
|
||||
this._availableLanguages.setAttribute("label", this._availableLanguages.getAttribute("label2"));
|
||||
},
|
||||
|
||||
|
||||
removeLanguage: function ()
|
||||
{
|
||||
// Build the new preference value string.
|
||||
var languagesArray = [];
|
||||
for (var i = 0; i < this._activeLanguages.childNodes.length; ++i) {
|
||||
var item = this._activeLanguages.childNodes[i];
|
||||
if (!item.selected)
|
||||
if (!item.selected)
|
||||
languagesArray.push(item.id);
|
||||
else
|
||||
else
|
||||
this._acceptLanguages[item.id] = false;
|
||||
}
|
||||
var string = languagesArray.join(",");
|
||||
|
||||
// Get the item to select after the remove operation completes.
|
||||
// Get the item to select after the remove operation completes.
|
||||
var selection = this._activeLanguages.selectedItems;
|
||||
var lastSelected = selection[selection.length-1];
|
||||
var selectItem = lastSelected.nextSibling || lastSelected.previousSibling;
|
||||
selectItem = selectItem ? selectItem.id : null;
|
||||
|
||||
|
||||
this._selectedItemID = selectItem;
|
||||
|
||||
// Update the preference and force a UI rebuild
|
||||
var preference = document.getElementById("intl.accept_languages");
|
||||
preference.value = string;
|
||||
|
||||
this._buildAvailableLanguageList();
|
||||
this._buildAvailableLanguageList();
|
||||
},
|
||||
|
||||
|
||||
_getLanguageName: function (aABCD)
|
||||
{
|
||||
if (!this._availableLanguagesList.length)
|
||||
this._loadAvailableLanguages();
|
||||
for (var i = 0; i < this._availableLanguagesList.length; ++i) {
|
||||
if (aABCD == this._availableLanguagesList[i].abcd)
|
||||
if (aABCD == this._availableLanguagesList[i].abcd)
|
||||
return this._availableLanguagesList[i].name;
|
||||
}
|
||||
return "";
|
||||
},
|
||||
|
||||
|
||||
moveUp: function ()
|
||||
{
|
||||
var selectedItem = this._activeLanguages.selectedItems[0];
|
||||
var previousItem = selectedItem.previousSibling;
|
||||
|
||||
|
||||
var string = "";
|
||||
for (var i = 0; i < this._activeLanguages.childNodes.length; ++i) {
|
||||
var item = this._activeLanguages.childNodes[i];
|
||||
string += (i == 0 ? "" : ",");
|
||||
if (item.id == previousItem.id)
|
||||
if (item.id == previousItem.id)
|
||||
string += selectedItem.id;
|
||||
else if (item.id == selectedItem.id)
|
||||
string += previousItem.id;
|
||||
else
|
||||
string += item.id;
|
||||
}
|
||||
|
||||
|
||||
this._selectedItemID = selectedItem.id;
|
||||
|
||||
// Update the preference and force a UI rebuild
|
||||
var preference = document.getElementById("intl.accept_languages");
|
||||
preference.value = string;
|
||||
},
|
||||
|
||||
|
||||
moveDown: function ()
|
||||
{
|
||||
var selectedItem = this._activeLanguages.selectedItems[0];
|
||||
var nextItem = selectedItem.nextSibling;
|
||||
|
||||
|
||||
var string = "";
|
||||
for (var i = 0; i < this._activeLanguages.childNodes.length; ++i) {
|
||||
var item = this._activeLanguages.childNodes[i];
|
||||
string += (i == 0 ? "" : ",");
|
||||
if (item.id == nextItem.id)
|
||||
if (item.id == nextItem.id)
|
||||
string += selectedItem.id;
|
||||
else if (item.id == selectedItem.id)
|
||||
string += nextItem.id;
|
||||
else
|
||||
string += item.id;
|
||||
}
|
||||
|
||||
|
||||
this._selectedItemID = selectedItem.id;
|
||||
|
||||
// Update the preference and force a UI rebuild
|
||||
var preference = document.getElementById("intl.accept_languages");
|
||||
preference.value = string;
|
||||
},
|
||||
|
||||
|
||||
onLanguageSelect: function ()
|
||||
{
|
||||
var upButton = document.getElementById("up");
|
||||
|
|
|
@ -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: "",
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
|
||||
/**
|
||||
* SelectBookmarkDialog controls the user interface for the "Use Bookmark for
|
||||
* Home Page" dialog.
|
||||
*
|
||||
* Home Page" dialog.
|
||||
*
|
||||
* The caller (gMainPane.setHomePageToBookmark in main.js) invokes this dialog
|
||||
* with a single argument - a reference to an object with a .urls property and
|
||||
* a .names property. This dialog is responsible for updating the contents of
|
||||
* the .urls property with an array of URLs to use as home pages and for
|
||||
* updating the .names property with an array of names for those URLs before it
|
||||
* closes.
|
||||
*/
|
||||
*/
|
||||
var SelectBookmarkDialog = {
|
||||
init: function SBD_init() {
|
||||
document.getElementById("bookmarks").place =
|
||||
|
@ -23,9 +23,9 @@ var SelectBookmarkDialog = {
|
|||
this.selectionChanged();
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the disabled state of the OK button as the user changes the
|
||||
* selection within the view.
|
||||
/**
|
||||
* Update the disabled state of the OK button as the user changes the
|
||||
* selection within the view.
|
||||
*/
|
||||
selectionChanged: function SBD_selectionChanged() {
|
||||
var accept = document.documentElement.getButton("accept");
|
||||
|
|
|
@ -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',
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче