Closed Bug 1396676 Opened 7 years ago Closed 7 years ago

Don't leak CookieServiceChild in every child process

Categories

(Core :: Networking: Cookies, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: kmag, Assigned: kmag)

References

Details

(Whiteboard: [necko-active])

Attachments

(1 file)

Because CookieServiceChild::GetSingleton does an addref but returns a raw pointer, it's easy to use it in ways that will cause a shutdown leak (as the patches in bug 1331680 did). It should return an already_AddRefed instead.
Comment on attachment 8904366 [details]
Bug 1396676: Return already_AddRefed from cookie service GetSingleton() methods.

https://reviewboard.mozilla.org/r/176170/#review181380

::: netwerk/cookie/nsCookieService.h:219
(Diff revision 1)
>      NS_DECL_NSICOOKIEMANAGER2
>      NS_DECL_NSIMEMORYREPORTER
>  
>      nsCookieService();
> -    static nsICookieService*      GetXPCOMSingleton();
> -    nsresult                      Init();
> +    static already_AddRefed<nsICookieService> GetXPCOMSingleton();
> +    nsresult                                  Init();

nit: just remove the extra whitespace; it's not worth formatting these lines to match.
Attachment #8904366 - Flags: review?(josh) → review+
Whiteboard: [necko-active]
https://hg.mozilla.org/integration/mozilla-inbound/rev/a4252412b1ac3b90d0845e7c8af5f8231d4e8bce
Bug 1396676: Return already_AddRefed from cookie service GetSingleton() methods. r=jdm
https://hg.mozilla.org/mozilla-central/rev/a4252412b1ac
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Depends on: 1448604
You need to log in before you can comment on or make changes to this bug.