Bug 311015: add option to permanently disable all addons and revert to the default theme when launched in safe mode, r=mconnor, r=rob_strong

This commit is contained in:
gavin%gavinsharp.com 2006-05-29 15:29:37 +00:00
parent fd59bc9974
commit 1374a8498f
3 changed files with 22 additions and 4 deletions

View File

@ -64,6 +64,23 @@ function deleteLocalstore() {
localstoreFile.remove(false);
}
function disableAddons() {
// Disable addons
const nsIUpdateItem = Components.interfaces.nsIUpdateItem;
var em = Components.classes["@mozilla.org/extensions/manager;1"]
.getService(Components.interfaces.nsIExtensionManager);
var type = nsIUpdateItem.TYPE_EXTENSION + nsIUpdateItem.TYPE_LOCALE +
nsIUpdateItem.TYPE_PLUGIN;
var items = em.getItemList(type, { });
for (var i = 0; i < items.length; ++i)
em.disableItem(items[i].id);
// Select the default theme
var prefB = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefB.clearUserPref("general.skins.selectedSkin");
}
function onOK() {
try {
if (document.getElementById("resetUserPrefs").checked)
@ -72,6 +89,8 @@ function onOK() {
restoreDefaultBookmarks();
if (document.getElementById("resetToolbars").checked)
deleteLocalstore();
if (document.getElementById("disableAddons").checked)
disableAddons();
} catch(e) {
}
@ -83,4 +102,3 @@ function onCancel() {
.getService(Components.interfaces.nsIAppStartup);
appStartup.quit(appStartup.eForceQuit);
}

View File

@ -75,7 +75,7 @@
<label value="&safeModeDescription2.label;"/>
<vbox>
<checkbox id="disableThemes" label="&disableThemes.label;" accesskey="&disableThemes.accesskey;" hidden="true"/>
<checkbox id="disableAddons" label="&disableAddons.label;" accesskey="&disableAddons.accesskey;"/>
<checkbox id="resetToolbars" label="&resetToolbars.label;" accesskey="&resetToolbars.accesskey;"/>
<checkbox id="resetBookmarks" label="&resetBookmarks.label;" accesskey="&resetBookmarks.accesskey;"/>
<checkbox id="resetUserPrefs" label="&resetUserPrefs.label;" accesskey="&resetUserPrefs.accesskey;"/>

View File

@ -42,8 +42,8 @@
<!ENTITY safeModeDescription.label "&brandShortName; is now running in Safe Mode, which temporarily disables your custom settings, themes, and extensions.">
<!ENTITY safeModeDescription2.label "You can make some or all of these changes permanent:">
<!ENTITY disableThemes.label "Disable all themes and extensions">
<!ENTITY disableThemes.accesskey "D">
<!ENTITY disableAddons.label "Disable all add-ons">
<!ENTITY disableAddons.accesskey "D">
<!ENTITY resetToolbars.label "Reset toolbars and controls">
<!ENTITY resetToolbars.accesskey "R">