Closed Bug 109932 Opened 23 years ago Closed 17 years ago

pref locking on browser.startup.homepage broken

Categories

(Core :: Preferences: Backend, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 333049
mozilla1.0.1

People

(Reporter: smeredith, Assigned: bnesse)

References

(Blocks 1 open bug)

Details

If I use pref("browser.startup.homepage", "chrome://navigator-region/locale/region.properties"); the value in the chrome file is used for my homepage. However, if I use lockPref("browser.startup.homepage", "chrome://navigator-region/locale/region.properties"); then chrome://navigator-region/locale/region.properties is used as my homepage. It's not dereferenced.
-> prefs backend
Assignee: sgehani → bnesse
Component: Preferences → Preferences: Backend
Oddly enough this is basically a dupe of bug 109902 which has a lengthy discussion of things pertaining to LocalizedUnicharPrefs. To save myself from explaining this in 2 different bugs, adding the participants from that bug to the cc list because this is relevant. In a nutshell, LocalizedUnicharPrefs pull their defaults from a properties file. You change the default value by changing the properties file, not by setting a default preference value (which is what lockPref does). LocalizedUnicharPrefs work differently from other prefs in that when they are locked, they return a user value instead of a default value. This may or may not be the indended functionality, but that is how it was implemented. When a LocalizedUnicharPref is assigned a user value, the value is treated as a direct URL. What you are doing (via lockPref) is supplying a "default" value where one is not supposed to exist. Then, when you request the (non-existent) user value (because the preference is locked), the prefs falls back to the "default" value (which shouldn't exist) and returns it as a direct URL value because that's how it "thinks" it's supposed to work.
ack, that's not how that should be working. lockPref() should be setting a locked flag so that when I call PREF_CopyCharPref or some other internal routine, it automatically goes back to the default pref. Otherwise, this means I can override locked prefs just by modifying my all.js or something. So basically, no that was not the indented functionality...:)
Umm, well, lockPref does set a lock flag, which internally causes the functions such as PREF_CopyCharPref to return the default value. But with GetLocalizedUnicharPref there is no default value...
*** Bug 110902 has been marked as a duplicate of this bug. ***
Target Milestone: --- → mozilla1.0.1
QA Contact: sairuh → rvelasco
removed jhooker from cc: list
Sorry to dupe this forward, but the later bug has more info.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.