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

Changeset 49263 in webkit


Ignore:
Timestamp:
Oct 7, 2009, 2:55:58 PM (16 years ago)
Author:
bweinstein@apple.com
Message:

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

Reviewed by Timothy Hatcher.

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


This function implements showing cookies for all sub-resources of a page.
When the page is loaded, it populates the Storage Panel with a list of all
domains that were loaded as part of the full page load (iframes, ads, etc).
When the user selects one of the domains, the inspector calls back into the
controller, and the controller combines all of the cookies from that domain
into a list, and sends that list is sent back to the controller to render.


A domain now needs to be passed into CookieItemsView, and CookieSidebarTreeElement.


As a result of a previous patch, we now have detailed cookie information for
both Windows on CFNetwork and Mac. Additionally, this patch provides deleteCookie
support on Windows.

  • bindings/js/ScriptObject.cpp: (WebCore::ScriptObject::set):
  • bindings/js/ScriptObject.h:
  • inspector/InspectorBackend.cpp: (WebCore::InspectorBackend::getCookies): (WebCore::InspectorBackend::deleteCookie):
  • inspector/InspectorBackend.h:
  • inspector/InspectorBackend.idl:
  • inspector/InspectorController.cpp: (WebCore::InspectorController::populateScriptObjects): (WebCore::InspectorController::didFinishLoading): (WebCore::InspectorController::getCookies): (WebCore::InspectorController::buildArrayForCookies): (WebCore::InspectorController::buildObjectForCookie): (WebCore::InspectorController::deleteCookie):
  • inspector/InspectorController.h:
  • inspector/InspectorDOMAgent.cpp:
  • inspector/InspectorDOMAgent.h:
  • inspector/InspectorFrontend.cpp: (WebCore::InspectorFrontend::addCookieDomainForDocument):
  • inspector/InspectorFrontend.h:
  • inspector/front-end/CookieItemsView.js: (WebInspector.CookieItemsView): (WebInspector.CookieItemsView.prototype.update): (WebInspector.CookieItemsView.prototype._deleteButtonClicked):
  • inspector/front-end/DOMAgent.js: (WebInspector.Cookies.getCookiesAsync):
  • inspector/front-end/StoragePanel.js: (WebInspector.StoragePanel): (WebInspector.StoragePanel.prototype.reset): (WebInspector.StoragePanel.prototype.addCookieDomain): (WebInspector.StoragePanel.prototype.showCookies): (WebInspector.CookieSidebarTreeElement): (WebInspector.CookieSidebarTreeElement.prototype.onselect):
  • inspector/front-end/inspector.js: (WebInspector.addCookieDomain):
  • platform/Cookie.h: (WebCore::CookieHash::hash): (WebCore::CookieHash::equal): (WTF::):
  • platform/network/win/CookieJarCFNetWin.cpp: (WebCore::deleteCookie):
