Closed Bug 662162 Opened 15 years ago Closed 15 years ago

Create helper function for getting nsIPrefLocalizedString complexvalue prefs

Categories

(SeaMonkey :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
seamonkey2.4

People

(Reporter: iannbugzilla, Assigned: iannbugzilla)

References

Details

Attachments

(1 file, 1 obsolete file)

At the moment utilityOverlay.js has a helper function for getting nsISupportsString complexvalue prefs but not one for nsIPrefLocalizedString. This patch: * providers such a helper called GetLocalizedStringPref. * switches utilityOverlay to use it.
Attachment #537458 - Flags: review?(neil)
Comment on attachment 537458 [details] [diff] [review] utilityOverlay localized string patch Review of attachment 537458 [details] [diff] [review]: ----------------------------------------------------------------- (must try this Splinter stuff) ::: suite/common/utilityOverlay.js @@ +183,5 @@ > } catch (e) {} > return ""; > } > > +function GetLocalizedStringPref(aName) How about calling it getLocalizedUnicharPref(aPrefName, aDefVal) see: <http://mxr.mozilla.org/comm-central/source/mozilla/toolkit/obsolete/content/nsUserSettings.js#90> @@ +189,5 @@ > + try { > + return Services.prefs.getComplexValue(aName, > + Components.interfaces.nsIPrefLocalizedString).data; > + } catch (e) { > + Components.utils.reportError("Couldn't get " + aName + " pref: " + e); We should eventually migrate to log4moz so that we can set the logging level e.g. we can set debug off to turn off uninteresting messages such as these. @@ +1094,5 @@ > else if (ot.getAttribute('anonid') == 'getMeOutOfHereButton') { > // Redirect them to a known-functioning page, default start page > + var url = GetLocalizedStringPref("browser.startup.homepage"); > + if (!url) > + url = "about:blank"; var url = getLocalizedUnicharPref("browser.startup.homepage", "about:blank");
Changes since last version: * As suggested added a default value argument to helper which let some more code be simplified.
Attachment #537458 - Attachment is obsolete: true
Attachment #537458 - Flags: review?(neil)
Attachment #537473 - Flags: review?(neil)
Comment on attachment 537473 [details] [diff] [review] Revised utilityOverlay localized string patch [Checked in: Comment 4] >+ return aDefaultValue || null; Not sure we need to do this, I don't think we have any code that specifically distinguishes undefined from null, certainly the two callers don't.
Attachment #537473 - Flags: review?(neil) → review+
Comment on attachment 537473 [details] [diff] [review] Revised utilityOverlay localized string patch [Checked in: Comment 4] http://hg.mozilla.org/comm-central/rev/cc8f23d60452 with just return aDefaultValue;
Attachment #537473 - Attachment description: Revised utilityOverlay localized string patch → Revised utilityOverlay localized string patch [Checked in: Comment 4]
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.4
Depends on: 663629
Blocks: 664838
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: