Closed Bug 243213 Opened 21 years ago Closed 21 years ago

Don't waste time/space with a per-docshell reference to the nsIURIFixup service.

Categories

(Core :: DOM: Navigation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jst, Assigned: adamlock)

Details

Attachments

(1 file)

For every docshell we create (2 per window, generally) we end up looking up the nsIURIFixup service only to store it in a docshell member when we could just keep a single static member reference to it. Patch coming up.
... and also move some members around to save a bit of memory on some 64-bit platforms.
Attachment #148128 - Flags: superreview?(darin)
Attachment #148128 - Flags: review?(bzbarsky)
Comment on attachment 148128 [details] [diff] [review] Make nsDocShell::mURIFixup a static member. >Index: docshell/base/nsDocShell.cpp >+ if (gDocShellCount++ == 0) { Assert that sURIFixup is null here? r=bzbarsky, though it may be worthwhile to change that slew of PRPackedBools into a bitfield....
Attachment #148128 - Flags: review?(bzbarsky) → review+
Comment on attachment 148128 [details] [diff] [review] Make nsDocShell::mURIFixup a static member. sr=darin
Attachment #148128 - Flags: superreview?(darin) → superreview+
Assertion added. It might be worth making those PRPackedBool's into bitfields, yes, but I'll wipe that under the hopefully upcoming major nsDocShell cleanup carpet for now :-)
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
jst, looks like there is an oversight in the dangling |else| below. The first consumer will miss sURIFixup. Shouldn't it be: if (!sURIFixup) { ...create it } if (sURIFixup) { ...use it } ===================== + if (!sURIFixup) { + // No fixup service so try and create a URI and see what happens + nsAutoString uriString(aURI); + // Cleanup the empty spaces that might be on each end. + uriString.Trim(" "); + // Eliminate embedded newlines, which single-line text fields now allow: + uriString.StripChars("\r\n"); + NS_ENSURE_TRUE(!uriString.IsEmpty(), NS_ERROR_FAILURE); - rv = NS_NewURI(getter_AddRefs(uri), uriString); - } - } - if (mURIFixup) { + rv = NS_NewURI(getter_AddRefs(uri), uriString); + } else {
Um, looks right to me. Am I missing something obvious here?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: