Closed
Bug 218645
Opened 21 years ago
Closed 21 years ago
string bundles: use setcontenttype after ::open
Categories
(Core :: Internationalization, defect, P2)
Tracking
()
RESOLVED
FIXED
mozilla1.6alpha
People
(Reporter: Biesinger, Assigned: Biesinger)
Details
Attachments
(1 file)
1.35 KB,
patch
|
bzbarsky
:
review+
darin.moz
:
superreview+
|
Details | Diff | Splinter Review |
125 rv = NS_NewChannel(getter_AddRefs(channel), uri);
126 if (NS_FAILED(rv)) return rv;
127
128 nsCOMPtr<nsIInputStream> in;
129 rv = channel->Open(getter_AddRefs(in));
130 if (NS_FAILED(rv)) return rv;
131
132 // It's a string bundle. We know what MIME type it is!
133 channel->SetContentType(NS_LITERAL_CSTRING("text/plain"));
would it make more sense to do the SetContentType before the ->Open call?
![]() |
||
Comment 1•21 years ago
|
||
This was done this way on purpose -- this is not a hint but an override of
whatever type the channel may decide to return.
Assignee | ||
Comment 2•21 years ago
|
||
hm, but why does this code care about the content type at all, why doesn't it
just never call GetContentType?
![]() |
||
Comment 3•21 years ago
|
||
It never does. However, some channels will determine the content type eagerly
(i.e. no matter whether GetContentType is called). In particular, we were
hitting mime.types on Unix for every single stringbundle load before this code
was added.
Assignee | ||
Comment 4•21 years ago
|
||
yes, that is why I suspected the SetContentType should be before the Open.
Are you saying that content-type determination happens after ::Open is called?
![]() |
||
Comment 5•21 years ago
|
||
That's correct. Getting contentType before Open is called has undefined
behavior, per nsIChannel.
![]() |
||
Comment 6•21 years ago
|
||
Ah, ok. Now I remember what the deal was here -- we had no type hints when this
code was written, so I actually changed file channels to lazily determine the
content type in addition to adding this setcontenttype call.
Thinking about it more, I agree that we should setcontenttype before calling
open (and changing the comment to say "we expect it to be" instead of "is" at
the end). r=me for that change.
Assignee | ||
Comment 7•21 years ago
|
||
Assignee | ||
Comment 8•21 years ago
|
||
-> me
Assignee: smontagu → cbiesinger
Priority: -- → P2
Target Milestone: --- → mozilla1.6alpha
Assignee | ||
Updated•21 years ago
|
Attachment #131249 -
Flags: superreview?(darin)
Attachment #131249 -
Flags: review?(bz-vacation)
Assignee | ||
Updated•21 years ago
|
Status: NEW → ASSIGNED
![]() |
||
Comment 9•21 years ago
|
||
Comment on attachment 131249 [details] [diff] [review]
patch
r=bzbarsky
Attachment #131249 -
Flags: review?(bz-vacation) → review+
Comment 10•21 years ago
|
||
Comment on attachment 131249 [details] [diff] [review]
patch
looks good. sr=darin
Attachment #131249 -
Flags: superreview?(darin) → superreview+
Assignee | ||
Comment 11•21 years ago
|
||
Checking in intl/strres/src/nsStringBundle.cpp;
/cvsroot/mozilla/intl/strres/src/nsStringBundle.cpp,v <-- nsStringBundle.cpp
new revision: 1.139; previous revision: 1.138
done
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•