Closed Bug 1448330 Opened 2 years ago Closed 2 years ago

Make nsIURI.clone a private method

Categories

(Core :: Networking, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox61 --- wontfix
firefox62 --- fixed

People

(Reporter: valentin, Assigned: valentin)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

Since we don't need to clone URIs to prevent them from being changed, the clone method is a bit redundant. It should only be used by the mutators, so I propose that we make it private, and remove all other calls presently in the code.
Comment on attachment 8985327 [details]
Bug 1448330 - Make nsIURI.clone a private method

https://reviewboard.mozilla.org/r/250944/#review258042
Attachment #8985327 - Flags: review?(honzab.moz) → review+
Pushed by valentin.gosu@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/110e4b10e2ea
Make nsIURI.clone a private method r=mayhemer
https://hg.mozilla.org/mozilla-central/rev/110e4b10e2ea
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
That busted TB a bit :-( - What about cloneIgnoringRef() and cloneWithNewRef()?
Stuff like:
mailnews/addrbook/src/nsAddbookUrl.cpp
194 rv = m_baseURL->Clone(getter_AddRefs(clone->m_baseURL));
mailnews/compose/src/nsSmtpUrl.cpp
536 rv = m_baseURL->Clone(getter_AddRefs(clone->m_baseURL));
becomes impossible since the base URL doesn't offer the method any more :-(
(In reply to Jorg K (GMT+2) from comment #5)
> That busted TB a bit :-( - What about cloneIgnoringRef() and
> cloneWithNewRef()?

I'll remove them in a followup.

(In reply to Jorg K (GMT+2) from comment #6)
> Stuff like:
> mailnews/addrbook/src/nsAddbookUrl.cpp
> 194 rv = m_baseURL->Clone(getter_AddRefs(clone->m_baseURL));
> mailnews/compose/src/nsSmtpUrl.cpp
> 536 rv = m_baseURL->Clone(getter_AddRefs(clone->m_baseURL));
> becomes impossible since the base URL doesn't offer the method any more :-(

Cloning is unnecessary now (assuming nsIURI implementations are threadsafe/immutable) and you just need to copy the RefPtr.
Otherwise, mutate + finalize achieves the same as clone (as you already noticed in bug 1470046)
You need to log in before you can comment on or make changes to this bug.