Closed Bug 336699 Opened 19 years ago Closed 19 years ago

[FIX]Use immutable uris in docshell and document if possible

Categories

(Core Graveyard :: Embedding: APIs, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(1 file, 2 obsolete files)

Patch coming up. I definitely want the nsDocShell::GetCurrentURI patch, but I kinda like the rest of it too... ;) As usual, naming suggestions are welcome. I added the nsINetUtil method because inlining that in a lot of places looked like a lot of code, but inlining the code to call it doesn't look like it's _all_ that much less. :(
Attached patch Proposed patch (obsolete) (deleted) — Splinter Review
Darin, I'll ask jst to sr and review the nsDocument changes, so just need your review on the netwerk and docshell bits.
Attachment #220884 - Flags: review?(darin)
Assignee: nobody → bzbarsky
QA Contact: bzbarsky → apis
Attached patch Patch I meant to post (obsolete) (deleted) — Splinter Review
Attachment #220884 - Attachment is obsolete: true
Attachment #220885 - Flags: review?(darin)
Attachment #220884 - Flags: review?(darin)
Comment on attachment 220885 [details] [diff] [review] Patch I meant to post >Index: netwerk/base/public/nsINetUtil.idl >+ /** >+ * Take aURI and produce an immutable version of it for the caller. If aURI >+ * is immutable this will be aURI itself; otherwise this will be a clone, >+ * marked immutable if possible. Passing null to this method is allowed; in >+ * that case it will return null. >+ */ >+ nsIURI makeURIImmutable(in nsIURI aURI); Another possible name: toImmutableURI ? "II" bugs me :) >Index: docshell/base/nsDocShell.cpp >+ mCurrentURI = NS_MakeURIImmutable(aURI); I think this method should be named differently. The name implies that it will succeed in making the URI immutable, but in reality it may not succeed. This means that you cannot assume that mCurrentURI is immutable, so you need to use NS_EnsureSafeToReturn when giving out a pointer to it. That's not very obvious from reading the code. Maybe a name change would help. NS_ToImmutableURIIfSupported? NS_MaybeMakeURIImmutable? Those names suck :( r=darin w/ hope for a better name
Attachment #220885 - Flags: review?(darin) → review+
Comment on attachment 220885 [details] [diff] [review] Patch I meant to post > Another possible name: toImmutableURI ? Sure. How about NS_TryToMakeImmutable for the other thing?
Attachment #220885 - Flags: superreview?(jst)
Yeah, I like that.
Blocks: 339822
Comment on attachment 220885 [details] [diff] [review] Patch I meant to post sr=jst
Attachment #220885 - Flags: superreview?(jst) → superreview+
Attachment #220885 - Attachment is obsolete: true
Fixed.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Depends on: 340081
Depends on: 387968
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: