Closed Bug 311015 Opened 19 years ago Closed 18 years ago

safe mode: add support for disabling all extensions

Categories

(Firefox :: General, defect, P2)

2.0 Branch
defect

Tracking

()

VERIFIED FIXED
Firefox 2 beta1

People

(Reporter: mconnor, Assigned: Gavin)

References

(Blocks 1 open bug)

Details

(Keywords: fixed1.8.1)

Attachments

(1 file, 1 obsolete file)

Spun off so I can resolve bug 304403.

Need a new EM method to disable all addons of all types, excepting app disabled
and app managed addons.
Unhide checkbox, and make it trigger this method.

Not going to happen for 1.5
Since it won't be supported for 1.5 we should hide this option during the first
safe-mode startup for 1.8. Further showings of that window don't include it.
are you sure that its ever visible?  its hidden="true" so I don't see how its
showing up at all.
(In reply to comment #2)
> are you sure that its ever visible?  its hidden="true" so I don't see how its
> showing up at all.

Yes, I saw that checkbox with my development profile which is still a bit older.
After a second restart it is not visible anymore. Also fresh profiles don't show
that checkbox. It seems that it was a conflict with older data in my profile. So
don't worry about.
Status: NEW → ASSIGNED
Flags: blocking-firefox2+
Target Milestone: --- → Firefox 2 beta1
Priority: -- → P2
Code to disable all extensions, locales, and plugins:

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);
btw: when I stated extensions, locales, and plugins I am referring to Extension Manager managed items of these types.
Assignee: mconnor → gavin.sharp
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
OS: Windows XP → All
Hardware: PC → All
Version: Trunk → 2.0 Branch
Blocks: 332859
The concerns regarding Extension Manager managed locales and plugins are resolved now on the trunk and should be resolved on the branch before this would be ready for checkin.
Attached patch patch (obsolete) — Splinter Review
I'm not sure that this does the right thing with locale packs and plugins, but this seems to work for extensions and the theme.
Attachment #223581 - Flags: superreview?(mconnor)
Attachment #223581 - Flags: review?(robert.bugzilla)
Whiteboard: [patch-r?]
Comment on attachment 223581 [details] [diff] [review]
patch

>Index: browser/base/content/safeMode.js
>===================================================================

>+  // Select the default theme
>+  const themePref = "general.skins.selectedSkin";
>+  var prefB = Components.classes["@mozilla.org/preferences-service;1"]
>+                        .getService(Components.interfaces.nsIPrefBranch);
>+  prefB.setCharPref(themePref, "classic/1.0");
>+}

Should use clearUserPref here.
(In reply to comment #8)
> Should use clearUserPref here.

Indeed, thanks!
Attachment #223581 - Attachment is obsolete: true
Attachment #223583 - Flags: superreview?(mconnor)
Attachment #223583 - Flags: review?(robert.bugzilla)
Attachment #223581 - Flags: superreview?(mconnor)
Attachment #223581 - Flags: review?(robert.bugzilla)
Comment on attachment 223583 [details] [diff] [review]
patch with Mano's suggestion

Looks fine and this does disable locales packs and plugins.

btw (not part of this bug): the ui for safe mode is a bit misleading. When you select the checkboxes for an operation and click continue in safe mode the operations are not performed.

Also, the try catch around the different operations performed seems to be a bit much. If any of these are prone to throwing it will prevent subsequent operations from being performed. Seems like either it should be removed or if some parts are prone to throwing then they should be addresses specifically.
Attachment #223583 - Flags: review?(robert.bugzilla) → review+
Comment on attachment 223583 [details] [diff] [review]
patch with Mano's suggestion

hmm, that try/catch is pretty bloaty.  Gavin, can you file a followup and break those into independent try/catch blocks?
Attachment #223583 - Flags: superreview?(mconnor)
Attachment #223583 - Flags: superreview+
Attachment #223583 - Flags: approval-branch-1.8.1+
Whiteboard: [patch-r?] → [checkin needed (1.8 branch)]
mozilla/browser/locales/en-US/chrome/browser/safeMode.dtd 	1.2
mozilla/browser/base/content/safeMode.js 	1.6
mozilla/browser/base/content/safeMode.xul 	1.5
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
mozilla/browser/locales/en-US/chrome/browser/safeMode.dtd 	1.1.2.1
mozilla/browser/base/content/safeMode.xul 	1.1.2.4
mozilla/browser/base/content/safeMode.js 	1.1.2.4
Keywords: fixed1.8.1
Whiteboard: [checkin needed (1.8 branch)]
Blocks: 286589
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: