Source/WebCore/ChangeLog

 12013-03-07 Otto Derek Cheung <otcheung@rim.com>
 2
 3 [BlackBerry] RefCounting ParsedCookie to avoid SegFaults
 4 https://bugs.webkit.org/show_bug.cgi?id=111761
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Making necessary changes to ref count the ParsedCookie object.
 9
 10 Tested using the opera cookie test suite and the BB Browser cookie test suite.
 11 Tested using the browser, visiting popular sites such as facebook, reddit, google etc
 12 to ensure cookie functionality isn't changed.
 13
 14 * loader/blackberry/CookieJarBlackBerry.cpp:
 15 (WebCore::getRawCookies):
 16 * platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp:
 17 (WebCore::CookieDatabaseBackingStore::insert):
 18 (WebCore::CookieDatabaseBackingStore::update):
 19 (WebCore::CookieDatabaseBackingStore::remove):
 20 (WebCore::CookieDatabaseBackingStore::getCookiesFromDatabase):
 21 (WebCore::CookieDatabaseBackingStore::invokeGetCookiesWithLimit):
 22 (WebCore::CookieDatabaseBackingStore::invokeSendChangesToDatabase):
 23 (WebCore::CookieDatabaseBackingStore::addToChangeQueue):
 24 * platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.h:
 25 (CookieDatabaseBackingStore):
 26 * platform/blackberry/CookieManager.cpp:
 27 (WebCore::cookieSorter):
 28 (WebCore::CookieManager::setCookies):
 29 (WebCore::CookieManager::getCookie):
 30 (WebCore::CookieManager::generateHtmlFragmentForCookies):
 31 (WebCore::CookieManager::getRawCookies):
 32 (WebCore::CookieManager::checkAndTreatCookie):
 33 (WebCore::CookieManager::addCookieToMap):
 34 (WebCore::CookieManager::getBackingStoreCookies):
 35 (WebCore::CookieManager::findOrCreateCookieMap):
 36 (WebCore::CookieManager::removeCookieWithName):
 37 (WebCore::CookieManager::cookieLimitCleanUp):
 38 * platform/blackberry/CookieManager.h:
 39 * platform/blackberry/CookieMap.cpp:
 40 (WebCore::CookieMap::addOrReplaceCookie):
 41 (WebCore::CookieMap::removeCookieAtIndex):
 42 (WebCore::CookieMap::removeCookie):
 43 (WebCore::CookieMap::getAllCookies):
 44 (WebCore::CookieMap::removeOldestCookie):
 45 (WebCore::CookieMap::deleteAllCookiesAndDomains):
 46 (WebCore::CookieMap::getAllChildCookies):
 47 * platform/blackberry/CookieMap.h:
 48 (CookieMap):
 49 * platform/blackberry/CookieParser.cpp:
 50 (WebCore):
 51 (WebCore::CookieParser::parse):
 52 (WebCore::CookieParser::parseOneCookie):
 53 * platform/blackberry/CookieParser.h:
 54 (CookieParser):
 55 * platform/blackberry/ParsedCookie.cpp:
 56 * platform/blackberry/ParsedCookie.h:
 57 (ParsedCookie):
 58 (WebCore::ParsedCookie::create):
 59
1602013-03-07 Andrey Lushnikov <lushnikov@chromium.org>
261
362 Web Inspector: [ACE] set correct font

Source/WebKit/blackberry/ChangeLog

 12013-03-07 Otto Derek Cheung <otcheung@rim.com>
 2
 3 [BlackBerry] RefCounting ParsedCookie to avoid SegFaults
 4 https://bugs.webkit.org/show_bug.cgi?id=111761
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Making necessary changes to ref-count the ParsedCookie object.
 9
 10 * Api/WebCookieJar.cpp:
 11 (BlackBerry::WebKit::WebCookieJar::cookies):
 12
1132013-03-06 Nima Ghanavatian <nghanavatian@rim.com>
214
315 [BlackBerry] Selection handles don't drag to expand correctly for RTL languages

Source/WebCore/loader/blackberry/CookieJarBlackBerry.cpp

@@bool cookiesEnabled(const Document* document)
6060bool getRawCookies(const Document* document, const KURL& url, Vector<Cookie>& rawCookies)
6161{
6262 // Note: this method is called by inspector only. No need to check if cookie is enabled.
63  Vector<ParsedCookie*> result;
 63 Vector<RefPtr<ParsedCookie> > result;
6464 cookieManager().getRawCookies(result, url, WithHttpOnlyCookies);
6565 for (size_t i = 0; i < result.size(); i++)
6666 result[i]->appendWebCoreCookie(rawCookies);

Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp

@@void CookieDatabaseBackingStore::close()
197197 m_db.close();
198198}
199199
200 void CookieDatabaseBackingStore::insert(const ParsedCookie* cookie)
 200void CookieDatabaseBackingStore::insert(const PassRefPtr<ParsedCookie> cookie)
201201{
202202 CookieLog("CookieBackingStore - adding inserting cookie %s to queue.", cookie->toString().utf8().data());
203203 addToChangeQueue(cookie, Insert);
204204}
205205
206 void CookieDatabaseBackingStore::update(const ParsedCookie* cookie)
 206void CookieDatabaseBackingStore::update(const PassRefPtr<ParsedCookie> cookie)
207207{
208208 CookieLog("CookieBackingStore - adding updating cookie %s to queue.", cookie->toString().utf8().data());
209209 addToChangeQueue(cookie, Update);
210210}
211211
212 void CookieDatabaseBackingStore::remove(const ParsedCookie* cookie)
 212void CookieDatabaseBackingStore::remove(const PassRefPtr<ParsedCookie> cookie)
213213{
214214 CookieLog("CookieBackingStore - adding deleting cookie %s to queue.", cookie->toString().utf8().data());
215215 addToChangeQueue(cookie, Delete);

@@void CookieDatabaseBackingStore::invokeRemoveAll()
252252 }
253253}
254254
255 void CookieDatabaseBackingStore::getCookiesFromDatabase(Vector<ParsedCookie*>& stackOfCookies, unsigned int limit)
 255void CookieDatabaseBackingStore::getCookiesFromDatabase(Vector<RefPtr<ParsedCookie> >& stackOfCookies, unsigned limit)
