2005-02-25 09:07:58 +00:00
|
|
|
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2012-05-21 11:12:37 +00:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2005-02-25 09:07:58 +00:00
|
|
|
|
2008-02-26 21:13:17 +00:00
|
|
|
// Load DownloadUtils module for convertByteUnits
|
2008-02-27 18:00:15 +00:00
|
|
|
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
|
2012-05-31 14:28:01 +00:00
|
|
|
Components.utils.import("resource://gre/modules/ctypes.jsm");
|
2012-07-31 06:54:16 +00:00
|
|
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
2008-02-26 21:13:17 +00:00
|
|
|
|
2005-02-25 09:07:58 +00:00
|
|
|
var gAdvancedPane = {
|
|
|
|
_inited: false,
|
2006-07-05 22:41:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Brings the appropriate tab to the front and initializes various bits of UI.
|
|
|
|
*/
|
2005-02-25 09:07:58 +00:00
|
|
|
init: function ()
|
|
|
|
{
|
|
|
|
this._inited = true;
|
|
|
|
var advancedPrefs = document.getElementById("advancedPrefs");
|
2008-04-05 00:18:07 +00:00
|
|
|
|
|
|
|
var extraArgs = window.arguments[1];
|
|
|
|
if (extraArgs && extraArgs["advancedTab"]){
|
|
|
|
advancedPrefs.selectedTab = document.getElementById(extraArgs["advancedTab"]);
|
|
|
|
} else {
|
|
|
|
var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
|
2009-07-29 07:49:27 +00:00
|
|
|
if (preference.value !== null)
|
|
|
|
advancedPrefs.selectedIndex = preference.value;
|
2008-04-05 00:18:07 +00:00
|
|
|
}
|
|
|
|
|
2012-05-17 19:04:49 +00:00
|
|
|
#ifdef HAVE_SHELL_SERVICE
|
|
|
|
this.updateSetDefaultBrowser();
|
2012-09-21 14:05:24 +00:00
|
|
|
#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
|
2012-10-05 14:17:24 +00:00
|
|
|
// in case the default changes. On other Windows OS's defaults can also
|
|
|
|
// be set while the prefs are open.
|
|
|
|
window.setInterval(this.updateSetDefaultBrowser, 1000);
|
2013-06-12 14:31:09 +00:00
|
|
|
|
|
|
|
#ifdef MOZ_METRO
|
|
|
|
// Pre Windows 8, we should hide the update related settings
|
|
|
|
// for the Metro browser
|
|
|
|
let version = Components.classes["@mozilla.org/system-info;1"].
|
|
|
|
getService(Components.interfaces.nsIPropertyBag2).
|
|
|
|
getProperty("version");
|
|
|
|
let preWin8 = parseFloat(version) < 6.2;
|
|
|
|
this._showingWin8Prefs = !preWin8;
|
|
|
|
if (preWin8) {
|
|
|
|
["autoMetro", "autoMetroIndent"].forEach(
|
|
|
|
function(id) document.getElementById(id).collapsed = true
|
|
|
|
);
|
2013-06-20 03:19:17 +00:00
|
|
|
} else {
|
|
|
|
let brandShortName =
|
|
|
|
document.getElementById("bundleBrand").getString("brandShortName");
|
|
|
|
let bundlePrefs = document.getElementById("bundlePreferences");
|
|
|
|
let autoDesktop = document.getElementById("autoDesktop");
|
|
|
|
autoDesktop.label =
|
|
|
|
bundlePrefs.getFormattedString("updateAutoDesktop.label",
|
|
|
|
[brandShortName]);
|
|
|
|
autoDesktop.accessKey =
|
|
|
|
bundlePrefs.getString("updateAutoDesktop.accessKey");
|
2013-06-12 14:31:09 +00:00
|
|
|
}
|
|
|
|
#endif
|
2012-09-21 14:05:24 +00:00
|
|
|
#endif
|
2012-05-17 19:04:49 +00:00
|
|
|
#endif
|
2012-09-21 14:05:24 +00:00
|
|
|
|
2008-11-26 08:45:24 +00:00
|
|
|
#ifdef MOZ_UPDATER
|
2011-10-13 20:01:58 +00:00
|
|
|
this.updateReadPrefs();
|
2008-11-26 08:45:24 +00:00
|
|
|
#endif
|
2008-01-23 02:10:50 +00:00
|
|
|
this.updateOfflineApps();
|
2010-02-10 01:05:31 +00:00
|
|
|
#ifdef MOZ_CRASHREPORTER
|
|
|
|
this.initSubmitCrashes();
|
2012-12-08 17:41:23 +00:00
|
|
|
#endif
|
|
|
|
this.initTelemetry();
|
2013-01-04 04:45:15 +00:00
|
|
|
#ifdef MOZ_SERVICES_HEALTHREPORT
|
|
|
|
this.initSubmitHealthReport();
|
2010-02-10 01:05:31 +00:00
|
|
|
#endif
|
2013-01-04 04:45:15 +00:00
|
|
|
|
2011-12-16 22:36:09 +00:00
|
|
|
this.updateActualCacheSize("disk");
|
|
|
|
this.updateActualCacheSize("offline");
|
2012-07-31 06:54:16 +00:00
|
|
|
|
|
|
|
// Notify observers that the UI is now ready
|
|
|
|
Services.obs.notifyObservers(window, "advanced-pane-loaded", null);
|
2005-02-25 09:07:58 +00:00
|
|
|
},
|
2006-07-05 22:41:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Stores the identity of the current tab in preferences so that the selected
|
|
|
|
* tab can be persisted between openings of the preferences window.
|
|
|
|
*/
|
2005-02-25 09:07:58 +00:00
|
|
|
tabSelectionChanged: function ()
|
|
|
|
{
|
|
|
|
if (!this._inited)
|
|
|
|
return;
|
|
|
|
var advancedPrefs = document.getElementById("advancedPrefs");
|
|
|
|
var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
|
|
|
|
preference.valueFromPreferences = advancedPrefs.selectedIndex;
|
|
|
|
},
|
2012-05-31 14:28:01 +00:00
|
|
|
|
2006-07-05 22:41:03 +00:00
|
|
|
// GENERAL TAB
|
2005-02-25 09:07:58 +00:00
|
|
|
|
2006-07-05 22:41:03 +00:00
|
|
|
/*
|
|
|
|
* Preferences:
|
|
|
|
*
|
|
|
|
* accessibility.browsewithcaret
|
|
|
|
* - true enables keyboard navigation and selection within web pages using a
|
|
|
|
* visible caret, false uses normal keyboard navigation with no caret
|
|
|
|
* accessibility.typeaheadfind
|
|
|
|
* - when set to true, typing outside text areas and input boxes will
|
|
|
|
* automatically start searching for what's typed within the current
|
|
|
|
* document; when set to false, no search action happens
|
|
|
|
* general.autoScroll
|
|
|
|
* - when set to true, clicking the scroll wheel on the mouse activates a
|
|
|
|
* mouse mode where moving the mouse down scrolls the document downward with
|
|
|
|
* speed correlated with the distance of the cursor from the original
|
|
|
|
* position at which the click occurred (and likewise with movement upward);
|
|
|
|
* if false, this behavior is disabled
|
|
|
|
* general.smoothScroll
|
|
|
|
* - set to true to enable finer page scrolling than line-by-line on page-up,
|
|
|
|
* page-down, and other such page movements
|
2006-07-24 18:35:00 +00:00
|
|
|
* layout.spellcheckDefault
|
|
|
|
* - an integer:
|
|
|
|
* 0 disables spellchecking
|
|
|
|
* 1 enables spellchecking, but only for multiline text fields
|
|
|
|
* 2 enables spellchecking for all text fields
|
2006-07-05 22:41:03 +00:00
|
|
|
*/
|
|
|
|
|
2006-07-24 18:35:00 +00:00
|
|
|
/**
|
|
|
|
* Stores the original value of the spellchecking preference to enable proper
|
|
|
|
* restoration if unchanged (since we're mapping a tristate onto a checkbox).
|
|
|
|
*/
|
|
|
|
_storedSpellCheck: 0,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if any spellchecking is enabled and false otherwise, caching
|
|
|
|
* the current value to enable proper pref restoration if the checkbox is
|
|
|
|
* never changed.
|
|
|
|
*/
|
|
|
|
readCheckSpelling: function ()
|
|
|
|
{
|
|
|
|
var pref = document.getElementById("layout.spellcheckDefault");
|
|
|
|
this._storedSpellCheck = pref.value;
|
|
|
|
|
|
|
|
return (pref.value != 0);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the value of the spellchecking preference represented by UI,
|
|
|
|
* preserving the preference's "hidden" value if the preference is
|
|
|
|
* unchanged and represents a value not strictly allowed in UI.
|
|
|
|
*/
|
|
|
|
writeCheckSpelling: function ()
|
|
|
|
{
|
|
|
|
var checkbox = document.getElementById("checkSpelling");
|
|
|
|
return checkbox.checked ? (this._storedSpellCheck == 2 ? 2 : 1) : 0;
|
|
|
|
},
|
|
|
|
|
2013-01-04 04:45:15 +00:00
|
|
|
/**
|
|
|
|
* When the user toggles the layers.acceleration.disabled pref,
|
|
|
|
* sync its new value to the gfx.direct2d.disabled pref too.
|
|
|
|
*/
|
|
|
|
updateHardwareAcceleration: function()
|
|
|
|
{
|
|
|
|
#ifdef XP_WIN
|
|
|
|
var fromPref = document.getElementById("layers.acceleration.disabled");
|
|
|
|
var toPref = document.getElementById("gfx.direct2d.disabled");
|
|
|
|
toPref.value = fromPref.value;
|
|
|
|
#endif
|
|
|
|
},
|
|
|
|
|
|
|
|
// DATA CHOICES TAB
|
|
|
|
|
2013-05-06 15:05:46 +00:00
|
|
|
/**
|
|
|
|
* opening links behind a modal dialog is poor form. Work around flawed text-link handling here.
|
|
|
|
*/
|
|
|
|
openTextLink: function (evt) {
|
|
|
|
let where = Services.prefs.getBoolPref("browser.preferences.instantApply") ? "tab" : "window";
|
|
|
|
openUILinkIn(evt.target.getAttribute("href"), where);
|
|
|
|
evt.preventDefault();
|
|
|
|
},
|
|
|
|
|
2013-01-04 04:45:15 +00:00
|
|
|
/**
|
|
|
|
* Set up or hide the Learn More links for various data collection options
|
|
|
|
*/
|
|
|
|
_setupLearnMoreLink: function (pref, element) {
|
|
|
|
// set up the Learn More link with the correct URL
|
|
|
|
let url = Services.prefs.getCharPref(pref);
|
|
|
|
let el = document.getElementById(element);
|
|
|
|
|
|
|
|
if (url) {
|
|
|
|
el.setAttribute("href", url);
|
|
|
|
} else {
|
|
|
|
el.setAttribute("hidden", "true");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2010-02-10 01:05:31 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
initSubmitCrashes: function ()
|
|
|
|
{
|
|
|
|
var checkbox = document.getElementById("submitCrashesBox");
|
|
|
|
try {
|
|
|
|
var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"].
|
|
|
|
getService(Components.interfaces.nsICrashReporter);
|
|
|
|
checkbox.checked = cr.submitReports;
|
|
|
|
} catch (e) {
|
|
|
|
checkbox.style.display = "none";
|
|
|
|
}
|
2013-01-04 04:45:15 +00:00
|
|
|
this._setupLearnMoreLink("toolkit.crashreporter.infoURL", "crashReporterLearnMore");
|
2010-02-10 01:05:31 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
updateSubmitCrashes: function ()
|
|
|
|
{
|
|
|
|
var checkbox = document.getElementById("submitCrashesBox");
|
|
|
|
try {
|
|
|
|
var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"].
|
|
|
|
getService(Components.interfaces.nsICrashReporter);
|
|
|
|
cr.submitReports = checkbox.checked;
|
|
|
|
} catch (e) { }
|
|
|
|
},
|
|
|
|
|
2013-01-04 04:45:15 +00:00
|
|
|
|
2012-12-08 17:41:23 +00:00
|
|
|
/**
|
2013-01-15 20:38:01 +00:00
|
|
|
* The preference/checkbox is configured in XUL.
|
2013-01-04 04:45:15 +00:00
|
|
|
*
|
|
|
|
* In all cases, set up the Learn More link sanely
|
2012-12-08 17:41:23 +00:00
|
|
|
*/
|
|
|
|
initTelemetry: function ()
|
|
|
|
{
|
2013-01-04 04:45:15 +00:00
|
|
|
#ifdef MOZ_TELEMETRY_REPORTING
|
|
|
|
this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
|
|
|
|
#endif
|
|
|
|
},
|
2012-12-08 17:41:23 +00:00
|
|
|
|
2013-01-04 04:45:15 +00:00
|
|
|
#ifdef MOZ_SERVICES_HEALTHREPORT
|
2010-09-10 18:42:15 +00:00
|
|
|
/**
|
2013-01-04 04:45:15 +00:00
|
|
|
* Initialize the health report service reference and checkbox.
|
2010-09-10 18:42:15 +00:00
|
|
|
*/
|
2013-01-04 04:45:15 +00:00
|
|
|
initSubmitHealthReport: function () {
|
2013-01-11 23:33:57 +00:00
|
|
|
this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
|
2013-01-04 04:45:15 +00:00
|
|
|
|
2013-01-11 23:33:57 +00:00
|
|
|
let policy = Components.classes["@mozilla.org/datareporting/service;1"]
|
|
|
|
.getService(Components.interfaces.nsISupports)
|
|
|
|
.wrappedJSObject
|
|
|
|
.policy;
|
2013-01-04 04:45:15 +00:00
|
|
|
|
|
|
|
let checkbox = document.getElementById("submitHealthReportBox");
|
|
|
|
|
2013-07-02 16:55:34 +00:00
|
|
|
if (!policy || policy.healthReportUploadLocked) {
|
2013-01-04 04:45:15 +00:00
|
|
|
checkbox.setAttribute("disabled", "true");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-01-11 23:33:57 +00:00
|
|
|
checkbox.checked = policy.healthReportUploadEnabled;
|
2013-01-04 04:45:15 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the health report policy acceptance with state from checkbox.
|
|
|
|
*/
|
|
|
|
updateSubmitHealthReport: function () {
|
2013-01-11 23:33:57 +00:00
|
|
|
let policy = Components.classes["@mozilla.org/datareporting/service;1"]
|
|
|
|
.getService(Components.interfaces.nsISupports)
|
|
|
|
.wrappedJSObject
|
|
|
|
.policy;
|
2013-01-04 04:45:15 +00:00
|
|
|
|
2013-01-11 23:33:57 +00:00
|
|
|
if (!policy) {
|
2013-01-04 04:45:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
let checkbox = document.getElementById("submitHealthReportBox");
|
2013-02-05 21:12:28 +00:00
|
|
|
policy.recordHealthReportUploadEnabled(checkbox.checked,
|
|
|
|
"Checkbox from preferences pane");
|
2010-09-10 18:42:15 +00:00
|
|
|
},
|
2013-01-04 04:45:15 +00:00
|
|
|
#endif
|
2010-02-10 01:05:31 +00:00
|
|
|
|
2006-07-05 22:41:03 +00:00
|
|
|
// NETWORK TAB
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Preferences:
|
|
|
|
*
|
|
|
|
* browser.cache.disk.capacity
|
|
|
|
* - the size of the browser cache in KB
|
2010-09-22 21:33:54 +00:00
|
|
|
* - Only used if browser.cache.disk.smart_size.enabled is disabled
|
2006-07-05 22:41:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays a dialog in which proxy settings may be changed.
|
|
|
|
*/
|
|
|
|
showConnections: function ()
|
2005-02-25 09:07:58 +00:00
|
|
|
{
|
2006-07-05 22:41:03 +00:00
|
|
|
document.documentElement.openSubDialog("chrome://browser/content/preferences/connection.xul",
|
|
|
|
"", null);
|
2005-02-25 09:07:58 +00:00
|
|
|
},
|
2012-05-31 14:28:01 +00:00
|
|
|
|
2011-12-16 22:36:09 +00:00
|
|
|
// Retrieves the amount of space currently used by disk or offline cache
|
|
|
|
updateActualCacheSize: function (device)
|
2010-09-15 18:42:38 +00:00
|
|
|
{
|
|
|
|
var visitor = {
|
|
|
|
visitDevice: function (deviceID, deviceInfo)
|
|
|
|
{
|
2011-12-16 22:36:09 +00:00
|
|
|
if (deviceID == device) {
|
|
|
|
var actualSizeLabel = document.getElementById(device == "disk" ?
|
|
|
|
"actualDiskCacheSize" :
|
|
|
|
"actualAppCacheSize");
|
2010-09-15 18:42:38 +00:00
|
|
|
var sizeStrings = DownloadUtils.convertByteUnits(deviceInfo.totalSize);
|
|
|
|
var prefStrBundle = document.getElementById("bundlePreferences");
|
2011-12-16 22:36:09 +00:00
|
|
|
var sizeStr = prefStrBundle.getFormattedString(device == "disk" ?
|
|
|
|
"actualDiskCacheSize" :
|
|
|
|
"actualAppCacheSize",
|
|
|
|
sizeStrings);
|
2010-09-15 18:42:38 +00:00
|
|
|
actualSizeLabel.value = sizeStr;
|
|
|
|
}
|
|
|
|
// Do not enumerate entries
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
|
|
|
visitEntry: function (deviceID, entryInfo)
|
|
|
|
{
|
|
|
|
// Do not enumerate entries.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
2011-12-16 22:36:09 +00:00
|
|
|
|
2010-09-15 18:42:38 +00:00
|
|
|
var cacheService =
|
|
|
|
Components.classes["@mozilla.org/network/cache-service;1"]
|
|
|
|
.getService(Components.interfaces.nsICacheService);
|
|
|
|
cacheService.visitEntries(visitor);
|
|
|
|
},
|
2006-07-05 22:41:03 +00:00
|
|
|
|
2010-09-15 18:42:38 +00:00
|
|
|
updateCacheSizeUI: function (smartSizeEnabled)
|
|
|
|
{
|
|
|
|
document.getElementById("useCacheBefore").disabled = smartSizeEnabled;
|
|
|
|
document.getElementById("cacheSize").disabled = smartSizeEnabled;
|
|
|
|
document.getElementById("useCacheAfter").disabled = smartSizeEnabled;
|
|
|
|
},
|
|
|
|
|
|
|
|
readSmartSizeEnabled: function ()
|
|
|
|
{
|
2010-09-22 21:33:54 +00:00
|
|
|
// The smart_size.enabled preference element is inverted="true", so its
|
|
|
|
// value is the opposite of the actual pref value
|
|
|
|
var disabled = document.getElementById("browser.cache.disk.smart_size.enabled").value;
|
|
|
|
this.updateCacheSizeUI(!disabled);
|
2010-09-15 18:42:38 +00:00
|
|
|
},
|
2012-05-31 14:28:01 +00:00
|
|
|
|
2006-07-05 22:41:03 +00:00
|
|
|
/**
|
|
|
|
* Converts the cache size from units of KB to units of MB and returns that
|
|
|
|
* value.
|
|
|
|
*/
|
|
|
|
readCacheSize: function ()
|
2005-02-25 09:07:58 +00:00
|
|
|
{
|
2006-07-05 22:41:03 +00:00
|
|
|
var preference = document.getElementById("browser.cache.disk.capacity");
|
2008-10-12 15:33:36 +00:00
|
|
|
return preference.value / 1024;
|
2005-02-25 09:07:58 +00:00
|
|
|
},
|
2006-07-05 22:41:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Converts the cache size as specified in UI (in MB) to KB and returns that
|
|
|
|
* value.
|
|
|
|
*/
|
|
|
|
writeCacheSize: function ()
|
2005-02-25 09:07:58 +00:00
|
|
|
{
|
2006-07-05 22:41:03 +00:00
|
|
|
var cacheSize = document.getElementById("cacheSize");
|
|
|
|
var intValue = parseInt(cacheSize.value, 10);
|
2008-10-12 15:33:36 +00:00
|
|
|
return isNaN(intValue) ? 0 : intValue * 1024;
|
2005-02-25 09:07:58 +00:00
|
|
|
},
|
2005-06-28 18:56:40 +00:00
|
|
|
|
2006-09-13 06:56:34 +00:00
|
|
|
/**
|
|
|
|
* Clears the cache.
|
|
|
|
*/
|
|
|
|
clearCache: function ()
|
|
|
|
{
|
|
|
|
var cacheService = Components.classes["@mozilla.org/network/cache-service;1"]
|
2011-12-16 22:36:09 +00:00
|
|
|
.getService(Components.interfaces.nsICacheService);
|
2006-09-13 06:56:34 +00:00
|
|
|
try {
|
|
|
|
cacheService.evictEntries(Components.interfaces.nsICache.STORE_ANYWHERE);
|
|
|
|
} catch(ex) {}
|
2011-12-16 22:36:09 +00:00
|
|
|
this.updateActualCacheSize("disk");
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears the application cache.
|
|
|
|
*/
|
|
|
|
clearOfflineAppCache: function ()
|
|
|
|
{
|
|
|
|
Components.utils.import("resource:///modules/offlineAppCache.jsm");
|
|
|
|
OfflineAppCacheHelper.clear();
|
|
|
|
|
|
|
|
this.updateActualCacheSize("offline");
|
|
|
|
this.updateOfflineApps();
|
2006-09-13 06:56:34 +00:00
|
|
|
},
|
|
|
|
|
2008-02-22 06:34:15 +00:00
|
|
|
readOfflineNotify: function()
|
|
|
|
{
|
|
|
|
var pref = document.getElementById("browser.offline-apps.notify");
|
|
|
|
var button = document.getElementById("offlineNotifyExceptions");
|
|
|
|
button.disabled = !pref.value;
|
|
|
|
return pref.value;
|
|
|
|
},
|
|
|
|
|
|
|
|
showOfflineExceptions: function()
|
|
|
|
{
|
|
|
|
var bundlePreferences = document.getElementById("bundlePreferences");
|
|
|
|
var params = { blockVisible : false,
|
|
|
|
sessionVisible : false,
|
|
|
|
allowVisible : false,
|
|
|
|
prefilledHost : "",
|
|
|
|
permissionType : "offline-app",
|
2008-02-25 21:24:14 +00:00
|
|
|
manageCapability : Components.interfaces.nsIPermissionManager.DENY_ACTION,
|
2008-02-22 06:34:15 +00:00
|
|
|
windowTitle : bundlePreferences.getString("offlinepermissionstitle"),
|
|
|
|
introText : bundlePreferences.getString("offlinepermissionstext") };
|
|
|
|
document.documentElement.openWindow("Browser:Permissions",
|
|
|
|
"chrome://browser/content/preferences/permissions.xul",
|
|
|
|
"", params);
|
|
|
|
},
|
|
|
|
|
2008-03-28 21:26:42 +00:00
|
|
|
// XXX: duplicated in browser.js
|
2009-02-22 19:09:10 +00:00
|
|
|
_getOfflineAppUsage: function (host, groups)
|
2008-03-28 21:26:42 +00:00
|
|
|
{
|
2009-02-22 19:09:10 +00:00
|
|
|
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
|
|
|
|
getService(Components.interfaces.nsIApplicationCacheService);
|
2009-11-04 19:23:20 +00:00
|
|
|
if (!groups)
|
|
|
|
groups = cacheService.getGroups();
|
|
|
|
|
2009-02-22 19:09:10 +00:00
|
|
|
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
|
|
|
getService(Components.interfaces.nsIIOService);
|
|
|
|
|
2008-08-26 23:09:02 +00:00
|
|
|
var usage = 0;
|
2009-02-22 19:09:10 +00:00
|
|
|
for (var i = 0; i < groups.length; i++) {
|
|
|
|
var uri = ios.newURI(groups[i], null, null);
|
|
|
|
if (uri.asciiHost == host) {
|
|
|
|
var cache = cacheService.getActiveCache(groups[i]);
|
|
|
|
usage += cache.usage;
|
|
|
|
}
|
|
|
|
}
|
2008-03-28 21:26:42 +00:00
|
|
|
|
|
|
|
return usage;
|
|
|
|
},
|
|
|
|
|
2008-01-23 02:10:50 +00:00
|
|
|
/**
|
|
|
|
* Updates the list of offline applications
|
|
|
|
*/
|
|
|
|
updateOfflineApps: function ()
|
|
|
|
{
|
|
|
|
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
|
|
|
|
.getService(Components.interfaces.nsIPermissionManager);
|
|
|
|
|
|
|
|
var list = document.getElementById("offlineAppsList");
|
|
|
|
while (list.firstChild) {
|
|
|
|
list.removeChild(list.firstChild);
|
|
|
|
}
|
|
|
|
|
2009-02-22 19:09:10 +00:00
|
|
|
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
|
|
|
|
getService(Components.interfaces.nsIApplicationCacheService);
|
2009-11-04 19:23:20 +00:00
|
|
|
var groups = cacheService.getGroups();
|
2009-02-22 19:09:10 +00:00
|
|
|
|
2008-02-26 21:13:17 +00:00
|
|
|
var bundle = document.getElementById("bundlePreferences");
|
|
|
|
|
2008-01-23 02:10:50 +00:00
|
|
|
var enumerator = pm.enumerator;
|
|
|
|
while (enumerator.hasMoreElements()) {
|
|
|
|
var perm = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
|
|
|
|
if (perm.type == "offline-app" &&
|
|
|
|
perm.capability != Components.interfaces.nsIPermissionManager.DEFAULT_ACTION &&
|
|
|
|
perm.capability != Components.interfaces.nsIPermissionManager.DENY_ACTION) {
|
2008-01-31 23:50:54 +00:00
|
|
|
var row = document.createElement("listitem");
|
2008-01-23 02:10:50 +00:00
|
|
|
row.id = "";
|
2008-02-26 21:13:17 +00:00
|
|
|
row.className = "offlineapp";
|
|
|
|
row.setAttribute("host", perm.host);
|
|
|
|
var converted = DownloadUtils.
|
2009-02-22 19:09:10 +00:00
|
|
|
convertByteUnits(this._getOfflineAppUsage(perm.host, groups));
|
2008-02-26 21:13:17 +00:00
|
|
|
row.setAttribute("usage",
|
|
|
|
bundle.getFormattedString("offlineAppUsage",
|
|
|
|
converted));
|
2008-01-23 02:10:50 +00:00
|
|
|
list.appendChild(row);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
offlineAppSelected: function()
|
|
|
|
{
|
|
|
|
var removeButton = document.getElementById("offlineAppsListRemove");
|
|
|
|
var list = document.getElementById("offlineAppsList");
|
|
|
|
if (list.selectedItem) {
|
|
|
|
removeButton.setAttribute("disabled", "false");
|
|
|
|
} else {
|
|
|
|
removeButton.setAttribute("disabled", "true");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
removeOfflineApp: function()
|
|
|
|
{
|
|
|
|
var list = document.getElementById("offlineAppsList");
|
|
|
|
var item = list.selectedItem;
|
2008-02-26 21:13:17 +00:00
|
|
|
var host = item.getAttribute("host");
|
2008-01-23 02:10:50 +00:00
|
|
|
|
|
|
|
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
|
|
|
.getService(Components.interfaces.nsIPromptService);
|
|
|
|
var flags = prompts.BUTTON_TITLE_IS_STRING * prompts.BUTTON_POS_0 +
|
|
|
|
prompts.BUTTON_TITLE_CANCEL * prompts.BUTTON_POS_1;
|
|
|
|
|
|
|
|
var bundle = document.getElementById("bundlePreferences");
|
|
|
|
var title = bundle.getString("offlineAppRemoveTitle");
|
|
|
|
var prompt = bundle.getFormattedString("offlineAppRemovePrompt", [host]);
|
|
|
|
var confirm = bundle.getString("offlineAppRemoveConfirm");
|
|
|
|
var result = prompts.confirmEx(window, title, prompt, flags, confirm,
|
|
|
|
null, null, null, {});
|
|
|
|
if (result != 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// clear offline cache entries
|
2009-02-22 19:09:10 +00:00
|
|
|
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
|
|
|
|
getService(Components.interfaces.nsIApplicationCacheService);
|
|
|
|
var ios = Components.classes["@mozilla.org/network/io-service;1"].
|
|
|
|
getService(Components.interfaces.nsIIOService);
|
2009-11-04 19:23:20 +00:00
|
|
|
var groups = cacheService.getGroups();
|
2009-02-22 19:09:10 +00:00
|
|
|
for (var i = 0; i < groups.length; i++) {
|
|
|
|
var uri = ios.newURI(groups[i], null, null);
|
|
|
|
if (uri.asciiHost == host) {
|
|
|
|
var cache = cacheService.getActiveCache(groups[i]);
|
|
|
|
cache.discard();
|
|
|
|
}
|
|
|
|
}
|
2008-01-23 02:10:50 +00:00
|
|
|
|
|
|
|
// remove the permission
|
|
|
|
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
|
|
|
|
.getService(Components.interfaces.nsIPermissionManager);
|
|
|
|
pm.remove(host, "offline-app",
|
|
|
|
Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
|
|
|
|
pm.remove(host, "offline-app",
|
|
|
|
Components.interfaces.nsIOfflineCacheUpdateService.ALLOW_NO_WARN);
|
|
|
|
|
|
|
|
list.removeChild(item);
|
|
|
|
gAdvancedPane.offlineAppSelected();
|
2011-12-16 22:36:09 +00:00
|
|
|
this.updateActualCacheSize("offline");
|
2008-01-23 02:10:50 +00:00
|
|
|
},
|
|
|
|
|
2006-07-05 22:41:03 +00:00
|
|
|
// UPDATE TAB
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Preferences:
|
|
|
|
*
|
|
|
|
* app.update.enabled
|
|
|
|
* - true if updates to the application are enabled, false otherwise
|
|
|
|
* extensions.update.enabled
|
|
|
|
* - true if updates to extensions and themes are enabled, false otherwise
|
|
|
|
* browser.search.update
|
|
|
|
* - true if updates to search engines are enabled, false otherwise
|
|
|
|
* app.update.auto
|
|
|
|
* - true if updates should be automatically downloaded and installed,
|
|
|
|
* possibly with a warning if incompatible extensions are installed (see
|
|
|
|
* app.update.mode); false if the user should be asked what he wants to do
|
|
|
|
* when an update is available
|
|
|
|
* app.update.mode
|
|
|
|
* - an integer:
|
|
|
|
* 0 do not warn if an update will disable extensions or themes
|
|
|
|
* 1 warn if an update will disable extensions or themes
|
|
|
|
* 2 warn if an update will disable extensions or themes *or* if the
|
|
|
|
* update is a major update
|
|
|
|
*/
|
|
|
|
|
2011-10-13 20:01:58 +00:00
|
|
|
#ifdef MOZ_UPDATER
|
2005-08-02 05:27:14 +00:00
|
|
|
/**
|
2011-10-13 20:01:58 +00:00
|
|
|
* Selects the item of the radiogroup, and sets the warnIncompatible checkbox
|
|
|
|
* based on the pref values and locked states.
|
2006-07-05 22:41:03 +00:00
|
|
|
*
|
2005-08-02 05:27:14 +00:00
|
|
|
* UI state matrix for update preference conditions
|
2012-05-31 14:28:01 +00:00
|
|
|
*
|
2011-10-13 20:01:58 +00:00
|
|
|
* UI Components: Preferences
|
|
|
|
* Radiogroup i = app.update.enabled
|
|
|
|
* Warn before disabling extensions checkbox ii = app.update.auto
|
|
|
|
* iii = app.update.mode
|
|
|
|
*
|
|
|
|
* Disabled states:
|
|
|
|
* Element pref value locked disabled
|
|
|
|
* radiogroup i t/f f false
|
|
|
|
* i t/f *t* *true*
|
|
|
|
* ii t/f f false
|
|
|
|
* ii t/f *t* *true*
|
|
|
|
* iii 0/1/2 t/f false
|
|
|
|
* warnIncompatible i t f false
|
|
|
|
* i t *t* *true*
|
|
|
|
* i *f* t/f *true*
|
|
|
|
* ii t f false
|
|
|
|
* ii t *t* *true*
|
|
|
|
* ii *f* t/f *true*
|
|
|
|
* iii 0/1/2 f false
|
|
|
|
* iii 0/1/2 *t* *true*
|
2005-08-02 05:27:14 +00:00
|
|
|
*/
|
2011-10-13 20:01:58 +00:00
|
|
|
updateReadPrefs: function ()
|
2005-08-02 05:27:14 +00:00
|
|
|
{
|
|
|
|
var enabledPref = document.getElementById("app.update.enabled");
|
2011-10-13 20:01:58 +00:00
|
|
|
var autoPref = document.getElementById("app.update.auto");
|
2013-06-12 14:31:09 +00:00
|
|
|
#ifdef XP_WIN
|
|
|
|
#ifdef MOZ_METRO
|
|
|
|
var metroEnabledPref = document.getElementById("app.update.metro.enabled");
|
|
|
|
#endif
|
|
|
|
#endif
|
2011-10-13 20:01:58 +00:00
|
|
|
var radiogroup = document.getElementById("updateRadioGroup");
|
|
|
|
|
|
|
|
if (!enabledPref.value) // Don't care for autoPref.value in this case.
|
2013-06-12 14:31:09 +00:00
|
|
|
radiogroup.value="manual"; // 3. Never check for updates.
|
|
|
|
#ifdef XP_WIN
|
|
|
|
#ifdef MOZ_METRO
|
2013-06-12 14:31:09 +00:00
|
|
|
// enabledPref.value && autoPref.value && metroEnabledPref.value
|
|
|
|
else if (metroEnabledPref.value && this._showingWin8Prefs)
|
2013-06-12 14:31:09 +00:00
|
|
|
radiogroup.value="autoMetro"; // 0. Automatically install updates for both Metro and Desktop
|
|
|
|
#endif
|
|
|
|
#endif
|
2011-10-13 20:01:58 +00:00
|
|
|
else if (autoPref.value) // enabledPref.value && autoPref.value
|
2013-06-12 14:31:09 +00:00
|
|
|
radiogroup.value="auto"; // 1. Automatically install updates for Desktop only
|
2011-10-13 20:01:58 +00:00
|
|
|
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;
|
2005-09-14 15:26:13 +00:00
|
|
|
|
2011-10-13 20:01:58 +00:00
|
|
|
var modePref = document.getElementById("app.update.mode");
|
|
|
|
var warnIncompatible = document.getElementById("warnIncompatible");
|
|
|
|
// the warnIncompatible checkbox value is set by readAddonWarn
|
|
|
|
warnIncompatible.disabled = radiogroup.disabled || modePref.locked ||
|
|
|
|
!enabledPref.value || !autoPref.value;
|
2013-06-12 14:31:09 +00:00
|
|
|
#ifdef XP_WIN
|
|
|
|
#ifdef MOZ_METRO
|
2013-06-12 14:31:09 +00:00
|
|
|
if (this._showingWin8Prefs) {
|
|
|
|
warnIncompatible.disabled |= metroEnabledPref.value;
|
|
|
|
}
|
2013-06-12 14:31:09 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
2012-01-05 04:19:14 +00:00
|
|
|
|
|
|
|
#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 (installed != 1) {
|
|
|
|
document.getElementById("useService").hidden = true;
|
|
|
|
}
|
2012-05-31 14:28:01 +00:00
|
|
|
try {
|
|
|
|
const DRIVE_FIXED = 3;
|
|
|
|
const LPCWSTR = ctypes.jschar.ptr;
|
|
|
|
const UINT = ctypes.uint32_t;
|
|
|
|
let kernel32 = ctypes.open("kernel32");
|
|
|
|
let GetDriveType = kernel32.declare("GetDriveTypeW", ctypes.default_abi, UINT, LPCWSTR);
|
|
|
|
var UpdatesDir = Components.classes["@mozilla.org/updates/update-service;1"].
|
|
|
|
getService(Components.interfaces.nsIApplicationUpdateService);
|
|
|
|
let rootPath = UpdatesDir.getUpdatesDirectory();
|
|
|
|
while (rootPath.parent != null) {
|
|
|
|
rootPath = rootPath.parent;
|
|
|
|
}
|
|
|
|
if (GetDriveType(rootPath.path) != DRIVE_FIXED) {
|
|
|
|
document.getElementById("useService").hidden = true;
|
|
|
|
}
|
|
|
|
kernel32.close();
|
|
|
|
} catch(e) {
|
|
|
|
}
|
2012-01-05 04:19:14 +00:00
|
|
|
#endif
|
2005-02-25 09:07:58 +00:00
|
|
|
},
|
2006-07-05 22:41:03 +00:00
|
|
|
|
|
|
|
/**
|
2011-10-13 20:01:58 +00:00
|
|
|
* Sets the pref values based on the selected item of the radiogroup,
|
|
|
|
* and sets the disabled state of the warnIncompatible checkbox accordingly.
|
2006-07-05 22:41:03 +00:00
|
|
|
*/
|
2011-10-13 20:01:58 +00:00
|
|
|
updateWritePrefs: function ()
|
2005-02-25 09:07:58 +00:00
|
|
|
{
|
2005-08-02 05:27:14 +00:00
|
|
|
var enabledPref = document.getElementById("app.update.enabled");
|
|
|
|
var autoPref = document.getElementById("app.update.auto");
|
2013-06-12 14:31:09 +00:00
|
|
|
#ifdef XP_WIN
|
|
|
|
#ifdef MOZ_METRO
|
|
|
|
var metroEnabledPref = document.getElementById("app.update.metro.enabled");
|
2013-06-12 14:31:09 +00:00
|
|
|
// Initialize the pref to false only if we're showing the option
|
|
|
|
if (this._showingWin8Prefs) {
|
|
|
|
metroEnabledPref.value = false;
|
|
|
|
}
|
2013-06-12 14:31:09 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
2011-10-13 20:01:58 +00:00
|
|
|
var radiogroup = document.getElementById("updateRadioGroup");
|
|
|
|
switch (radiogroup.value) {
|
2013-06-12 14:31:09 +00:00
|
|
|
case "auto": // 1. Automatically install updates for Desktop only
|
|
|
|
enabledPref.value = true;
|
|
|
|
autoPref.value = true;
|
|
|
|
break;
|
|
|
|
#ifdef XP_WIN
|
|
|
|
#ifdef MOZ_METRO
|
|
|
|
case "autoMetro": // 0. Automatically install updates for both Metro and Desktop
|
2011-10-13 20:01:58 +00:00
|
|
|
enabledPref.value = true;
|
|
|
|
autoPref.value = true;
|
2013-06-12 14:31:09 +00:00
|
|
|
metroEnabledPref.value = true;
|
2011-10-13 20:01:58 +00:00
|
|
|
break;
|
2013-06-12 14:31:09 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
2011-10-13 20:01:58 +00:00
|
|
|
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;
|
|
|
|
}
|
2005-08-02 05:27:14 +00:00
|
|
|
|
|
|
|
var warnIncompatible = document.getElementById("warnIncompatible");
|
2011-10-13 20:01:58 +00:00
|
|
|
var modePref = document.getElementById("app.update.mode");
|
|
|
|
warnIncompatible.disabled = enabledPref.locked || !enabledPref.value ||
|
|
|
|
autoPref.locked || !autoPref.value ||
|
|
|
|
modePref.locked;
|
2013-06-12 14:31:09 +00:00
|
|
|
|
|
|
|
#ifdef XP_WIN
|
|
|
|
#ifdef MOZ_METRO
|
2013-06-12 14:31:09 +00:00
|
|
|
if (this._showingWin8Prefs) {
|
|
|
|
warnIncompatible.disabled |= metroEnabledPref.value;
|
|
|
|
}
|
2013-06-12 14:31:09 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
2005-08-02 05:27:14 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
2006-07-05 22:41:03 +00:00
|
|
|
* Stores the value of the app.update.mode preference, which is a tristate
|
|
|
|
* integer preference. We store the value here so that we can properly
|
|
|
|
* restore the preference value if the UI reflecting the preference value
|
|
|
|
* is in a state which can represent either of two integer values (as
|
|
|
|
* opposed to only one possible value in the other UI state).
|
|
|
|
*/
|
|
|
|
_modePreference: -1,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reads the app.update.mode preference and converts its value into a
|
|
|
|
* true/false value for use in determining whether the "Warn me if this will
|
|
|
|
* disable extensions or themes" checkbox is checked. We also save the value
|
|
|
|
* of the preference so that the preference value can be properly restored if
|
|
|
|
* the user's preferences cannot adequately be expressed by a single checkbox.
|
|
|
|
*
|
2011-10-13 20:01:58 +00:00
|
|
|
* app.update.mode Checkbox State Meaning
|
2005-08-02 05:27:14 +00:00
|
|
|
* 0 Unchecked Do not warn
|
|
|
|
* 1 Checked Warn if there are incompatibilities
|
|
|
|
* 2 Checked Warn if there are incompatibilities,
|
|
|
|
* or the update is major.
|
|
|
|
*/
|
2006-07-05 22:41:03 +00:00
|
|
|
readAddonWarn: function ()
|
2005-08-02 05:27:14 +00:00
|
|
|
{
|
|
|
|
var preference = document.getElementById("app.update.mode");
|
2011-10-13 20:01:58 +00:00
|
|
|
var warn = preference.value != 0;
|
|
|
|
gAdvancedPane._modePreference = warn ? preference.value : 1;
|
|
|
|
return warn;
|
2005-08-02 05:27:14 +00:00
|
|
|
},
|
2006-07-05 22:41:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Converts the state of the "Warn me if this will disable extensions or
|
|
|
|
* themes" checkbox into the integer preference which represents it,
|
|
|
|
* returning that value.
|
|
|
|
*/
|
|
|
|
writeAddonWarn: function ()
|
2005-08-02 05:27:14 +00:00
|
|
|
{
|
|
|
|
var warnIncompatible = document.getElementById("warnIncompatible");
|
|
|
|
return !warnIncompatible.checked ? 0 : gAdvancedPane._modePreference;
|
2005-02-25 09:07:58 +00:00
|
|
|
},
|
2006-07-05 22:41:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays the history of installed updates.
|
|
|
|
*/
|
2005-06-10 21:46:12 +00:00
|
|
|
showUpdates: function ()
|
|
|
|
{
|
|
|
|
var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
|
|
|
|
.createInstance(Components.interfaces.nsIUpdatePrompt);
|
2005-06-28 03:27:42 +00:00
|
|
|
prompter.showUpdateHistory(window);
|
2005-02-25 09:07:58 +00:00
|
|
|
},
|
2008-11-26 08:45:24 +00:00
|
|
|
#endif
|
|
|
|
|
2006-07-05 22:41:03 +00:00
|
|
|
// ENCRYPTION TAB
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Preferences:
|
|
|
|
*
|
|
|
|
* security.default_personal_cert
|
|
|
|
* - a string:
|
|
|
|
* "Select Automatically" select a certificate automatically when a site
|
|
|
|
* requests one
|
|
|
|
* "Ask Every Time" present a dialog to the user so he can select
|
|
|
|
* the certificate to use on a site which
|
|
|
|
* requests one
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays the user's certificates and associated options.
|
|
|
|
*/
|
|
|
|
showCertificates: function ()
|
2005-02-25 09:07:58 +00:00
|
|
|
{
|
2006-07-05 22:41:03 +00:00
|
|
|
document.documentElement.openWindow("mozilla:certmanager",
|
|
|
|
"chrome://pippki/content/certManager.xul",
|
2006-07-19 13:46:39 +00:00
|
|
|
"", null);
|
2006-05-31 00:57:50 +00:00
|
|
|
},
|
|
|
|
|
2006-07-05 22:41:03 +00:00
|
|
|
/**
|
|
|
|
* Displays a dialog in which OCSP preferences can be configured.
|
|
|
|
*/
|
|
|
|
showOCSP: function ()
|
|
|
|
{
|
|
|
|
document.documentElement.openSubDialog("chrome://mozapps/content/preferences/ocsp.xul",
|
2006-05-31 00:57:50 +00:00
|
|
|
"", null);
|
2006-05-25 20:04:32 +00:00
|
|
|
},
|
2006-07-05 22:41:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays a dialog from which the user can manage his security devices.
|
|
|
|
*/
|
|
|
|
showSecurityDevices: function ()
|
2006-05-25 20:04:32 +00:00
|
|
|
{
|
2006-07-05 22:41:03 +00:00
|
|
|
document.documentElement.openWindow("mozilla:devicemanager",
|
|
|
|
"chrome://pippki/content/device_manager.xul",
|
2006-07-19 13:46:39 +00:00
|
|
|
"", null);
|
2005-02-25 09:07:58 +00:00
|
|
|
}
|
2007-12-04 02:38:06 +00:00
|
|
|
#ifdef HAVE_SHELL_SERVICE
|
|
|
|
,
|
|
|
|
|
|
|
|
// SYSTEM DEFAULTS
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Preferences:
|
|
|
|
*
|
|
|
|
* browser.shell.checkDefault
|
|
|
|
* - true if a default-browser check (and prompt to make it so if necessary)
|
|
|
|
* occurs at startup, false otherwise
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2012-05-17 19:04:49 +00:00
|
|
|
* Show button for setting browser as default browser or information that
|
|
|
|
* browser is already the default browser.
|
2007-12-04 02:38:06 +00:00
|
|
|
*/
|
2012-05-17 19:04:49 +00:00
|
|
|
updateSetDefaultBrowser: function()
|
2007-12-04 02:38:06 +00:00
|
|
|
{
|
2012-07-31 06:54:16 +00:00
|
|
|
let shellSvc = getShellService();
|
|
|
|
let setDefaultPane = document.getElementById("setDefaultPane");
|
|
|
|
if (!shellSvc) {
|
|
|
|
setDefaultPane.hidden = true;
|
|
|
|
document.getElementById("alwaysCheckDefault").disabled = true;
|
|
|
|
return;
|
|
|
|
}
|
2012-09-21 14:05:24 +00:00
|
|
|
let selectedIndex =
|
|
|
|
shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
|
2012-07-31 06:54:16 +00:00
|
|
|
setDefaultPane.selectedIndex = selectedIndex;
|
2012-05-17 19:04:49 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set browser as the operating system default browser.
|
|
|
|
*/
|
|
|
|
setDefaultBrowser: function()
|
|
|
|
{
|
2012-07-31 06:54:16 +00:00
|
|
|
let shellSvc = getShellService();
|
|
|
|
if (!shellSvc)
|
|
|
|
return;
|
2012-05-17 19:04:49 +00:00
|
|
|
shellSvc.setDefaultBrowser(true, false);
|
2012-09-21 14:05:24 +00:00
|
|
|
let selectedIndex =
|
|
|
|
shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
|
|
|
|
document.getElementById("setDefaultPane").selectedIndex = selectedIndex;
|
2007-12-04 02:38:06 +00:00
|
|
|
}
|
|
|
|
#endif
|
2005-02-25 09:07:58 +00:00
|
|
|
};
|