Closed Bug 18940 Opened 25 years ago Closed 25 years ago

browser.startup.homepage not read from all.js

Categories

(SeaMonkey :: General, defect, P3)

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: leaf, Assigned: sspitzer)

Details

Attachments

(3 files)

Changing the pref in mozilla/modules/libpref/src/init/all.js does not change the
default start page. Other prefs get read fine from all.js, however (like
general.startup.mail).
Status: NEW → ASSIGNED
Assignee: sspitzer → mozilla
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
It looks like the following to me: We have 2 functions reading the homepage:
<URL:http://lxr.mozilla.org/seamonkey/source/xpfe/browser/resources/content/navigator.js#544>
and
<URL:http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsGlobalWindow.cpp#1376>,
which uses
<URL:http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsGlobalWindow.h#50>.
Both 1. don't get the default pref (CopyDefaultCharPref) and 2. aren't used at
all.

The homepage is set at
<URL:http://lxr.mozilla.org/seamonkey/source/xpfe/browser/resources/content/navigator.js#447>
("var defaultURL = homebutton.getAttribute("defaultURL" );"), which uses
<URL:http://lxr.mozilla.org/seamonkey/source/xpfe/browser/resources/content/navigator.xul#298>,
which uses
<URL:http://lxr.mozilla.org/seamonkey/source/xpfe/browser/resources/locale/en-US/navigator.dtd#18>.

Trying to fix.
It's a quick and dirty hack (30 lines from another function in the file copied),
but WORKSFORME - not more.

Please test.
yes, someone added js that sets the pref from the dtd value!

that shit ain't cool.

I've got the fix, benb (mozilla@bucksch.org) is reviewing now.
Assignee: mozilla → sspitzer
Status: ASSIGNED → NEW
Component: libPref → Browser-General
we've got the fix, benb is reviewing now.

re-assign to me, add benb to the cc list, and change component from libPref to
browser-general.

also add davidm to the cc list.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Target Milestone: M12
fixed.  thanks to benb for the help.

the bug was caused by this:

we were setting the default home page in the dtd and making it an attribute of
the home button.  (why?)  this value is a pref and should be set in all.js

then, we'd get that attribute of the home page and set the default value of the
home page pref!

yikes.
What are you trying to do? First off I do not see what the code you are adding
is going to do. GetDefaultPref should not return a value that is more valid than
GetPref. None of this code has any performance impact so doing things like
caching had better be for other reasons. And finally there was a big long
meeting where it was decided that the default URL's for these prefs were to be
stored in DTD files. I assume you have permission to change this and that all
the reasons for storing it in the DTD file have either been addressed or are no
longer considered valid? If I have to deal with this again I will be distrubed.
If you have issues with storing url's in DTD files, selmers the man. I am just
following orders;)
the home page has been been stored in prefs since god knows when.

we store url for the throbber in the dtd, yes.

but home page is a pref.

the changes were two fold:

one, cache the pref service.
two, fix it so we don't set the homepage pref, instead we get if from the prefs.
I guess the big debate is should this url be put in the dtd or in the prefs?

I say prefs, since there is ui to change it, and you can't hook the pref ui to
change a dtd value.
Just to be absolutely clear. The question is where does the default value for
the pref comes from( all.js or some DTD file). As far as clients needing to
access the value they should be getting the pref  value.
Yes, the user pref was used and is used. But the default pref came from the DTD.
I have to agree with Seth here. It is a default for a user pref and default
prefs are the usual way to set them. Why should the homepage be an exception?

I might see some arguments for doing so, like I18n or "Client Customation" by
ISPs, but the simple fact, that leaf search half a week for the setting should
give enough reason to stay with default prefs.
CCK is the reason. I do not understand what your complaint about nsGlobalWindow
is? In the case where there is no preferences, what would you prefer the code to
do? return and error or load about:blank spring to mind but I don't consider
either of them better than just loading mozilla.org
the last bit of code that ben points out uses the same pref, and if we fail to
get that pref, we use a http://www.mozilla.org, cause its better than nothing.

keep in mind nsGlobalWindow::Home() may not be used anymore.  I need to look
into it..
Davidm,
> I do not understand what your complaint about nsGlobalWindow

I have a problem with doubled code. There should be only one function that
performs a certain task or maintainance will be hell.
What doubled code?  The stuff in nsGlobalWindow implements the JS window API.
Now if the browser code looks up the pref rather than doing
window.content.home() that should be fixed. Remember also that nsGlobalWindow is
part of Gecko and not the browser.
whoops, I removed the call to window.content.home().

I'll fix it now.
Seems like it is used by
<URL:http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsJSWindow.cpp#1401>
(nsGlobalWIndow is a nsIDOMWindow).
I look at the function closer and I don't see good solution to solve the
redundancy (nsGlobalWIndow::Home(), navigator.js/StartUp() and
navigator.js/BrowserHome() all try to figure out a Homepage).

Forget it :).
ok, now we are using window.content.home() again in navigator.js

no need to duplicate that code.
Status: RESOLVED → VERIFIED
verified
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: