Closed Bug 264680 Opened 20 years ago Closed 3 years ago

Locking homepage causes getting default home page to fail

Categories

(Core :: Preferences: Backend, defect)

defect
Not set
major

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: iannbugzilla, Unassigned)

References

(Blocks 1 open bug)

Details

Using Build ID 2004101605 on WinXP SP2 If you set a lockPref for browser.startup.homepage it causes the following code from pref-navigator.js http://lxr.mozilla.org/seamonkey/source/xpfe/components/prefwindow/resources/content/pref-navigator.js#102 to fail: function getDefaultPage() { var prefService = Components.classes[PREFSERVICE_CONTRACTID] .getService(nsIPrefService); var pref = prefService.getDefaultBranch(null); return pref.getComplexValue("browser.startup.homepage", nsIPrefLocalizedString).data; } and gives the following error message in the JS console: Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIPrefBranch.getComplexValue]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://communicator/content/pref/pref-navigator.js :: getDefaultPage :: line 108" data: no]
Don't ask me why, but you cannot lock a localized pref to an arbitrary string, it needs to be a properties file references like the default pref is.
This is probably dupe of the bug #109932
(Filter "spam" on 'prefs-nobody-20080612'.)
Assignee: prefs → nobody
QA Contact: prefs
QA Contact: preferences → preferences-backend
I just verified that this still happens. The simplest way to recreate is to set pref("browser.startup.homepage", "http://www.yahoo.com"); in a new JS file in defaults\pref in Firefox. You'll get the error: Timestamp: 4/13/2012 10:29:34 AM Error: homePref.value is null Source File: chrome://browser/content/preferences/main.js Line: 63
So the issue is in this code: http://mxr.mozilla.org/mozilla-central/source/toolkit/content/widgets/preferences.xml#312 browser.startup.homepage is a wstring, but if you set it as a pref (which people do), this code fails. I think we should put a try catch around the code and use Components.interfaces.nsISupportsString if it fails. Thoughts?
QA Whiteboard: qa-not-actionable
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.