Closed Bug 481044 Opened 11 years ago Closed 5 years ago

FUEL fuelIPreferenceBranch.reset doesn't work


(Firefox :: General, defect)

Not set





(Reporter: jorgev, Unassigned)



(1 file)

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.
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.
OS: Mac OS X → All
Hardware: x86 → All
Version: 3.5 Branch → Trunk
Here's a quick patch to clear up the issue with Preference.reset throwing an exception back up to the user.
That patch looks fine, but it isn't really related to this bug (reset() throwing on PreferenceBranch objects).
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?
Closed: 5 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.