256256{
257257 // It is not a huge performance hit to wait on the reply here because this is only done once during setup and when turning off private mode.
258  TypedReplyBuffer< Vector<ParsedCookie*>* > replyBuffer(0);
 258 TypedReplyBuffer< Vector<RefPtr<ParsedCookie> >* > replyBuffer(0);
259259 dispatchMessage(createMethodCallMessageWithReturn(&CookieDatabaseBackingStore::invokeGetCookiesWithLimit, &replyBuffer, this, limit));
260  Vector<ParsedCookie*>* cookies = replyBuffer.pointer();
 260 Vector<RefPtr<ParsedCookie> >* cookies = replyBuffer.pointer();
261261 if (cookies)
262262 stackOfCookies.swap(*cookies);
263263 delete cookies;
264264}
265265
266 Vector<ParsedCookie*>* CookieDatabaseBackingStore::invokeGetCookiesWithLimit(unsigned int limit)
 266Vector<RefPtr<ParsedCookie> >* CookieDatabaseBackingStore::invokeGetCookiesWithLimit(unsigned limit)
267267{
268268 ASSERT(isCurrentThread());
269269

@@Vector<ParsedCookie*>* CookieDatabaseBackingStore::invokeGetCookiesWithLimit(uns
290290 return 0;
291291 }
292292
293  Vector<ParsedCookie*>* cookies = new Vector<ParsedCookie*>;
 293 Vector<RefPtr<ParsedCookie> >* cookies = new Vector<RefPtr<ParsedCookie> >;
294294 while (selectStatement.step() == SQLResultRow) {
295295 // There is a row to fetch
296296

@@Vector<ParsedCookie*>* CookieDatabaseBackingStore::invokeGetCookiesWithLimit(uns
305305 double creationTime = selectStatement.getColumnDouble(8);
306306 String protocol = selectStatement.getColumnText(9);
307307
308  cookies->append(new ParsedCookie(name, value, domain, protocol, path, expiry, lastAccessed, creationTime, isSecure, isHttpOnly));
 308 cookies->append(ParsedCookie::create(name, value, domain, protocol, path, expiry, lastAccessed, creationTime, isSecure, isHttpOnly));
309309 }
310310
311311 return cookies;

@@void CookieDatabaseBackingStore::invokeSendChangesToDatabase()
389389 size_t sizeOfChange = changedCookies.size();
390390 for (size_t i = 0; i < sizeOfChange; i++) {
391391 SQLiteStatement* m_statement;
392  const ParsedCookie cookie = changedCookies[i].first;
 392 const RefPtr<ParsedCookie> cookie = changedCookies[i].first;
393393 UpdateParameter action = changedCookies[i].second;
394394
395395 if (action == Delete) {

@@void CookieDatabaseBackingStore::invokeSendChangesToDatabase()
397397 CookieLog("CookieBackingStore - deleting cookie %s.", cookie.toString().utf8().data());
398398
399399 // Binds all the values
400  if (m_statement->bindText(1, cookie.name()) || m_statement->bindText(2, cookie.domain())
401  || m_statement->bindText(3, cookie.path()) || m_statement->bindText(4, cookie.protocol())) {
 400 if (m_statement->bindText(1, cookie->name()) || m_statement->bindText(2, cookie->domain())
 401 || m_statement->bindText(3, cookie->path()) || m_statement->bindText(4, cookie->protocol())) {
402402 LOG_ERROR("Cannot bind cookie data to delete");
403403 LOG_ERROR("SQLite Error Message: %s", m_db.lastErrorMsg());
404404 ASSERT_NOT_REACHED();

@@void CookieDatabaseBackingStore::invokeSendChangesToDatabase()
406406 }
407407 } else {
408408 if (action == Update) {
409  CookieLog("CookieBackingStore - updating cookie %s.", cookie.toString().utf8().data());
 409 CookieLog("CookieBackingStore - updating cookie %s.", cookie->toString().utf8().data());
410410 m_statement = m_updateStatement;
411411 } else {
412  CookieLog("CookieBackingStore - inserting cookie %s.", cookie.toString().utf8().data());
 412 CookieLog("CookieBackingStore - inserting cookie %s.", cookie->toString().utf8().data());
413413 m_statement = m_insertStatement;
414414 }
415415
416416 // Binds all the values
417  if (m_statement->bindText(1, cookie.name()) || m_statement->bindText(2, cookie.value())
418  || m_statement->bindText(3, cookie.domain()) || m_statement->bindText(4, cookie.path())
419  || m_statement->bindDouble(5, cookie.expiry()) || m_statement->bindDouble(6, cookie.lastAccessed())
420  || m_statement->bindInt64(7, cookie.isSecure()) || m_statement->bindInt64(8, cookie.isHttpOnly())
421  || m_statement->bindDouble(9, cookie.creationTime()) || m_statement->bindText(10, cookie.protocol())) {
 417 if (m_statement->bindText(1, cookie->name()) || m_statement->bindText(2, cookie->value())
 418 || m_statement->bindText(3, cookie->domain()) || m_statement->bindText(4, cookie->path())
 419 || m_statement->bindDouble(5, cookie->expiry()) || m_statement->bindDouble(6, cookie->lastAccessed())
 420 || m_statement->bindInt64(7, cookie->isSecure()) || m_statement->bindInt64(8, cookie->isHttpOnly())
 421 || m_statement->bindDouble(9, cookie->creationTime()) || m_statement->bindText(10, cookie->protocol())) {
422422 LOG_ERROR("Cannot bind cookie data to save");
423423 LOG_ERROR("SQLite Error Message: %s", m_db.lastErrorMsg());
424424 ASSERT_NOT_REACHED();

@@void CookieDatabaseBackingStore::invokeSendChangesToDatabase()
439439 CookieLog("CookieBackingStore - transaction complete");
440440}
441441
442 void CookieDatabaseBackingStore::addToChangeQueue(const ParsedCookie* changedCookie, UpdateParameter actionParam)
 442void CookieDatabaseBackingStore::addToChangeQueue(const PassRefPtr<ParsedCookie> changedCookie, UpdateParameter actionParam)
443443{
444444 ASSERT(!changedCookie->isSession());
445  ParsedCookie cookieCopy(changedCookie);
446  CookieAction action(cookieCopy, actionParam);
 445 CookieAction action(changedCookie, actionParam);
447446 {
448447 MutexLocker lock(m_mutex);
449448 m_changedCookies.append(action);

Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.h

@@public:
5050
5151 void open(const String& cookieJar);
5252
53  void insert(const ParsedCookie*);
54  void update(const ParsedCookie*);
55  void remove(const ParsedCookie*);
 53 void insert(const PassRefPtr<ParsedCookie>);
 54 void update(const PassRefPtr<ParsedCookie>);
 55 void remove(const PassRefPtr<ParsedCookie>);
5656
5757 void removeAll();
5858
5959 // If a limit is not set, the method will return all cookies in the database
60  void getCookiesFromDatabase(Vector<ParsedCookie*>& stackOfCookies, unsigned int limit = 0);
 60 void getCookiesFromDatabase(Vector<RefPtr<ParsedCookie> >& stackOfCookies, unsigned limit = 0);
6161
6262 void openAndLoadDatabaseSynchronously(const String& cookieJar);
6363 void sendChangesToDatabaseSynchronously();

@@private:
8181 CookieDatabaseBackingStore();
8282 ~CookieDatabaseBackingStore();
8383
84  void addToChangeQueue(const ParsedCookie* changedCookie, UpdateParameter actionParam);
 84 void addToChangeQueue(const PassRefPtr<ParsedCookie> changedCookie, UpdateParameter actionParam);
8585 void sendChangesToDatabase(int interval);
8686 void sendChangesToDatabaseTimerFired();
8787
8888 void invokeOpen(const String& cookieJar);
8989 void invokeRemoveAll();
90  Vector<ParsedCookie*>* invokeGetCookiesWithLimit(unsigned int limit);
 90 Vector<RefPtr<ParsedCookie> >* invokeGetCookiesWithLimit(unsigned limit);
9191 void invokeSendChangesToDatabase();
9292
9393 void close();
9494
95  typedef pair<const ParsedCookie, UpdateParameter> CookieAction;
 95 typedef pair<const PassRefPtr<ParsedCookie>, UpdateParameter> CookieAction;
9696 Vector<CookieAction> m_changedCookies;
9797 Mutex m_mutex;
9898

Source/WebCore/platform/blackberry/CookieManager.cpp

@@CookieManager::~CookieManager()
110110}
111111
112112// Sorting logic is based on Cookie Spec RFC6265, section 5.4.2
113 static bool cookieSorter(ParsedCookie* a, ParsedCookie* b)
 113static bool cookieSorter(PassRefPtr<ParsedCookie> a, PassRefPtr<ParsedCookie> b)
114114{
115115 if (a->path().length() == b->path().length())
116116 return a->creationTime() < b->creationTime();

@@void CookieManager::setCookies(const KURL& url, const String& value, CookieFilte
132132
133133 CookieLog("CookieManager - Setting cookies");
134134 CookieParser parser(url);
135  Vector<ParsedCookie*> cookies = parser.parse(value);
 135 Vector<RefPtr<ParsedCookie> > cookies = parser.parse(value);
136136
137137 for (size_t i = 0; i < cookies.size(); ++i) {
138138 BackingStoreRemovalPolicy treatment = m_privateMode ? DoNotRemoveFromBackingStore : RemoveFromBackingStore;

@@void CookieManager::setCookies(const KURL& url, const Vector<String>& cookies, C
150150 CookieParser parser(url);
151151 for (size_t i = 0; i < cookies.size(); ++i) {
152152 BackingStoreRemovalPolicy treatment = m_privateMode ? DoNotRemoveFromBackingStore : RemoveFromBackingStore;
153  if (ParsedCookie* parsedCookie = parser.parseOneCookie(cookies[i]))
 153 if (RefPtr<ParsedCookie> parsedCookie = parser.parseOneCookie(cookies[i]))
154154 checkAndTreatCookie(parsedCookie, treatment, filter);
155155 }
156156}

@@String CookieManager::getCookie(const KURL& url, CookieFilter filter) const
161161 if (!m_syncedWithDatabase && !m_privateMode)
162162 m_cookieBackingStore->openAndLoadDatabaseSynchronously(cookieJar());
163163
164  Vector<ParsedCookie*> rawCookies;
 164 Vector<RefPtr<ParsedCookie> > rawCookies;
165165 rawCookies.reserveInitialCapacity(s_maxCookieCountPerHost);
166166
167167 // Retrieve cookies related to this url

@@String CookieManager::generateHtmlFragmentForCookies()
192192
193193 CookieLog("CookieManager - generateHtmlFragmentForCookies\n");
194194
195  Vector<ParsedCookie*> cookieCandidates;
 195 Vector<RefPtr<ParsedCookie> > cookieCandidates;
196196 for (HashMap<String, CookieMap*>::iterator it = m_managerMap.begin(); it != m_managerMap.end(); ++it)
197197 it->value->getAllChildCookies(&cookieCandidates);
198198
199199 String result;
200  ParsedCookie* cookie = 0;
 200 RefPtr<ParsedCookie> cookie = 0;
201201 result.append(String("<table style=\"word-wrap:break-word\" cellSpacing=\"0\" cellPadding=\"0\" border=\"1\"><tr><th>Domain</th><th>Path</th><th>Protocol</th><th>Name</th><th>Value</th><th>Secure</th><th>HttpOnly</th><th>Session</th></tr>"));
202202 for (size_t i = 0; i < cookieCandidates.size(); ++i) {
203203 cookie = cookieCandidates[i];

@@String CookieManager::generateHtmlFragmentForCookies()
223223 return result;
224224}
225225
226 void CookieManager::getRawCookies(Vector<ParsedCookie*> &stackOfCookies, const KURL& requestURL, CookieFilter filter) const
 226void CookieManager::getRawCookies(Vector<RefPtr<ParsedCookie> > &stackOfCookies, const KURL& requestURL, CookieFilter filter) const
227227{
228228 // Force a sync load of the database
229229 if (!m_syncedWithDatabase && !m_privateMode)

@@void CookieManager::getRawCookies(Vector<ParsedCookie*> &stackOfCookies, const K
235235 const bool specialCaseForWebWorks = invalidScheme && m_shouldDumpAllCookies;
236236 const bool isConnectionSecure = requestURL.protocolIs("https") || requestURL.protocolIs("wss") || specialCaseForWebWorks;
237237
238  Vector<ParsedCookie*> cookieCandidates;
 238 Vector<RefPtr<ParsedCookie> > cookieCandidates;
239239 Vector<CookieMap*> protocolsToSearch;
240240
241241 // Special Case: If a server sets a "secure" cookie over a non-secure channel and tries to access the cookie

@@void CookieManager::getRawCookies(Vector<ParsedCookie*> &stackOfCookies, const K
316316 CookieLog("CookieManager - there are %d cookies in candidate\n", cookieCandidates.size());
317317
318318 for (size_t i = 0; i < cookieCandidates.size(); ++i) {
319  ParsedCookie* cookie = cookieCandidates[i];
 319 RefPtr<ParsedCookie> cookie = cookieCandidates[i];
320320
321321 // According to the path-matches rules in RFC6265, section 5.1.4,
322322 // we should add a '/' at the end of cookie-path for comparison if the cookie-path is not end with '/'.

@@void CookieManager::setCookieJar(const char* fileName)
355355 m_cookieBackingStore->open(m_cookieJarFileName);
356356}
357357
358 void CookieManager::checkAndTreatCookie(ParsedCookie* candidateCookie, BackingStoreRemovalPolicy postToBackingStore, CookieFilter filter)
 358void CookieManager::checkAndTreatCookie(PassRefPtr<ParsedCookie> prpCandidateCookie, BackingStoreRemovalPolicy postToBackingStore, CookieFilter filter)
359359{
 360 RefPtr<ParsedCookie> candidateCookie = prpCandidateCookie;
360361 CookieLog("CookieManager - checkAndTreatCookie - processing url with domain - %s & protocol %s\n", candidateCookie->domain().utf8().data(), candidateCookie->protocol().utf8().data());
361362
362363 // Delete invalid cookies:
363364 // 1) A cookie which is not from http shouldn't have a httpOnly property.
364365 // 2) Cookies coming from schemes that we do not support and the special flag isn't on
365  if ((filter == NoHttpOnlyCookie && candidateCookie->isHttpOnly()) || (shouldIgnoreScheme(candidateCookie->protocol()) && !m_shouldDumpAllCookies)) {
366  delete candidateCookie;
 366 if ((filter == NoHttpOnlyCookie && candidateCookie->isHttpOnly()) || (shouldIgnoreScheme(candidateCookie->protocol()) && !m_shouldDumpAllCookies))
367367 return;
368  }
369368
370369 const bool ignoreDomain = (candidateCookie->protocol() == "file" || candidateCookie->protocol() == "local");
371370

@@void CookieManager::checkAndTreatCookie(ParsedCookie* candidateCookie, BackingSt
399398 // If protocol support domain, we have to traverse the domain tree to find the right
400399 // cookieMap to handle with
401400 if (!ignoreDomain)
402  curMap = findOrCreateCookieMap(curMap, *candidateCookie);
 401 curMap = findOrCreateCookieMap(curMap, candidateCookie);
403402
404403 // Now that we have the proper map for this cookie, we can modify it
405404 // If cookie does not exist and has expired, delete it

@@void CookieManager::checkAndTreatCookie(ParsedCookie* candidateCookie, BackingSt
413412 m_cookieBackingStore->remove(candidateCookie);
414413 else if (curMap) {
415414 // RemoveCookie will return 0 if the cookie doesn't exist.
416  ParsedCookie* expired = curMap->removeCookie(candidateCookie, filter);
 415 RefPtr<ParsedCookie> expired = curMap->removeCookie(candidateCookie, filter);
417416 // Cookie is useless, Remove the cookie from the backingstore if it exists.
418417 // Backup check for BackingStoreCookieEntry incase someone incorrectly uses this enum.
419418 if (expired && postToBackingStore != BackingStoreCookieEntry && !expired->isSession()) {
420419 CookieLog("CookieManager - expired cookie is nonsession, deleting from db");
421420 m_cookieBackingStore->remove(expired);
422421 }
423  delete expired;
424 
425  } else
426  delete candidateCookie;
 422 }
427423 } else {
428424 ASSERT(curMap);
429425 addCookieToMap(curMap, candidateCookie, postToBackingStore, filter);
430426 }
431427}
432428
433 void CookieManager::addCookieToMap(CookieMap* targetMap, ParsedCookie* candidateCookie, BackingStoreRemovalPolicy postToBackingStore, CookieFilter filter)
 429void CookieManager::addCookieToMap(CookieMap* targetMap, PassRefPtr<ParsedCookie> prpCandidateCookie, BackingStoreRemovalPolicy postToBackingStore, CookieFilter filter)
434430{
435  ParsedCookie* replacedCookie = 0;
436 
437  if (!targetMap->addOrReplaceCookie(candidateCookie, &replacedCookie, filter)) {
 431 RefPtr<ParsedCookie> replacedCookie = 0;
 432 RefPtr<ParsedCookie> candidateCookie = prpCandidateCookie;
438433
 434 if (!targetMap->addOrReplaceCookie(candidateCookie, replacedCookie, filter)) {
439435 CookieLog("CookieManager - rejecting new cookie - %s.\n", candidateCookie->toString().utf8().data());
440 
441  delete candidateCookie;
442436 return;
443437 }
444438

@@void CookieManager::addCookieToMap(CookieMap* targetMap, ParsedCookie* candidate
467461 m_cookieBackingStore->insert(candidateCookie);
468462 }
469463 }
470  delete replacedCookie;
471464 return;
472465 }
473466
474467 CookieLog("CookieManager - adding new cookie - %s.\n", candidateCookie->toString().utf8().data());
475468
476  ParsedCookie* oldestCookie = 0;
 469 RefPtr<ParsedCookie> oldestCookie = 0;
477470 // Check if we have not reached the per cookie domain limit.
478471 // If that is not true, we check if the global limit has been reached if backingstore mode is on
479472 // Two points:

@@void CookieManager::addCookieToMap(CookieMap* targetMap, ParsedCookie* candidate
502495 if (!candidateCookie->isSession())
503496 m_cookieBackingStore->insert(candidateCookie);
504497 }
505  if (oldestCookie)
506  delete oldestCookie;
507498}
508499
509500void CookieManager::getBackingStoreCookies()

@@void CookieManager::getBackingStoreCookies()
516507 if (m_count)
517508 removeAllCookies(DoNotRemoveFromBackingStore);
518509
519  Vector<ParsedCookie*> cookies;
 510 Vector<RefPtr<ParsedCookie> > cookies;
520511 m_cookieBackingStore->getCookiesFromDatabase(cookies);
521512 CookieLog("CookieManager - Backingstore has %d cookies, loading them in memory now", cookies.size());
522513 for (size_t i = 0; i < cookies.size(); ++i) {
523  ParsedCookie* newCookie = cookies[i];
 514 RefPtr<ParsedCookie> newCookie = cookies[i];
524515
525516 // The IP flag is not persisted in the database.
526517 if (BlackBerry::Platform::isIPAddress(newCookie->domain().utf8().data()))

@@void CookieManager::setPrivateMode(bool privateMode)
552543 getBackingStoreCookies();
553544}
554545
555 CookieMap* CookieManager::findOrCreateCookieMap(CookieMap* protocolMap, const ParsedCookie& candidateCookie)
 546CookieMap* CookieManager::findOrCreateCookieMap(CookieMap* protocolMap, const PassRefPtr<ParsedCookie> candidateCookie)
556547{
557548 // Explode the domain with the '.' delimiter
558549 Vector<String> delimitedHost;
559550
560551 // If the domain is an IP address, don't split it.
561  if (candidateCookie.domainIsIPAddress())
562  delimitedHost.append(candidateCookie.domain());
 552 if (candidateCookie->domainIsIPAddress())
 553 delimitedHost.append(candidateCookie->domain());
563554 else
564  candidateCookie.domain().split(".", delimitedHost);
 555 candidateCookie->domain().split(".", delimitedHost);
565556
566557 CookieMap* curMap = protocolMap;
567558 size_t hostSize = delimitedHost.size();

@@CookieMap* CookieManager::findOrCreateCookieMap(CookieMap* protocolMap, const Pa
576567 CookieMap* nextMap = curMap->getSubdomainMap(delimitedHost[i]);
577568 if (!nextMap) {
578569 CookieLog("CookieManager - cannot find map\n");
579  if (candidateCookie.hasExpired())
 570 if (candidateCookie->hasExpired())
580571 return 0;
581572 CookieLog("CookieManager - creating %s in currentmap %s\n", delimitedHost[i].utf8().data(), curMap->getName().utf8().data());
582573 nextMap = new CookieMap(delimitedHost[i]);

@@void CookieManager::removeCookieWithName(const KURL& url, const String& cookieNa
602593
603594 // We get all cookies from all domains that domain matches the request domain
604595 // and delete any cookies with the specified name that path matches the request path
605  Vector<ParsedCookie*> results;
 596 Vector<RefPtr<ParsedCookie> > results;
606597 getRawCookies(results, url, WithHttpOnlyCookies);
607598 // Delete the cookies that path matches the request path
608599 for (size_t i = 0; i < results.size(); i++) {
609  ParsedCookie* cookie = results[i];
 600 RefPtr<ParsedCookie> cookie = results[i];
610601 if (!equalIgnoringCase(cookie->name(), cookieName))
611602 continue;
612603 if (url.path().startsWith(cookie->path(), false)) {

@@void CookieManager::cookieLimitCleanUp(Timer<CookieManager>* timer)
640631 CookieLimitLog("CookieManager - Excess: %d Amount to Delete: %d", numberOfCookiesOverLimit, amountToDelete);
641632
642633 // Call the database to delete 'amountToDelete' of cookies
643  Vector<ParsedCookie*> cookiesToDelete;
 634 Vector<RefPtr<ParsedCookie> > cookiesToDelete;
644635 cookiesToDelete.reserveInitialCapacity(amountToDelete);
645636
646637 CookieLimitLog("CookieManager - Calling database to clean up");

@@void CookieManager::cookieLimitCleanUp(Timer<CookieManager>* timer)
649640 // Cookies are ordered in ASC order by lastAccessed
650641 for (size_t i = 0; i < amountToDelete; ++i) {
651642 // Expire them and call checkandtreat to delete them from memory and database
652  ParsedCookie* newCookie = cookiesToDelete[i];
 643 RefPtr<ParsedCookie> newCookie = cookiesToDelete[i];
653644 CookieLimitLog("CookieManager - Expire cookie: %s and delete", newCookie->toString().utf8().data());
654645 newCookie->forceExpire();
655646 checkAndTreatCookie(newCookie, RemoveFromBackingStore);

Source/WebCore/platform/blackberry/CookieManager.h

@@public:
9999 String getCookie(const KURL& requestURL, CookieFilter) const;
100100
101101 // Returns all cookies that are associated with the specified URL as raw cookies.
102  void getRawCookies(Vector<ParsedCookie*>& stackOfCookies, const KURL& requestURL, CookieFilter = WithHttpOnlyCookies) const;
 102 void getRawCookies(Vector<RefPtr<ParsedCookie> >& stackOfCookies, const KURL& requestURL, CookieFilter = WithHttpOnlyCookies) const;
103103
104104private:
105105 friend CookieManager& cookieManager();

@@private:
108108 CookieManager();
109109 virtual ~CookieManager();
110110
111  void checkAndTreatCookie(ParsedCookie*, BackingStoreRemovalPolicy, CookieFilter = WithHttpOnlyCookies);
 111 void checkAndTreatCookie(PassRefPtr<ParsedCookie> prpCandidateCookie, BackingStoreRemovalPolicy, CookieFilter = WithHttpOnlyCookies);
112112
113  void addCookieToMap(CookieMap* targetMap, ParsedCookie* candidateCookie, BackingStoreRemovalPolicy postToBackingStore, CookieFilter = WithHttpOnlyCookies);
 113 void addCookieToMap(CookieMap* targetMap, PassRefPtr<ParsedCookie> prpCandidateCookie, BackingStoreRemovalPolicy postToBackingStore, CookieFilter = WithHttpOnlyCookies);
114114
115  CookieMap* findOrCreateCookieMap(CookieMap* protocolMap, const ParsedCookie& candidateCookie);
 115 CookieMap* findOrCreateCookieMap(CookieMap* protocolMap, const PassRefPtr<ParsedCookie> candidateCookie);
116116
117117 void initiateCookieLimitCleanUp();
118118 void cookieLimitCleanUp(Timer<CookieManager>*);

Source/WebCore/platform/blackberry/CookieMap.cpp

@@CookieMap::~CookieMap()
5454 deleteAllCookiesAndDomains();
5555}
5656
57 bool CookieMap::addOrReplaceCookie(ParsedCookie* candidateCookie, ParsedCookie** replacedCookie, CookieFilter filter)
 57bool CookieMap::addOrReplaceCookie(PassRefPtr<ParsedCookie> prpCandidateCookie, RefPtr<ParsedCookie>& replacedCookie, CookieFilter filter)
5858{
 59 RefPtr<ParsedCookie> candidateCookie = prpCandidateCookie;
5960 CookieLog("CookieMap - Attempting to add cookie - %s", cookie->name().utf8().data());
6061
6162 size_t cookieCount = m_cookieVector.size();

@@bool CookieMap::addOrReplaceCookie(ParsedCookie* candidateCookie, ParsedCookie**
6566 if (filter == NoHttpOnlyCookie && m_cookieVector[i]->isHttpOnly())
6667 return false;
6768
68  *replacedCookie = m_cookieVector[i];
 69 replacedCookie = m_cookieVector[i];
6970 m_cookieVector[i] = candidateCookie;
70  if (*replacedCookie == m_oldestCookie)
 71 if (replacedCookie == m_oldestCookie)
7172 updateOldestCookie();
7273 return true;
7374 }

@@bool CookieMap::addOrReplaceCookie(ParsedCookie* candidateCookie, ParsedCookie**
8182 return true;
8283}
8384
84 ParsedCookie* CookieMap::removeCookieAtIndex(int position, const ParsedCookie* cookie)
 85PassRefPtr<ParsedCookie> CookieMap::removeCookieAtIndex(int position, const PassRefPtr<ParsedCookie> cookie)
8586{
8687 ASSERT(0 <= position && static_cast<unsigned>(position) < m_cookieVector.size());
87  ParsedCookie* prevCookie = m_cookieVector[position];
 88 RefPtr<ParsedCookie> prevCookie = m_cookieVector[position];
8889 m_cookieVector.remove(position);
8990
9091 if (prevCookie == m_oldestCookie)

@@ParsedCookie* CookieMap::removeCookieAtIndex(int position, const ParsedCookie* c
9495 // to the cookie in memory too.
9596 if (cookie->isForceExpired())
9697 prevCookie->forceExpire();
97  delete cookie;
9898 }
9999
100100 if (!prevCookie->isSession())

@@ParsedCookie* CookieMap::removeCookieAtIndex(int position, const ParsedCookie* c
102102 return prevCookie;
103103}
104104
105 ParsedCookie* CookieMap::removeCookie(const ParsedCookie* cookie, CookieFilter filter)
 105PassRefPtr<ParsedCookie> CookieMap::removeCookie(const PassRefPtr<ParsedCookie> cookie, CookieFilter filter)
106106{
107107 size_t cookieCount = m_cookieVector.size();
108108 for (size_t position = 0; position < cookieCount; ++position) {

@@void CookieMap::addSubdomainMap(const String& subdomain, CookieMap* newDomain)
130130 m_subdomains.add(subdomain, newDomain);
131131}
132132
133 void CookieMap::getAllCookies(Vector<ParsedCookie*>* stackOfCookies)
 133void CookieMap::getAllCookies(Vector<RefPtr<ParsedCookie> >* stackOfCookies)
134134{
135135 CookieLog("CookieMap - Attempting to copy Map:%s cookies with %d cookies into vectors", m_name.utf8().data(), m_cookieVector.size());
136136

@@void CookieMap::getAllCookies(Vector<ParsedCookie*>* stackOfCookies)
138138
139139 size_t position = 0;
140140 while (position < m_cookieVector.size()) {
141  ParsedCookie* newCookie = m_cookieVector[position];
 141 RefPtr<ParsedCookie> newCookie = m_cookieVector[position];
142142 if (newCookie->hasExpired()) {
143143 // Notice that we don't delete from backingstore. These expired cookies will be
144144 // deleted when manager loads the backingstore again.
145  ParsedCookie* expired = removeCookieAtIndex(position, newCookie);
146  delete expired;
 145 removeCookieAtIndex(position, newCookie);
147146 } else {
148147 stackOfCookies->append(newCookie);
149148 position++;

@@void CookieMap::getAllCookies(Vector<ParsedCookie*>* stackOfCookies)
153152 CookieLog("CookieMap - stack of cookies now have %d cookies in it", (*stackOfCookies).size());
154153}
155154
156 ParsedCookie* CookieMap::removeOldestCookie()
 155PassRefPtr<ParsedCookie> CookieMap::removeOldestCookie()
157156{
158157 // FIXME: Make sure it finds the GLOBAL oldest cookie, not the first oldestcookie it finds.
159  ParsedCookie* oldestCookie = m_oldestCookie;
 158 RefPtr<ParsedCookie> oldestCookie = m_oldestCookie;
160159
161160 // If this map has an oldestCookie, remove it. If not, do a DFS to search for a child that does
162161 if (!oldestCookie) {

@@void CookieMap::deleteAllCookiesAndDomains()
203202{
204203 deleteAllValues(m_subdomains);
205204 m_subdomains.clear();
206  deleteAllValues(m_cookieVector);
207205 m_cookieVector.clear();
208206
209207 m_oldestCookie = 0;
210208}
211209
212 void CookieMap::getAllChildCookies(Vector<ParsedCookie*>* stackOfCookies)
 210void CookieMap::getAllChildCookies(Vector<RefPtr<ParsedCookie> >* stackOfCookies)
213211{
214212 CookieLog("CookieMap - getAllChildCookies in Map - %s", getName().utf8().data());
215213 getAllCookies(stackOfCookies);

Source/WebCore/platform/blackberry/CookieMap.h

@@public:
6060 const String& getName() const { return m_name; }
6161
6262 // Return false if the candidateCookie is rejected.
63  bool addOrReplaceCookie(ParsedCookie* candidateCookie, ParsedCookie** replacedCookie, CookieFilter = WithHttpOnlyCookies);
 63 bool addOrReplaceCookie(PassRefPtr<ParsedCookie> prpCandidateCookie, RefPtr<ParsedCookie>& replacedCookie, CookieFilter = WithHttpOnlyCookies);
6464
6565 // Need to return the reference to the removed cookie so manager can deal with it (garbage collect).
66  ParsedCookie* removeCookie(const ParsedCookie*, CookieFilter = WithHttpOnlyCookies);
 66 PassRefPtr<ParsedCookie> removeCookie(const PassRefPtr<ParsedCookie>, CookieFilter = WithHttpOnlyCookies);
6767
6868 // Returns a map with that given subdomain.
6969 CookieMap* getSubdomainMap(const String&);
7070 void addSubdomainMap(const String&, CookieMap*);
7171 void deleteAllCookiesAndDomains();
7272
73  void getAllCookies(Vector<ParsedCookie*>*);
74  void getAllChildCookies(Vector<ParsedCookie*>* stackOfCookies);
75  ParsedCookie* removeOldestCookie();
 73 void getAllCookies(Vector<RefPtr<ParsedCookie> >*);
 74 void getAllChildCookies(Vector<RefPtr<ParsedCookie> >* stackOfCookies);
 75 PassRefPtr<ParsedCookie> removeOldestCookie();
7676
7777private:
7878 void updateOldestCookie();
79  ParsedCookie* removeCookieAtIndex(int position, const ParsedCookie*);
 79 PassRefPtr<ParsedCookie> removeCookieAtIndex(int position, const PassRefPtr<ParsedCookie>);
8080
81  Vector<ParsedCookie*> m_cookieVector;
 81 Vector<RefPtr<ParsedCookie> > m_cookieVector;
8282 // The key is a subsection of the domain.
8383 // ex: if inserting accounts.google.com & this cookiemap is "com", this subdomain map will contain "google"
8484 // the "google" cookiemap will contain "accounts" in its subdomain map.
8585 HashMap<String, CookieMap*> m_subdomains;
8686
8787 // Store the oldest cookie to speed up LRU checks.
88  ParsedCookie* m_oldestCookie;
 88 RefPtr<ParsedCookie> m_oldestCookie;
8989 const String m_name;
9090
9191 // FIXME : should have a m_shouldUpdate flag to update the network layer only when the map has changed.

Source/WebCore/platform/blackberry/CookieParser.cpp

3535
3636namespace WebCore {
3737
38 #define LOG_AND_DELETE(format, ...) \
 38#define LOG_AND_RETURN(format, ...) \
3939 { \
4040 LOG_ERROR(format, ## __VA_ARGS__); \
41  delete res; \
4241 return 0; \
4342 }
4443

@@CookieParser::~CookieParser()
6968{
7069}
7170
72 Vector<ParsedCookie*> CookieParser::parse(const String& cookies)
 71Vector<RefPtr<ParsedCookie> > CookieParser::parse(const String& cookies)
7372{
7473 unsigned cookieStart, cookieEnd = 0;
7574 double curTime = currentTime();
76  Vector<ParsedCookie*, 4> parsedCookies;
 75 Vector<RefPtr<ParsedCookie>, 4> parsedCookies;
7776
7877 unsigned cookiesLength = cookies.length();
7978 if (!cookiesLength) // Code below doesn't handle this case

@@Vector<ParsedCookie*> CookieParser::parse(const String& cookies)
9695 if (cookieEnd < cookiesLength && isCookieHeaderSeparator(cookies[cookieEnd]))
9796 ++cookieEnd;
9897
99  ParsedCookie* cookie = parseOneCookie(cookies, cookieStart, cookieEnd - 1, curTime);
 98 RefPtr<ParsedCookie> cookie = parseOneCookie(cookies, cookieStart, cookieEnd - 1, curTime);
10099 if (cookie)
101100 parsedCookies.append(cookie);
102101 }
103102 return parsedCookies;
104103}
105104
106 ParsedCookie* CookieParser::parseOneCookie(const String& cookie)
 105PassRefPtr<ParsedCookie> CookieParser::parseOneCookie(const String& cookie)
107106{
108107 return parseOneCookie(cookie, 0, cookie.length() - 1, currentTime());
109108}
110109
111110// The cookie String passed into this method will only contian the name value pairs as well as other related cookie
112111// attributes such as max-age and domain. Set-Cookie should never be part of this string.
113 ParsedCookie* CookieParser::parseOneCookie(const String& cookie, unsigned start, unsigned end, double curTime)
 112PassRefPtr<ParsedCookie> CookieParser::parseOneCookie(const String& cookie, unsigned start, unsigned end, double curTime)
114113{
115  ParsedCookie* res = new ParsedCookie(curTime);
 114 RefPtr<ParsedCookie> res = ParsedCookie::create(curTime);
116115
117116 if (!res)
118  LOG_AND_DELETE("Out of memory");
 117 LOG_AND_RETURN("Out of memory");
119118
120119 res->setProtocol(m_defaultCookieURL.protocol());
121120

@@ParsedCookie* CookieParser::parseOneCookie(const String& cookie, unsigned start,
160159 tokenStart++;
161160
162161 if (nameEnd + 1 <= tokenStart)
163  LOG_AND_DELETE("Empty name. Rejecting the cookie");
 162 LOG_AND_RETURN("Empty name. Rejecting the cookie");
164163
165164 String name = cookie.substring(tokenStart, nameEnd + 1 - start);
166165 res->setName(name);

@@ParsedCookie* CookieParser::parseOneCookie(const String& cookie, unsigned start,
190189 if (hasName)
191190 res->setValue(value);
192191 else if (foundEqual) {
193  delete res;
 192 LOG_ERROR("Found equal.");
194193 return 0;
195194 } else
196195 res->setName(value); // No NAME=VALUE, only NAME

@@ParsedCookie* CookieParser::parseOneCookie(const String& cookie, unsigned start,
250249#if 0
251250 // Check if path attribute is a prefix of the request URI.
252251 if (!m_defaultCookieURL.path().startsWith(res->path()))
253  LOG_AND_DELETE("Invalid cookie attribute %s (path): it does not math the URL", cookie.ascii().data());
 252 LOG_AND_RETURN("Invalid cookie attribute %s (path): it does not math the URL", cookie.ascii().data());
254253#endif
255254 } else
256255 LOG_ERROR("Invalid cookie attribute %s (path)", cookie.ascii().data());

@@ParsedCookie* CookieParser::parseOneCookie(const String& cookie, unsigned start,
266265 // Check if the domain contains an embedded dot.
267266 size_t dotPosition = parsedValue.find(".", 1);
268267 if (dotPosition == notFound || dotPosition == parsedValue.length())
269  LOG_AND_DELETE("Invalid cookie attribute %s (domain): it does not contain an embedded dot", cookie.ascii().data());
 268 LOG_AND_RETURN("Invalid cookie attribute %s (domain): it does not contain an embedded dot", cookie.ascii().data());
270269
271270 // If the domain does not start with a dot, add one for security checks,
272271 // For example: ab.c.com dose not domain match b.c.com;

@@ParsedCookie* CookieParser::parseOneCookie(const String& cookie, unsigned start,
282281 if (m_defaultDomainIsIPAddress) {
283282 String realDomainCanonical = String(BlackBerry::Platform::getCanonicalIPFormat(realDomain.utf8().data()).c_str());
284283 if (realDomainCanonical.isEmpty() || realDomainCanonical != m_defaultCookieHost)
285  LOG_AND_DELETE("Invalid cookie attribute %s (domain): domain is IP but does not match host's IP", cookie.ascii().data());
 284 LOG_AND_RETURN("Invalid cookie attribute %s (domain): domain is IP but does not match host's IP", cookie.ascii().data());
286285 realDomain = realDomainCanonical;
287286 isIPAddress = true;
288287 } else {

@@ParsedCookie* CookieParser::parseOneCookie(const String& cookie, unsigned start,
294293 // We also have to make a special case for IP addresses. If a website tries to set
295294 // a cookie to 61.97, that domain is not an IP address and will end with the m_defaultCookieHost
296295 if (!m_defaultCookieHost.endsWith(realDomain, false))
297  LOG_AND_DELETE("Invalid cookie attribute %s (domain): it does not domain match the host", cookie.ascii().data());
 296 LOG_AND_RETURN("Invalid cookie attribute %s (domain): it does not domain match the host", cookie.ascii().data());
298297 // We should check for an embedded dot in the portion of string in the host not in the domain
299298 // but to match firefox behaviour we do not.
300299
301300 // Check whether the domain is a top level domain, if it is throw it out
302301 // http://publicsuffix.org/list/
303302 if (BlackBerry::Platform::isTopLevelDomain(realDomain.utf8().data()))
304  LOG_AND_DELETE("Invalid cookie attribute %s (domain): it did not pass the top level domain check", cookie.ascii().data());
 303 LOG_AND_RETURN("Invalid cookie attribute %s (domain): it did not pass the top level domain check", cookie.ascii().data());
305304 }
306305 res->setDomain(realDomain, isIPAddress);
307306 } else

@@ParsedCookie* CookieParser::parseOneCookie(const String& cookie, unsigned start,
347346 parsedValue = parsedValue.substring(1, parsedValue.length() - 2);
348347
349348 if (parsedValue.toInt() != 1)
350  LOG_AND_DELETE("ParsedCookie version %d not supported (only support version=1)", parsedValue.toInt());
 349 LOG_AND_RETURN("ParsedCookie version %d not supported (only support version=1)", parsedValue.toInt());
351350 } else
352351 LOG_ERROR("Invalid cookie attribute %s (version)", cookie.ascii().data());
353352 break;

@@ParsedCookie* CookieParser::parseOneCookie(const String& cookie, unsigned start,
382381
383382 // Check if the cookie is valid with respect to the size limit.
384383 if (!res->isUnderSizeLimit())
385  LOG_AND_DELETE("ParsedCookie %s is above the 4kb in length : REJECTED", cookie.ascii().data());
 384 LOG_AND_RETURN("ParsedCookie %s is above the 4kb in length : REJECTED", cookie.ascii().data());
386385
387386 // If some pair was not provided, during parsing then apply some default value
388387 // the rest has been done in the constructor.

Source/WebCore/platform/blackberry/CookieParser.h

@@public:
4343 ~CookieParser();
4444
4545 // Parses a sequence of "Cookie:" header and return the parsed cookies.
46  Vector<ParsedCookie*> parse(const String& cookies);
 46 Vector<RefPtr<ParsedCookie> > parse(const String& cookies);
4747
48  ParsedCookie* parseOneCookie(const String& cookie);
 48 PassRefPtr<ParsedCookie> parseOneCookie(const String& cookie);
4949
5050private:
5151 // FIXME: curTime, start, end parameters should be removed. And this method can be public.
52  ParsedCookie* parseOneCookie(const String& cookie, unsigned start, unsigned end, double curTime);
 52 PassRefPtr<ParsedCookie> parseOneCookie(const String& cookie, unsigned start, unsigned end, double curTime);
5353
5454 KURL m_defaultCookieURL;
5555 String m_defaultCookieHost;

Source/WebCore/platform/blackberry/ParsedCookie.cpp

@@ParsedCookie::ParsedCookie(const String& name, const String& value, const String
6666{
6767}
6868
69 ParsedCookie::ParsedCookie(const ParsedCookie* cookie)
70  : m_name(String(cookie->m_name))
71  , m_value(String(cookie->m_value))
72  , m_domain(String(cookie->m_domain))
73  , m_protocol(String(cookie->m_protocol))
74  , m_path(String(cookie->m_path))
75  , m_expiry(cookie->m_expiry)
76  , m_creationTime(cookie->m_creationTime)
77  , m_lastAccessed(cookie->m_lastAccessed)
78  , m_isSecure(cookie->m_isSecure)
79  , m_isHttpOnly(cookie->m_isHttpOnly)
80  , m_isSession(cookie->m_isSession)
81  , m_isForceExpired(cookie->m_isForceExpired)
82  , m_domainIsIPAddress(cookie->m_domainIsIPAddress)
83 {
84 }
85 
86 ParsedCookie::~ParsedCookie()
87 {
88 }
89 
9069void ParsedCookie::setExpiry(const String& expiry)
9170{
9271 // If a cookie has both the Max-Age and the Expires attribute,

Source/WebCore/platform/blackberry/ParsedCookie.h

2828#define ParsedCookie_h
2929
3030#include "Cookie.h"
31 #include <wtf/FastAllocBase.h>
 31#include <wtf/PassRefPtr.h>
 32#include <wtf/RefCounted.h>
 33#include <wtf/RefPtr.h>
3234
3335namespace WTF {
3436class String;

@@class KURL;
4042// This class represents a cookie internally
4143// It can either be created by the CookieParser which will then fill it
4244// or it can be created by the backing store filling it in the constructor.
43 class ParsedCookie {
44 WTF_MAKE_FAST_ALLOCATED;
 45class ParsedCookie : public RefCounted<ParsedCookie> {
4546public:
 47
4648 // Default cookie : empty domain, non secure and session
47  ParsedCookie(double currentTime);
 49 static PassRefPtr<ParsedCookie> create(double currentTime) { return adoptRef(new ParsedCookie(currentTime)); }
4850
4951 // For backing store cookies (those cookies are never session cookies).
50  ParsedCookie(const String& name, const String& value, const String& domain, const String& protocol, const String& path, double expiry, double lastAccessed, double creationTime, bool isSecure, bool isHttpOnly);
51 
52  ParsedCookie(const ParsedCookie*);
53 
54  ~ParsedCookie();
 52 static PassRefPtr<ParsedCookie> create(const String& name, const String& value, const String& domain, const String& protocol, const String& path, double expiry, double lastAccessed, double creationTime, bool isSecure, bool isHttpOnly) { return adoptRef(new ParsedCookie(name, value, domain, protocol, path, expiry, lastAccessed, creationTime, isSecure, isHttpOnly)); };
5553
5654 const String& name() const { return m_name; }
5755 void setName(const String& name) { m_name = name; }

@@public:
9795 void appendWebCoreCookie(Vector<Cookie>& cookieVector) const;
9896
9997private:
 98 // Default cookie : empty domain, non secure and session
 99 ParsedCookie(double currentTime);
 100
 101 // For backing store cookies (those cookies are never session cookies).
 102 ParsedCookie(const String& name, const String& value, const String& domain, const String& protocol, const String& path, double expiry, double lastAccessed, double creationTime, bool isSecure, bool isHttpOnly);
 103
100104 String m_name;
101105 String m_value;
102106 String m_domain;

Source/WebKit/blackberry/Api/WebCookieJar.cpp

@@std::vector<BlackBerry::Platform::String> WebCookieJar::cookies(const BlackBerry
3737{
3838 KURL kurl = KURL(KURL(), url);
3939
40  Vector<ParsedCookie*> rawCookies;
 40 Vector<RefPtr<ParsedCookie> > rawCookies;
4141 cookieManager().getRawCookies(rawCookies, kurl, WithHttpOnlyCookies);
4242
4343 std::vector<BlackBerry::Platform::String> result;