这是indexloc提供的服务,不要输入任何密码

Changeset 49210 in webkit


Ignore:
Timestamp:
Oct 6, 2009, 3:48:58 PM (16 years ago)
Author:
bweinstein@apple.com
Message:

2009-10-06 Brian Weinstein <bweinstein@apple.com>

Reviewed by Brady Eidson.

Preparation for <http://webkit.org/b/30104>.
Inspector should show cookies of sub-resources on the page.


Implement getRawCookies for CFNetwork for Windows, so we can see more
than just a key/value pair for Cookies when we are on Windows.

  • platform/network/win/CookieJarCFNetWin.cpp: (WebCore::getRawCookies):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r49208 r49210  
     12009-10-06  Brian Weinstein  <bweinstein@apple.com>
     2
     3        Reviewed by Brady Eidson.
     4
     5        Preparation for <http://webkit.org/b/30104>.
     6        Inspector should show cookies of sub-resources on the page.
     7       
     8        Implement getRawCookies for CFNetwork for Windows, so we can see more
     9        than just a key/value pair for Cookies when we are on Windows.
     10
     11        * platform/network/win/CookieJarCFNetWin.cpp:
     12        (WebCore::getRawCookies):
     13
    1142009-10-06  Dave Hyatt  <hyatt@apple.com>
    215
  • trunk/WebCore/platform/network/win/CookieJarCFNetWin.cpp

    r47363 r49210  
    115115}
    116116
    117 bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies)
     117bool getRawCookies(const Document*, const KURL& url, Vector<Cookie>& rawCookies)
    118118{
    119     // FIXME: Not yet implemented
    120119    rawCookies.clear();
    121     return false; // return true when implemented
     120    CFHTTPCookieStorageRef cookieStorage = currentCookieStorage();
     121    if (!cookieStorage)
     122        return false;
     123
     124    RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
     125
     126    bool sendSecureCookies = url.protocolIs("https");
     127    RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage, urlCF.get(), sendSecureCookies));
     128
     129    CFIndex count = CFArrayGetCount(cookiesCF.get());
     130    rawCookies.reserveCapacity(count);
     131
     132    for (CFIndex i = 0; i < count; i++) {
     133       CFHTTPCookieRef cookie = (CFHTTPCookieRef)CFArrayGetValueAtIndex(cookiesCF.get(), i);
     134       String name = CFHTTPCookieGetName(cookie);
     135       String value = CFHTTPCookieGetValue(cookie);
     136       String domain = CFHTTPCookieGetDomain(cookie);
     137       String path = CFHTTPCookieGetPath(cookie);
     138
     139       double expires = (CFDateGetAbsoluteTime(CFHTTPCookieGetExpiratonDate(cookie)) + kCFAbsoluteTimeIntervalSince1970) * 1000;
     140
     141       bool httpOnly = CFHTTPCookieIsHTTPOnly(cookie);
     142       bool secure = CFHTTPCookieIsSecure(cookie);
     143       bool session = false;    // FIXME: Need API for if a cookie is a session cookie.
     144
     145       rawCookies.uncheckedAppend(Cookie(name, value, domain, path, expires, httpOnly, secure, session));
     146    }
     147
     148    return true;
    122149}
    123150
Note: See TracChangeset for help on using the changeset viewer.