Summary: | Web Inspector: Allow retrieval of all transmitted cookies | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Alexander Pavlov (apavlov) <apavlov> | ||||||||||
Component: | Web Inspector (Deprecated) | Assignee: | Nobody <webkit-unassigned> | ||||||||||
Status: | RESOLVED FIXED | ||||||||||||
Severity: | Normal | CC: | bweinstein, commit-queue, joepeck, keishi, pfeldman, pmuellr, rik, timothy, webkit.review.bot | ||||||||||
Priority: | P2 | ||||||||||||
Version: | 528+ (Nightly build) | ||||||||||||
Hardware: | All | ||||||||||||
OS: | All | ||||||||||||
Bug Depends on: | |||||||||||||
Bug Blocks: | 32223 | ||||||||||||
Attachments: |
|
Description
Alexander Pavlov (apavlov)
2009-12-04 08:22:15 PST
Created attachment 44318 [details] patch The approach has been discussed with pfeldman@chromium.org style-queue ran check-webkit-style on attachment 44318 [details] without any errors.
Comment on attachment 44318 [details] patch > + for (var c = 0; c < allCookies.length; ++c) { c is a strange index name. > + for (var id in WebInspector.resources) { > + var resource = WebInspector.resources[id]; > + var match = resource.documentURL.match(WebInspector.URLRegExp); You don't need to do matching numCookeis x numResources times. It is easier to go though resources and store their domains into a set first (numResources steps), then you can get all cookies for given frame within numCookies x numDomains steps. > > +WebInspector.Cookies.cookieMatchesResourceURL = function(cookie, resourceURL) > +{ I don't see this method used. > + > +WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceDomain) > +{ > + if (cookieDomain.charAt(0) !== '.') > + return resourceDomain === cookieDomain; > + return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)?" + cookieDomain.substring(1).escapeForRegExp() + "$"), "i"); A test for this would be nice. You need to do a inspector test that would match a bunch of URLs against given domain on the frontend side. (In reply to comment #3) > (From update of attachment 44318 [details]) > > + for (var c = 0; c < allCookies.length; ++c) { > > c is a strange index name. i now > > + for (var id in WebInspector.resources) { > > + var resource = WebInspector.resources[id]; > > + var match = resource.documentURL.match(WebInspector.URLRegExp); > > You don't need to do matching numCookeis x numResources times. It is easier to > go though resources and store their domains into a set first (numResources > steps), then you can get all cookies for given frame within numCookies x > numDomains steps. We should store full URLs rather than domains (since the cookies are matched using the protocol, hostname, port, and path.) I have changed the impl, so we can gain some benefit when there are several cookie domains in the page. > > > > +WebInspector.Cookies.cookieMatchesResourceURL = function(cookie, resourceURL) > > +{ > > I don't see this method used. Thanks for the catch. For some reason I was invoking domain matching rather than full matching. > > + > > +WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceDomain) > > +{ > > + if (cookieDomain.charAt(0) !== '.') > > + return resourceDomain === cookieDomain; > > + return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)?" + cookieDomain.substring(1).escapeForRegExp() + "$"), "i"); > > A test for this would be nice. You need to do a inspector test that would match > a bunch of URLs against given domain on the frontend side. Done. Created attachment 44417 [details]
patch (fixed)
style-queue ran check-webkit-style on attachment 44417 [details] without any errors.
Created attachment 44421 [details]
patch (add comment + use match group)
style-queue ran check-webkit-style on attachment 44421 [details] without any errors.
Created attachment 44467 [details]
patch (test cleanup)
style-queue ran check-webkit-style on attachment 44467 [details] without any errors.
Comment on attachment 44467 [details] patch (test cleanup) Clearing flags on attachment: 44467 Committed r51846: <http://trac.webkit.org/changeset/51846> All reviewed patches have been landed. Closing bug. |