nsPrivateBrowsingService.js should use nsICookieManager2.getCookiesFromHost

RESOLVED FIXED in Firefox 3.7a4

Status

()

RESOLVED FIXED
9 years ago
9 years ago

People

(Reporter: dwitte, Assigned: Ehsan)

Tracking

({perf})

Trunk
Firefox 3.7a4
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

9 years ago
http://mxr.mozilla.org/mozilla-central/source/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js#583

Using nsICookieManager.enumerator means iterating over all cookies, of which there will be thousands. This is slow -- much better to just do

  cm.getCookiesFromHost(aDomain);

and then the guard on 'hasRootDomain' isn't required, either.
(Reporter)

Updated

9 years ago
Keywords: perf
Whiteboard: goodfirstbug
(Reporter)

Updated

9 years ago
Whiteboard: goodfirstbug → [good first bug]
(Assignee)

Comment 1

9 years ago
So, does GetCookiesFromHost expose the exact same behavior as what we achieve using hasRootDomain?  (i.e., we want clearing cookies for mozilla.org also clear all cookies for xyz.mozilla.org, abc.xyz.mozilla.org, etc. as well).
(Reporter)

Comment 2

9 years ago
Yes. :)
(Assignee)

Comment 3

9 years ago
One more question, should we pass a preceding dot with the domain name to GetCookiesFromHost?
(Reporter)

Comment 4

9 years ago
It doesn't matter, but let's say no.
(Assignee)

Comment 5

9 years ago
Created attachment 432683 [details] [diff] [review]
Patch (v1)
Assignee: nobody → ehsan.akhgari
Status: NEW → ASSIGNED
Attachment #432683 - Flags: review?(vladimir)
(Assignee)

Comment 6

9 years ago
This _was_ a good first bug, but since it would potentially lead to perf wins, I decided to pick it up myself. :-)
Whiteboard: [good first bug]
(Reporter)

Comment 7

9 years ago
Comment on attachment 432683 [details] [diff] [review]
Patch (v1)

r=dwitte -- I assume that's OK, given that I wrote the API. :)
Attachment #432683 - Flags: review?(vladimir) → review+
(Assignee)

Comment 8

9 years ago
http://hg.mozilla.org/mozilla-central/rev/f94b5b994710
Status: ASSIGNED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 3.7a4
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.