mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 861546 - Change Preferences.jsm so it does not need to guard against clearUserPref throwing. r=gavin, r=jaws
This commit is contained in:
parent
09583f13d6
commit
f1d5c0015d
@ -208,24 +208,7 @@ Preferences.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
this._reset(prefName);
|
||||
},
|
||||
|
||||
_reset: function(prefName) {
|
||||
try {
|
||||
this._prefSvc.clearUserPref(prefName);
|
||||
}
|
||||
catch(ex) {
|
||||
// The pref service throws NS_ERROR_UNEXPECTED when the caller tries
|
||||
// to reset a pref that doesn't exist or is already set to its default
|
||||
// value. This interface fails silently in those cases, so callers
|
||||
// can unconditionally reset a pref without having to check if it needs
|
||||
// resetting first or trap exceptions after the fact. It passes through
|
||||
// other exceptions, however, so callers know about them, since we don't
|
||||
// know what other exceptions might be thrown and what they might mean.
|
||||
if (ex.result != Cr.NS_ERROR_UNEXPECTED)
|
||||
throw ex;
|
||||
}
|
||||
this._prefSvc.clearUserPref(prefName);
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user