Location:
trunk/WebCore
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r49262 r49263  
     12009-10-07  Brian Weinstein  <bweinstein@apple.com>
     2
     3        Reviewed by Timothy Hatcher.
     4
     5        Fixes <http://webkit.org/b/30104>.
     6        Inspector should show cookies of sub-resources on the page.
     7       
     8        This function implements showing cookies for all sub-resources of a page.
     9        When the page is loaded, it populates the Storage Panel with a list of all
     10        domains that were loaded as part of the full page load (iframes, ads, etc).
     11        When the user selects one of the domains, the inspector calls back into the
     12        controller, and the controller combines all of the cookies from that domain
     13        into a list, and sends that list is sent back to the controller to render.
     14       
     15        A domain now needs to be passed into CookieItemsView, and CookieSidebarTreeElement.
     16       
     17        As a result of a previous patch, we now have detailed cookie information for
     18        both Windows on CFNetwork and Mac. Additionally, this patch provides deleteCookie
     19        support on Windows.
     20
     21        * bindings/js/ScriptObject.cpp:
     22        (WebCore::ScriptObject::set):
     23        * bindings/js/ScriptObject.h:
     24        * inspector/InspectorBackend.cpp:
     25        (WebCore::InspectorBackend::getCookies):
     26        (WebCore::InspectorBackend::deleteCookie):
     27        * inspector/InspectorBackend.h:
     28        * inspector/InspectorBackend.idl:
     29        * inspector/InspectorController.cpp:
     30        (WebCore::InspectorController::populateScriptObjects):
     31        (WebCore::InspectorController::didFinishLoading):
     32        (WebCore::InspectorController::getCookies):
     33        (WebCore::InspectorController::buildArrayForCookies):
     34        (WebCore::InspectorController::buildObjectForCookie):
     35        (WebCore::InspectorController::deleteCookie):
     36        * inspector/InspectorController.h:
     37        * inspector/InspectorDOMAgent.cpp:
     38        * inspector/InspectorDOMAgent.h:
     39        * inspector/InspectorFrontend.cpp:
     40        (WebCore::InspectorFrontend::addCookieDomainForDocument):
     41        * inspector/InspectorFrontend.h:
     42        * inspector/front-end/CookieItemsView.js:
     43        (WebInspector.CookieItemsView):
     44        (WebInspector.CookieItemsView.prototype.update):
     45        (WebInspector.CookieItemsView.prototype._deleteButtonClicked):
     46        * inspector/front-end/DOMAgent.js:
     47        (WebInspector.Cookies.getCookiesAsync):
     48        * inspector/front-end/StoragePanel.js:
     49        (WebInspector.StoragePanel):
     50        (WebInspector.StoragePanel.prototype.reset):
     51        (WebInspector.StoragePanel.prototype.addCookieDomain):
     52        (WebInspector.StoragePanel.prototype.showCookies):
     53        (WebInspector.CookieSidebarTreeElement):
     54        (WebInspector.CookieSidebarTreeElement.prototype.onselect):
     55        * inspector/front-end/inspector.js:
     56        (WebInspector.addCookieDomain):
     57        * platform/Cookie.h:
     58        (WebCore::CookieHash::hash):
     59        (WebCore::CookieHash::equal):
     60        (WTF::):
     61        * platform/network/win/CookieJarCFNetWin.cpp:
     62        (WebCore::deleteCookie):
     63
    1642009-10-07  Pavel Feldman  <pfeldman@chromium.org>
    265
  • trunk/WebCore/bindings/js/ScriptObject.cpp

    r48430 r49263  
    104104}
    105105
     106bool ScriptObject::set(const char* name, unsigned value)
     107{
     108    JSLock lock(SilenceAssertionsOnly);
     109    PutPropertySlot slot;
     110    jsObject()->put(m_scriptState, Identifier(m_scriptState, name), jsNumber(m_scriptState, value), slot);
     111    return handleException(m_scriptState);
     112}
     113
    106114bool ScriptObject::set(const char* name, bool value)
    107115{
  • trunk/WebCore/bindings/js/ScriptObject.h

    r48430 r49263  
    5353        bool set(const char* name, long long);
    5454        bool set(const char* name, int);
     55        bool set(const char* name, unsigned);
    5556        bool set(const char* name, bool);
    5657
  • trunk/WebCore/inspector/InspectorBackend.cpp

    r49234 r49263  
    457457}
    458458
    459 void InspectorBackend::getCookies(long callId)
    460 {
    461     if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
    462         domAgent->getCookies(callId);
    463 }
    464 
    465 void InspectorBackend::deleteCookie(const String& cookieName)
     459void InspectorBackend::getCookies(long callId, const String& domain)
    466460{
    467461    if (!m_inspectorController)
    468462        return;
    469     m_inspectorController->deleteCookie(cookieName);
     463    m_inspectorController->getCookies(callId, domain);
     464}
     465
     466void InspectorBackend::deleteCookie(const String& cookieName, const String& domain)
     467{
     468    if (!m_inspectorController)
     469        return;
     470    m_inspectorController->deleteCookie(cookieName, domain);
    470471}
    471472
  • trunk/WebCore/inspector/InspectorBackend.h

    r49234 r49263  
    139139    void copyNode(long nodeId);
    140140
    141     void getCookies(long callId);
    142     void deleteCookie(const String& cookieName);
     141    void getCookies(long callId, const String& domain);
     142    void deleteCookie(const String& cookieName, const String& domain);
    143143
    144144    // Generic code called from custom implementations.
  • trunk/WebCore/inspector/InspectorBackend.idl

    r49234 r49263  
    111111        void copyNode(in long nodeId);
    112112
    113         void getCookies(in long callId);
    114         void deleteCookie(in DOMString cookieName);
     113        void getCookies(in long callId, in DOMString domain);
     114        void deleteCookie(in DOMString cookieName, in DOMString domain);
    115115
    116116        // Called from InjectedScript.
  • trunk/WebCore/inspector/InspectorController.cpp

    r49234 r49263  
    3737#include "Console.h"
    3838#include "ConsoleMessage.h"
     39#include "Cookie.h"
    3940#include "CookieJar.h"
    4041#include "Document.h"
     
    7778#include "TextIterator.h"
    7879#include <wtf/CurrentTime.h>
     80#include <wtf/ListHashSet.h>
    7981#include <wtf/RefCounted.h>
    8082#include <wtf/StdLibExtras.h>
     
    653655
    654656    ResourcesMap::iterator resourcesEnd = m_resources.end();
    655     for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it)
     657    for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it) {
    656658        it->second->createScriptObject(m_frontend.get());
    657 
     659        m_frontend->addCookieDomain(it->second->frame()->document()->url().host());
     660    }
     661       
    658662    unsigned messageCount = m_consoleMessages.size();
    659663    for (unsigned i = 0; i < messageCount; ++i)
     
    973977    addResource(resource.get());
    974978
    975     if (m_frontend)
     979    if (m_frontend) {
    976980        resource->updateScriptObject(m_frontend.get());
     981        m_frontend->addCookieDomain(resource->frame()->document()->url().host());
     982    }
    977983}
    978984
     
    11471153#endif
    11481154
     1155void InspectorController::getCookies(long callId, const String& host)
     1156{
     1157    if (!m_frontend)
     1158        return;
     1159   
     1160    // If we can get raw cookies.
     1161    ListHashSet<Cookie> rawCookiesList;
     1162   
     1163    // If we can't get raw cookies - fall back to String representation
     1164    String stringCookiesList;
     1165   
     1166    // Return value to getRawCookies should be the same for every call because
     1167    // the return value is platform/network backend specific, and the call will
     1168    // always return the same true/false value.
     1169    bool rawCookiesImplemented = false;
     1170   
     1171    ResourcesMap::iterator resourcesEnd = m_resources.end();
     1172    for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it) {
     1173        Document* document = it->second->frame()->document();
     1174        if (document->url().host() == host) {
     1175            Vector<Cookie> docCookiesList;
     1176            rawCookiesImplemented = getRawCookies(document, document->cookieURL(), docCookiesList);
     1177           
     1178            if (!rawCookiesImplemented)
     1179                // FIXME: We need duplication checking for the String representation of cookies.
     1180                stringCookiesList += document->cookie();
     1181            else {
     1182                int cookiesSize = docCookiesList.size();
     1183                for (int i = 0; i < cookiesSize; i++) {
     1184                    if (!rawCookiesList.contains(docCookiesList[i]))
     1185                        rawCookiesList.add(docCookiesList[i]);
     1186                }
     1187            }
     1188        }
     1189    }
     1190   
     1191    if (!rawCookiesImplemented)
     1192        m_frontend->didGetCookies(callId, m_frontend->newScriptArray(), stringCookiesList);
     1193    else
     1194        m_frontend->didGetCookies(callId, buildArrayForCookies(rawCookiesList), String());
     1195}
     1196   
     1197ScriptArray InspectorController::buildArrayForCookies(ListHashSet<Cookie>& cookiesList)
     1198{
     1199    ScriptArray cookies = m_frontend->newScriptArray();
     1200
     1201    ListHashSet<Cookie>::iterator end = cookiesList.end();
     1202    ListHashSet<Cookie>::iterator it = cookiesList.begin();
     1203    for (int i = 0; it != end; ++it, i++)
     1204        cookies.set(i, buildObjectForCookie(*it));
     1205
     1206    return cookies;
     1207}
     1208
     1209ScriptObject InspectorController::buildObjectForCookie(const Cookie& cookie)
     1210{
     1211    ScriptObject value = m_frontend->newScriptObject();
     1212    value.set("name", cookie.name);
     1213    value.set("value", cookie.value);
     1214    value.set("domain", cookie.domain);
     1215    value.set("path", cookie.path);
     1216    value.set("expires", cookie.expires);
     1217    value.set("size", (cookie.name.length() + cookie.value.length()));
     1218    value.set("httpOnly", cookie.httpOnly);
     1219    value.set("secure", cookie.secure);
     1220    value.set("session", cookie.session);
     1221    return value;
     1222}
     1223   
    11491224#if ENABLE(DOM_STORAGE)
    11501225void InspectorController::didUseDOMStorage(StorageArea* storageArea, bool isLocalStorage, Frame* frame)
     
    17301805}
    17311806
    1732 void InspectorController::deleteCookie(const String& cookieName)
    1733 {
    1734     Document* document = m_inspectedPage->mainFrame()->document();
    1735     WebCore::deleteCookie(document, document->cookieURL(), cookieName);
     1807void InspectorController::deleteCookie(const String& cookieName, const String& domain)
     1808{
     1809    ResourcesMap::iterator resourcesEnd = m_resources.end();
     1810    for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it) {
     1811        Document* document = it->second->frame()->document();
     1812        if (document->url().host() == domain)
     1813            WebCore::deleteCookie(document, document->cookieURL(), cookieName);
     1814    }
    17361815}
    17371816
  • trunk/WebCore/inspector/InspectorController.h

    r49234 r49263  
    3131
    3232#include "Console.h"
     33#include "Cookie.h"
    3334#include "PlatformString.h"
     35#include "ScriptArray.h"
    3436#include "ScriptObject.h"
    3537#include "ScriptState.h"
     
    4042#include <wtf/HashMap.h>
    4143#include <wtf/HashSet.h>
     44#include <wtf/ListHashSet.h>
    4245#include <wtf/RefCounted.h>
    4346#include <wtf/Vector.h>
     
    233236    void mainResourceFiredLoadEvent(DocumentLoader*, const KURL&);
    234237    void mainResourceFiredDOMContentEvent(DocumentLoader*, const KURL&);
     238                                                       
     239    void getCookies(long callId, const String& url);
    235240
    236241#if ENABLE(DATABASE)
     
    308313    void resetInjectedScript();
    309314
    310     void deleteCookie(const String& cookieName);
     315    void deleteCookie(const String& cookieName, const String& domain);
    311316
    312317#if ENABLE(JAVASCRIPT_DEBUGGER)
     
    322327    InspectorDOMStorageResource* getDOMStorageResourceForId(int storageId);
    323328#endif
     329                                                       
     330    ScriptObject buildObjectForCookie(const Cookie&);
     331    ScriptArray buildArrayForCookies(ListHashSet<Cookie>&);
    324332
    325333    void focusNode();
  • trunk/WebCore/inspector/InspectorDOMAgent.cpp

    r48887 r49263  
    439439}
    440440
    441 void InspectorDOMAgent::getCookies(long callId)
    442 {
    443     Document* doc = mainFrameDocument();
    444     Vector<Cookie> cookiesList;
    445     bool isImplemented = getRawCookies(doc, doc->cookieURL(), cookiesList);
    446 
    447     if (!isImplemented)
    448         m_frontend->didGetCookies(callId, m_frontend->newScriptArray(), doc->cookie());
    449     else
    450         m_frontend->didGetCookies(callId, buildArrayForCookies(cookiesList), String());
    451 }
    452 
    453441ScriptObject InspectorDOMAgent::buildObjectForNode(Node* node, int depth, NodeToIdMap* nodesMap)
    454442{
     
    550538}
    551539
    552 ScriptObject InspectorDOMAgent::buildObjectForCookie(const Cookie& cookie)
    553 {
    554     ScriptObject value = m_frontend->newScriptObject();
    555     value.set("name", cookie.name);
    556     value.set("value", cookie.value);
    557     value.set("domain", cookie.domain);
    558     value.set("path", cookie.path);
    559     value.set("expires", cookie.expires);
    560     value.set("size", static_cast<int>(cookie.name.length() + cookie.value.length()));
    561     value.set("httpOnly", cookie.httpOnly);
    562     value.set("secure", cookie.secure);
    563     value.set("session", cookie.session);
    564     return value;
    565 }
    566 
    567 ScriptArray InspectorDOMAgent::buildArrayForCookies(const Vector<Cookie>& cookiesList)
    568 {
    569     ScriptArray cookies = m_frontend->newScriptArray();
    570     unsigned length = cookiesList.size();
    571     for (unsigned i = 0; i < length; ++i) {
    572         const Cookie& cookie = cookiesList[i];
    573         cookies.set(i, buildObjectForCookie(cookie));
    574     }
    575     return cookies;
    576 }
    577 
    578540Node* InspectorDOMAgent::innerFirstChild(Node* node)
    579541{
  • trunk/WebCore/inspector/InspectorDOMAgent.h

    r48884 r49263  
    5454    class Page;
    5555
    56     struct Cookie;
    57 
    5856    struct EventListenerInfo {
    5957        EventListenerInfo(Node* node, const AtomicString& eventType, const EventListenerVector& eventListenerVector)
     
    8987        void setTextNodeValue(long callId, long nodeId, const String& value);
    9088        void getEventListenersForNode(long callId, long nodeId);
    91         void getCookies(long callId);
    9289
    9390        // Methods called from the InspectorController.
     
    116113
    117114        ScriptObject buildObjectForEventListener(const RegisteredEventListener& registeredEventListener, const AtomicString& eventType, Node* node);
    118 
    119         ScriptObject buildObjectForCookie(const Cookie& cookie);
    120         ScriptArray buildArrayForCookies(const Vector<Cookie>& cookiesList);
    121115
    122116        // We represent embedded doms as a part of the same hierarchy. Hence we treat children of frame owners differently.
  • trunk/WebCore/inspector/InspectorFrontend.cpp

    r49234 r49263  
    126126}
    127127
     128void InspectorFrontend::addCookieDomain(String domain)
     129{
     130    OwnPtr<ScriptFunctionCall> function(newFunctionCall("addCookieDomain"));
     131    function->appendArgument(domain);
     132    function->call();
     133}
     134
    128135void InspectorFrontend::updateFocusedNode(long long nodeId)
    129136{
  • trunk/WebCore/inspector/InspectorFrontend.h

    r49234 r49263  
    7070        bool updateResource(long long identifier, const ScriptObject& resourceObj);
    7171        void removeResource(long long identifier);
     72
     73        void addCookieDomain(String);
    7274
    7375        void updateFocusedNode(long long nodeId);
  • trunk/WebCore/inspector/front-end/CookieItemsView.js

    r49062 r49263  
    2828 */
    2929
    30 WebInspector.CookieItemsView = function()
     30WebInspector.CookieItemsView = function(cookieDomain)
    3131{
    3232    WebInspector.View.call(this);
     
    4141    this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
    4242    this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
     43   
     44    this._cookieDomain = cookieDomain;
    4345}
    4446
     
    8486        }
    8587
    86         WebInspector.Cookies.getCookiesAsync(callback);
     88        WebInspector.Cookies.getCookiesAsync(callback, this._cookieDomain);
    8789    },
    8890
     
    261263
    262264        var cookie = this._dataGrid.selectedNode.cookie;
    263         InspectorController.deleteCookie(cookie.name);
     265        InspectorController.deleteCookie(cookie.name, this._cookieDomain);
    264266        this.update();
    265267    },
  • trunk/WebCore/inspector/front-end/DOMAgent.js

    r49174 r49263  
    438438WebInspector.Cookies = {}
    439439
    440 WebInspector.Cookies.getCookiesAsync = function(callback)
     440WebInspector.Cookies.getCookiesAsync = function(callback, cookieDomain)
    441441{
    442442    function mycallback(cookies, cookiesString) {
     
    447447    }
    448448    var callId = WebInspector.Callback.wrap(mycallback);
    449     InspectorController.getCookies(callId);
     449    InspectorController.getCookies(callId, cookieDomain);
    450450}
    451451
  • trunk/WebCore/inspector/front-end/StoragePanel.js

    r49234 r49263  
    6464    this.cookieListTreeElement.expand();
    6565
    66     this.cookieTreeElement = new WebInspector.CookieSidebarTreeElement();
    67     this.cookieListTreeElement.appendChild(this.cookieTreeElement);
    68 
    6966    this.storageViews = document.createElement("div");
    7067    this.storageViews.id = "storage-views";
     
    121118        this._domStorage = [];
    122119
    123         delete this._cookieView;
     120        this._cookieDomains = {};
     121        this._cookieViews = {};
    124122
    125123        this.databasesListTreeElement.removeChildren();
    126124        this.localStorageListTreeElement.removeChildren();
    127125        this.sessionStorageListTreeElement.removeChildren();
     126        this.cookieListTreeElement.removeChildren();
     127
    128128        this.storageViews.removeChildren();       
    129129
     
    146146        database._databasesTreeElement = databaseTreeElement;
    147147        this.databasesListTreeElement.appendChild(databaseTreeElement);
     148    },
     149   
     150    addCookieDomain: function(domain)
     151    {
     152        // Eliminate duplicate domains from the list.
     153        if (typeof this._cookieDomains[domain] !== "undefined")
     154            return;
     155
     156        var cookieDomainTreeElement = new WebInspector.CookieSidebarTreeElement(domain);
     157        this.cookieListTreeElement.appendChild(cookieDomainTreeElement);
     158        this._cookieDomains[domain] = true;
    148159    },
    149160
     
    241252    },
    242253
    243     showCookies: function()
     254    showCookies: function(cookieDomain)
    244255    {
    245256        if (this.visibleView)
    246257            this.visibleView.hide();
    247258
    248         var view = this._cookieView;
     259        var view = this._cookieViews[cookieDomain];
    249260        if (!view) {
    250             view = new WebInspector.CookieItemsView();
    251             this._cookieView = view;
     261            view = new WebInspector.CookieItemsView(cookieDomain);
     262            this._cookieViews[cookieDomain] = view;
    252263        }
    253264
     
    569580WebInspector.DOMStorageSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;
    570581
    571 WebInspector.CookieSidebarTreeElement = function()
     582WebInspector.CookieSidebarTreeElement = function(cookieDomain)
    572583{
    573     WebInspector.SidebarTreeElement.call(this, "cookie-sidebar-tree-item", null, "", null, false);
     584    WebInspector.SidebarTreeElement.call(this, "cookie-sidebar-tree-item", cookieDomain, "", null, false);
     585    this._cookieDomain = cookieDomain;
    574586
    575587    this.refreshTitles();
     
    579591    onselect: function()
    580592    {
    581         WebInspector.panels.storage.showCookies();
    582     },
    583 
    584     get mainTitle()
    585     {
    586         return WebInspector.UIString("Cookies");
    587     },
    588 
    589     set mainTitle(x)
    590     {
    591         // Do nothing.
     593        WebInspector.panels.storage.showCookies(this._cookieDomain);
    592594    },
    593595
  • trunk/WebCore/inspector/front-end/inspector.js

    r49234 r49263  
    10401040        payload.version);
    10411041    this.panels.storage.addDatabase(database);
     1042}
     1043
     1044WebInspector.addCookieDomain = function(domain)
     1045{
     1046    this.panels.storage.addCookieDomain(domain);
    10421047}
    10431048
  • trunk/WebCore/platform/Cookie.h

    r47656 r49263  
    2828
    2929#include "PlatformString.h"
     30#include "StringHash.h"
    3031
    3132namespace WebCore {
     
    5960    };
    6061
     62    struct CookieHash {
     63        static unsigned hash(Cookie key)
     64        {
     65            return StringHash::hash(key.name) + StringHash::hash(key.domain) + StringHash::hash(key.path) + key.secure;
     66        }
     67
     68        static bool equal(Cookie a, Cookie b)
     69        {
     70            return a.name == b.name && a.domain == b.domain && a.path == b.path && a.secure == b.secure;
     71        }
     72    };
     73}
     74
     75namespace WTF {
     76    template<typename T> struct DefaultHash;
     77    template<> struct DefaultHash<WebCore::Cookie> {
     78        typedef WebCore::CookieHash Hash;
     79    };
    6180}
    6281
  • trunk/WebCore/platform/network/win/CookieJarCFNetWin.cpp

    r49210 r49263  
    149149}
    150150
    151 void deleteCookie(const Document*, const KURL&, const String&)
     151void deleteCookie(const Document*, const KURL& url, const String& name)
    152152{
    153     // FIXME: Not yet implemented
     153    CFHTTPCookieStorageRef cookieStorage = currentCookieStorage();
     154    if (!cookieStorage)
     155        return;
     156
     157    RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
     158
     159    bool sendSecureCookies = url.protocolIs("https");
     160    RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage, urlCF.get(), sendSecureCookies));
     161
     162    CFIndex count = CFArrayGetCount(cookiesCF.get());
     163    for (CFIndex i = 0; i < count; i++) {
     164        CFHTTPCookieRef cookie = (CFHTTPCookieRef)CFArrayGetValueAtIndex(cookiesCF.get(), i);
     165        String cookieName = CFHTTPCookieGetName(cookie);
     166        if (cookieName == name) {
     167            CFHTTPCookieStorageDeleteCookie(cookieStorage, cookie);
     168            break;
     169        }
     170    }
    154171}
    155172
Note: See TracChangeset for help on using the changeset viewer.