Closed
Bug 109179
Opened 24 years ago
Closed 24 years ago
replace nsStdEscape with NS_EscapeURL
Categories
(Core :: XPCOM, defect, P3)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla0.9.9
People
(Reporter: darin.moz, Assigned: darin.moz)
References
Details
(Keywords: perf)
Attachments
(1 file, 5 obsolete files)
|
9.65 KB,
patch
|
dougt
:
review+
alecf
:
superreview+
|
Details | Diff | Splinter Review |
replace nsStdEscape with NS_EscapeURL to avoid buffer copy when escaping is not
necessary.
see:
http://lxr.mozilla.org/seamonkey/search?string=nsStdEscape
for example, the call to nsStdEscape in NS_MakeAbsoluteURLWithCharset should
definitely be converted to using NS_EscapeURL.
this bug depends on bug 103916, which adds NS_EscapeURL.
| Assignee | ||
Comment 1•24 years ago
|
||
-> 0.9.7
Comment 2•24 years ago
|
||
I will also look into this after the patch for bug 103916 lands.
| Assignee | ||
Comment 3•24 years ago
|
||
dp says that nsStdEscape is called 14,134 times at startup (in a 2 week old
build, which wouldn't include the patch for bug 103916). in that build,
nsStdEscape is .64% of main1, so fixing this bug may give us a significant
performance boost at startup.
Comment 4•24 years ago
|
||
dp should repeat his test with the new builds, we may have got most of the
nsStdEscape usage by the patch in 103916.
| Assignee | ||
Comment 5•24 years ago
|
||
true, but it just goes to show that all instances of nsStdEscape should be
replaced by NS_EscapeURL.
| Assignee | ||
Updated•24 years ago
|
Component: Layout → XPCOM
| Assignee | ||
Comment 6•24 years ago
|
||
this patch has only been tested on linux... i'll test on windows and mac before
and worry about OS/2 when i check in ;)
| Assignee | ||
Updated•24 years ago
|
Status: NEW → ASSIGNED
| Assignee | ||
Updated•24 years ago
|
Whiteboard: [patch needs testing on win/mac]
| Assignee | ||
Comment 7•24 years ago
|
||
Comment on attachment 60576 [details] [diff] [review]
v1.0 patch
forgot to fix up some calls to nsStdUnescape
Attachment #60576 -
Attachment is obsolete: true
| Assignee | ||
Updated•24 years ago
|
Whiteboard: [patch needs testing on win/mac] → [patch needs work]
| Assignee | ||
Comment 9•24 years ago
|
||
| Assignee | ||
Comment 10•24 years ago
|
||
andreas: can you review this latest patch? thx!
Comment 11•24 years ago
|
||
Comment on attachment 63946 [details] [diff] [review]
v1.1 patch - step 1: revise current URL escaping API
r=andreas.otte@debitel.net
Maybe it should be made more clear in nsEscape.h that esc_Forced is not a mask
for an url part but a special mask to force escaping.
Attachment #63946 -
Flags: review+
| Assignee | ||
Comment 12•24 years ago
|
||
agreed... i'll update the patch.
Comment 13•24 years ago
|
||
Comment on attachment 63946 [details] [diff] [review]
v1.1 patch - step 1: revise current URL escaping API
I'm a little worried that NS_EscapeURLPart no longer truncates its "result" -
though it seems intentional. Do we think its worth a potentially confusing
semantic change just to optimize the few callers who might want this appending
behavior?
Assuming there are good reasons for all of this (But let's put them in the bug
for good measure)
sr=alecf
A side suggestion: there isn't really an Adopt() for nsAString, but seems like
you're placing an extra burden on the caller to check the resulting value to
determine which output to use....
what if you made a
NS_Escape(const char *str, PRInt32 len, PRInt16 mask, nsSharableString&
result);
which wrapped the other NS_Escape, and did an Adopt() to take ownership.. I
dunno. CC'ing jag for suggestions
Attachment #63946 -
Flags: superreview+
Comment 14•24 years ago
|
||
cc'ing jag and dbaron for string usage questions.
| Assignee | ||
Comment 15•24 years ago
|
||
alecf: that API would require that nsCAutoString support sharing, which it
currently does not. otherwise, we'd suffer a performance loss in the current
world. and, Adopt takes a |char *| not a |const char *|, so it wouldn't be
useful here.
the API i came up with for NS_EscapeURLPart is meant to be a low-level utility
function. it doesn't do anymore work then necessary. i can certainly imagine
layering other functions on top of NS_EscapeURLPart, but i think the function
itself should stay as it is... very basic.
Not quite sure exactly what the string questions were (if any are left), but
please spell deprecated correctly. :-)
Comment 17•24 years ago
|
||
ok, cool :)
sr=alecf still stands of course
| Assignee | ||
Updated•24 years ago
|
| Assignee | ||
Comment 18•24 years ago
|
||
checked in v1.1 patch (solving the first part of this bug)
| Assignee | ||
Comment 19•24 years ago
|
||
| Assignee | ||
Comment 20•24 years ago
|
||
Comment on attachment 63946 [details] [diff] [review]
v1.1 patch - step 1: revise current URL escaping API
marking obsolete since this has been checked in.
Attachment #63946 -
Attachment is obsolete: true
| Assignee | ||
Updated•24 years ago
|
Keywords: mozilla0.9.8
| Assignee | ||
Updated•24 years ago
|
Whiteboard: [ready to land part 1]
Comment 21•24 years ago
|
||
Comment on attachment 64613 [details] [diff] [review]
patch to replace nsStdEscape w/ NS_EscapeURLPart in nsIOServiceXXX
leave the OS2 commented #defines unless mike thinks that they should go.
r=dougt
Attachment #64613 -
Flags: review+
| Assignee | ||
Comment 22•24 years ago
|
||
mkaply: any problems with these changes to nsIOServiceOS2.cpp?
Comment 23•24 years ago
|
||
Looks good to me.
Go ahead and remove the commented out #ifdefs.
Comment 24•24 years ago
|
||
Comment on attachment 64613 [details] [diff] [review]
patch to replace nsStdEscape w/ NS_EscapeURLPart in nsIOServiceXXX
sr=alecf
Attachment #64613 -
Flags: superreview+
| Assignee | ||
Comment 25•24 years ago
|
||
will land this once the tree opens for mozilla 0.9.9
Target Milestone: mozilla0.9.8 → mozilla0.9.9
| Assignee | ||
Comment 26•24 years ago
|
||
so the mac portion of this patch had to be backed out and there was a regression
in the windows/os2 builds as a result of this (see bug 122027). i've got a
revised patch coming...
| Assignee | ||
Comment 27•24 years ago
|
||
tested this patch on the mac. the original patch was backed out on the mac
since it caused startup problems. i've verified that the new patch works. was
all due to the fact that file:// should have been file:/// :-/
Comment 28•24 years ago
|
||
Comment on attachment 66824 [details] [diff] [review]
patch - file:// should have been file:/// on mac, windows, and OS/2
r=gagan
Attachment #66824 -
Flags: review+
Comment 29•24 years ago
|
||
Comment on attachment 66824 [details] [diff] [review]
patch - file:// should have been file:/// on mac, windows, and OS/2
sr=waterson
Updated•24 years ago
|
Attachment #66824 -
Flags: superreview+
| Assignee | ||
Comment 30•24 years ago
|
||
patch checked in.
Comment 31•24 years ago
|
||
*** Bug 122043 has been marked as a duplicate of this bug. ***
| Assignee | ||
Comment 32•24 years ago
|
||
removes last reference to nsStdEscape
Attachment #64613 -
Attachment is obsolete: true
Attachment #66824 -
Attachment is obsolete: true
Comment 33•24 years ago
|
||
Comment on attachment 67603 [details] [diff] [review]
final patch
sr=alecf
nice cleanup too.
Attachment #67603 -
Flags: superreview+
| Assignee | ||
Comment 34•24 years ago
|
||
alecf: thx for the speedy review... i almost forgot that i should also be
replacing nsStdUnescape w/ NS_UnescapeURL :-/
Attachment #67603 -
Attachment is obsolete: true
| Assignee | ||
Comment 35•24 years ago
|
||
this latest patch also fixes a potential memory leak in FTP.
Comment 36•24 years ago
|
||
Comment on attachment 67628 [details] [diff] [review]
final nsStdEscape patch + removes all instances of nsStdUnescape
is there no auto string that we can use?
Is your indenting off a bit in nsMsgFolder.cpp?
Attachment #67628 -
Flags: review+
| Assignee | ||
Comment 37•24 years ago
|
||
nsMsgFolder uses tabs in place of spaces, but not uniformly. i plan to fix up
the indentation when i check this in.
auto string for what? if you are referring to the places where i capture a
char* and call nsMemory::Free explicitly, i think there is no appropriate string
class, because the call to NS_UnescapeURL changes the length of the string. it
inline decodes escape sequences, which always reduces the length of the string.
it just seems like a hack/overkill to use a string class for something like this.
nsXPIDLCString foo;
bar->GetFoo(getter_Copies(foo));
NS_UnescapeURL((char *) foo.get());
// now, foo.Length is potentially wrong
NS_SomeFunction(foo); // watch out!!
i'd worry about abusing string code just to avoid explicitly adding nsMemory::
Free calls to the code ;-)
Comment 38•24 years ago
|
||
Comment on attachment 67628 [details] [diff] [review]
final nsStdEscape patch + removes all instances of nsStdUnescape
yeah, const-casting is bad :) but I had a similar question while I was
reviewing - can you put some comments saying something to the effect of "using
raw pointer because we're modifying the string"?
sr=alecf with those patches
Attachment #67628 -
Flags: superreview+
| Assignee | ||
Comment 39•24 years ago
|
||
will do.
| Assignee | ||
Comment 40•24 years ago
|
||
marking FIXED :)
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
•