Last Comment Bug 481044 - FUEL fuelIPreferenceBranch.reset doesn't work
: FUEL fuelIPreferenceBranch.reset doesn't work
Product: Firefox
Classification: Client Software
Component: General (show other bugs)
: Trunk
: All All
-- normal with 1 vote (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
Depends on:
  Show dependency treegraph
Reported: 2009-03-02 14:49 PST by Jorge Villalobos [:jorgev]
Modified: 2015-03-02 07:28 PST (History)
5 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

wraps the clearUserPref in a try / catch (802 bytes, patch)
2010-02-04 14:58 PST, Bryan Clark (DevTools PM) [:clarkbw]
no flags Details | Diff | Splinter Review

Description User image Jorge Villalobos [:jorgev] 2009-03-02 14:49:50 PST
Happens to me on Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b2) Gecko/20081201 Firefox/3.1b2. When I try to call this function, I get:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIPrefBranch.resetBranch]"  nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)"  location: "JS frame :: file:///Applications/Internet/ :: prefs_reset :: line 1010"  data: no]

Looking at the documentation, this looks about right, the component doesn't implement the reset call. But, considering that FUEL should fix these issues exactly, I would expect it to work around this limitation and reset the branch in some other way.
Comment 1 User image Bryan Clark (DevTools PM) [:clarkbw] 2010-02-03 14:25:31 PST
Just some notes about this as the problem still exists.  Changing the flags as well since this is all platforms and broken on Trunk.

= PreferenceBranch =
The function resetBranch was never implemented and so raises an error

STEELs PreferenceBranch.reset function calls resetBranch and that's the error you get in comment 0

= Preference =
You can however do a direct call to a pref

Because that uses the clearUserPref function

The gotcha is that if the pref doesn't exist or hasn't been modified (is default) means that clearUserPref will raise an error.

If this reset() function simply wrapped the clearUserPref call in a try / catch block extensions could call reset without having to worry about it.
Comment 2 User image Bryan Clark (DevTools PM) [:clarkbw] 2010-02-04 14:58:21 PST
Created attachment 425318 [details] [diff] [review]
wraps the clearUserPref in a try / catch

Here's a quick patch to clear up the issue with Preference.reset throwing an exception back up to the user.
Comment 3 User image :Gavin Sharp [email:] 2010-02-08 07:10:25 PST
That patch looks fine, but it isn't really related to this bug (reset() throwing on PreferenceBranch objects).
Comment 4 User image beamgeraet 2010-11-30 14:21:42 PST
From my point of view the following could fix the issue:
(javascript code as I am not so used to cpp)
function reset() {
  preferences = this.all;
  for (i=0; i<preferences.length; i++) {
    try {
    } catch () {}

What do you think?

Note You need to log in before you can comment on or make changes to this bug.