Closed
Bug 46488
Opened 25 years ago
Closed 24 years ago
layout SetUserAgent initializes http
Categories
(Core :: Layout, defect, P1)
Tracking
()
VERIFIED
FIXED
mozilla0.9
People
(Reporter: warrensomebody, Assigned: alecf)
References
Details
(Keywords: arch, memory-leak, Whiteboard: fix in hand)
Attachments
(5 files)
2.32 KB,
patch
|
Details | Diff | Splinter Review | |
10.55 KB,
patch
|
Details | Diff | Splinter Review | |
14.20 KB,
patch
|
Details | Diff | Splinter Review | |
12.55 KB,
patch
|
Details | Diff | Splinter Review | |
10.50 KB,
patch
|
Details | Diff | Splinter Review |
Whenever layout gets initialized, the first thing it does is call SetUserAgent.
This loads up http and sets the product name to "gecko" and the version to a
date string. This has the unfortunate consequence of initializing http which
calls GetLocalizedUnicharPref (see bug 46487) which calls string bundle-> chrome
-> script security manager -> necko -> http (recursively re-entering it).
Jud and I discussed this tonight, and we think it would be better if gecko just
stored its name string ("gecko") and version/date in the prefs file. Then when
http starts up (presumably when the first http page is loaded), it just reads it
out of prefs. (I verified that removing the call to SetUserAgent does allow http
to be deferred until needed by an http web page.)
The tricky part here is getting the date string into the prefs file. This will
require some makefile creativity. I suggested making the make script compute the
date and append it to prefs.js after it copies it to dist. The one gotcha here
is that on unix this is a symlink. Maybe we can just copy this file instead of
symlink it.
Assignee | ||
Comment 1•25 years ago
|
||
there are other places to store such a string, I'm wondering if prefs is the
right place. prefs are kind of a per-profile type of thing, seems like something
like this might be better off in a string bundle...
Comment 2•25 years ago
|
||
I used to have all the UA components pulled from a string bundle, then moved it
to prefs for some reason :-/.
The getLocalizedUNicharPref() is called to retrieve the locale info only.
Since this string is not supposed to be modified by end users, it makes
sense to pull it via stringBundle.
Assignee | ||
Comment 4•25 years ago
|
||
wait, I should clarify tao's remark - the localized unichar prefs are meant to
be overridden if necessary. One example is the default homepage - for the
english distribution of mozilla, we distribute http://home.netscape.com/, but
for other languages we want a different, locale-specific homepage. In either
case, the user can override it.
Thanks to Alec for clarifying this up.
My prevous comment refers to the usage of getLocalizedXXX() in the HTTP code
only.
Updated•25 years ago
|
Whiteboard: [nsbeta3+]
Comment 6•25 years ago
|
||
I'm going to fix this to read from prefs. I'm not going to whack the build
scripts to modify the prefs.js file. who should own that?
Target Milestone: --- → M18
Assignee | ||
Comment 7•25 years ago
|
||
whacking the prefs file really seems like a bad idea.
Why is this in prefs? that's what I still don't understand.
Comment 8•25 years ago
|
||
I'm pretty sure we ditched the string bundle idea because it was bringing in a
nasty dependency.
What's the implication of this change?
1. the locale part of the U-A string is not localizable or
2. it is localizable but not switchable
Comment 10•25 years ago
|
||
It can be both localizable and switchable, it just shouldn't live in layout.
Reporter | ||
Comment 11•25 years ago
|
||
The reason we were going to make it a pref was because all the other parts of
the user agent string come from prefs. However, a string bundle might be a
better way to go. How about putting it in
netwerk/resources/locale/en-US/necko.properties? We'd still have to whack the
build system to insert the version number though. That shouldn't be so hard.
Comment 12•25 years ago
|
||
Yes, getting it from property file directory makes it both
localizable and switchable.
Updated•25 years ago
|
Priority: P3 → P1
Comment 13•25 years ago
|
||
PDT would like to see some explanation in this bug report about why it's a P1.
What bad experience does the user have? Or is this just code cleanup?
Whiteboard: [nsbeta3+] → [nsbeta3+][NEED INFO]
Comment 14•25 years ago
|
||
marking nsbeta3- as we will not hold PR3 for this.
Whiteboard: [nsbeta3+][NEED INFO] → [nsbeta3-][NEED INFO]
Comment 15•25 years ago
|
||
*** Bug 60583 has been marked as a duplicate of this bug. ***
Comment 16•25 years ago
|
||
This also causes a leak in the service manager, due to the recursive request for
the HTTP handler.
Keywords: mlk
Assignee | ||
Comment 17•25 years ago
|
||
taking from valeski - I have a related bug, I have a pretty good idea of what to
do.
Assignee: valeski → alecf
Assignee | ||
Comment 18•25 years ago
|
||
I've got a potential fix... I'm basically making an object in layout that is an
http startup listener (thanks shaver) - when it gets called, it sets these two
strings.
Status: NEW → ASSIGNED
Whiteboard: [nsbeta3-][NEED INFO]
Target Milestone: M18 → mozilla0.8
Comment 20•25 years ago
|
||
do you have a patch ready for review; hit me?
Assignee | ||
Comment 21•25 years ago
|
||
Assignee | ||
Comment 22•25 years ago
|
||
Assignee | ||
Comment 23•25 years ago
|
||
Ok, here's what's going on:
- in order for the startup listener to access the http protocol handler, I had
to make the startup listener routine call Observe() and pass in "this"
- in the observer, I set up the user agent.
looking for a reviewer/super reviewer from valeski/waterson.
Comment 24•25 years ago
|
||
at first blush "this" as aSubject seemed wierd. Should aSubject really be
"aContext" to imply XPCOM's equivelent of void*?
r=valeski
Comment 25•25 years ago
|
||
Looks good. Fix these, and sr=waterson:
- In nsHTTPHandler.h, follow parenthesizing conventions. (You add spaces.)
- In nsHTTPHandler.cpp, use NS_STATIC_CAST to get where you want. Using
those C-style casts (especially from void*) is going to screw you some
day.
- In the code you moved from nsLayoutModule to nsLayoutHTTPStartup.cpp,
review the string-fu in `Observe()'. You have some unused variables, and
you should be able to use NS_LITERAL_STRING() instead of
NS_ConvertUTF8toUCS2().
- #ifdef DEBUG_alecf your noisy printfs().
- Get someone to buddy you on the Mac.
Assignee | ||
Comment 26•25 years ago
|
||
- spacing conventions were just from moving existing bad spacing - but fixed.
- static cast stuff - I get ambiguous-casting errors if I don't use void*. I
switched to nested NS_STATIC_CAST anyway
- you can't use NS_LITERAL_STRING on #define'd strings.. so I'm fixing up the
#define's themselves (including the perl scripts that define the strings in the
first place)
- oops, didn't mean to leave in those printf's!
new patch forthcoming
Assignee | ||
Comment 27•25 years ago
|
||
Comment 28•25 years ago
|
||
Don't use `void*'. Cast to one of the base classes first; e.g.
NS_STATIC_CAST(nsISupports*, NS_STATIC_CAST(nsIHTTPHandler*, this))
Assignee | ||
Comment 29•25 years ago
|
||
ooohh.. thanks :)
done in my tree.
Comment 30•25 years ago
|
||
Hi, Alec:
In the proposad patch, I didn't see any refernence to the retrieval part of
locale info. Am I missing something?
thx
Assignee | ||
Comment 31•25 years ago
|
||
this was never designed to set the locale - this is the bit where gecko set's
the product name and version. I can only assume someone else sets the locale.
Comment 32•25 years ago
|
||
I see. Therefore, necko still has dependency on strres -> chrome ->...
I was confused with another bug..
Assignee | ||
Comment 33•25 years ago
|
||
moving "fix in hand" bugs to moz 0.9
Target Milestone: mozilla0.8 → mozilla0.9
Comment 35•25 years ago
|
||
Mass moving most of mozilla0.9 bugs to mozilla0.8.1
Target Milestone: mozilla0.9 → mozilla0.8.1
Assignee | ||
Comment 36•25 years ago
|
||
Alec, I think you should move the HTTP startup listener into content/build
because that is where we create the gbdate.h file. I am going to disable
exporting gbdate.h rsn.
Assignee | ||
Comment 38•25 years ago
|
||
actually, it's created in BOTH locations - are you disabling the one in
layout/build?
Heh, right... I have a patch ready to land that will remove gbdate stuff from
layout completely, and will stop exporting gbdate.h in content.
Assignee | ||
Comment 40•25 years ago
|
||
hekki - do you know when you'll be removing the extra gbdate.h? Because I would
really like to wait for that before I move everything over once and for all...
Whiteboard: fix in hand → fix in hand, waiting on gbdate.pl resolution
Landed yesterday, gbdate.pl|h now only in content/build.
Assignee | ||
Comment 42•25 years ago
|
||
Assignee | ||
Comment 43•25 years ago
|
||
ok and now for something completely different.
I've moved the patch over to content\build - I'll need a mac person to add
nsContentHTTPStartup to the .mcp file.
As for that gbdate.pl / gbdate.h dependancy... heikki? why is that only on if
the file doesn't already exist? because once I check this in, all depend builds
are going to break until we manually delete that file.
On the Mac, every time you build, gbdate.h is generated again. On Windows and
Linux it is only generated if it does not exist. The situation has not changed
after my checkin.
As to why it is so, I believe it is a matter of opinion. In my opinion the Mac
way is correct, we should generate it every time you compile (it is build date,
after all). jst wanted to keep it as is. I would not object if you changed it to
be generated every compile on Windows and Unix as well. On Unix it would require
some serious makefile hackery I guess...
I am thinking some people see gbdate as the *pull date*. Some even do depend
builds normally, and clobber only after they have pulled, so by looking at
gbdate they see when they pulled. But this is wrong, and obviously fragile.
Assignee | ||
Updated•25 years ago
|
Whiteboard: fix in hand, waiting on gbdate.pl resolution → fix in hand
Comment 45•25 years ago
|
||
Just applied latest patch on my powerbook, looks good. r=pchen if you need it
Comment 46•25 years ago
|
||
Tree is closed for 0.8.1, since I don't consider this fix critical for 0.8.1,
moving to 0.9
Target Milestone: mozilla0.8.1 → mozilla0.9
Assignee | ||
Comment 47•24 years ago
|
||
yay, fix finally in
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•