Title: [136321] trunk/Source/WebCore
Revision
136321
Author
[email protected]
Date
2012-12-02 02:27:33 -0800 (Sun, 02 Dec 2012)

Log Message

[BlackBerry] Adding checks for null when checking cookie status in CookieJarBlackBerry
https://bugs.webkit.org/show_bug.cgi?id=103748

Patch by Otto Derek Cheung <[email protected]> on 2012-12-02
Reviewed by Rob Buis.

Updating CookieJarBlackBerry::cookieEnabled and have other methods in the class call that
method. Also, adding null checks for document->settings().

No change in behaviour.

* loader/blackberry/CookieJarBlackBerry.cpp:
(WebCore::cookies):
(WebCore::setCookies):
(WebCore::cookiesEnabled):
(WebCore::getRawCookies):
(WebCore::deleteCookie):
(WebCore::cookieRequestHeaderFieldValue):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136320 => 136321)


--- trunk/Source/WebCore/ChangeLog	2012-12-02 10:12:47 UTC (rev 136320)
+++ trunk/Source/WebCore/ChangeLog	2012-12-02 10:27:33 UTC (rev 136321)
@@ -1,3 +1,23 @@
+2012-12-02  Otto Derek Cheung  <[email protected]>
+
+        [BlackBerry] Adding checks for null when checking cookie status in CookieJarBlackBerry
+        https://bugs.webkit.org/show_bug.cgi?id=103748
+
+        Reviewed by Rob Buis.
+
+        Updating CookieJarBlackBerry::cookieEnabled and have other methods in the class call that
+        method. Also, adding null checks for document->settings().
+
+        No change in behaviour.
+
+        * loader/blackberry/CookieJarBlackBerry.cpp:
+        (WebCore::cookies):
+        (WebCore::setCookies):
+        (WebCore::cookiesEnabled):
+        (WebCore::getRawCookies):
+        (WebCore::deleteCookie):
+        (WebCore::cookieRequestHeaderFieldValue):
+
 2012-12-02  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r136236.

Modified: trunk/Source/WebCore/loader/blackberry/CookieJarBlackBerry.cpp (136320 => 136321)


--- trunk/Source/WebCore/loader/blackberry/CookieJarBlackBerry.cpp	2012-12-02 10:12:47 UTC (rev 136320)
+++ trunk/Source/WebCore/loader/blackberry/CookieJarBlackBerry.cpp	2012-12-02 10:27:33 UTC (rev 136321)
@@ -39,29 +39,27 @@
 
 String cookies(Document const* document, KURL const& url)
 {
-    if (!document->settings()->cookieEnabled())
-        return String();
-
     // 'HttpOnly' cookies should no be accessible from scripts, so we filter them out here
-    return cookieManager().getCookie(url, NoHttpOnlyCookie);
+    if (cookiesEnabled(document))
+        return cookieManager().getCookie(url, NoHttpOnlyCookie);
+    return String();
+
 }
 
 void setCookies(Document* document, KURL const& url, String const& value)
 {
-    if (!document->settings()->cookieEnabled())
-        return;
-
-    cookieManager().setCookies(url, value, NoHttpOnlyCookie);
+    if (cookiesEnabled(document))
+        cookieManager().setCookies(url, value, NoHttpOnlyCookie);
 }
 
-bool cookiesEnabled(Document const*)
+bool cookiesEnabled(Document const* document)
 {
-    // FIXME. Currently cookie is enabled by default, no setting on property page.
-    return true;
+    return !(document && document->settings() && document->settings()->cookieEnabled());
 }
 
 bool getRawCookies(const Document* document, const KURL& url, Vector<Cookie>& rawCookies)
 {
+    // Note: this method is called by inspector only. No need to check if cookie is enabled.
     Vector<ParsedCookie*> result;
     cookieManager().getRawCookies(result, url, WithHttpOnlyCookies);
     for (size_t i = 0; i < result.size(); i++)
@@ -73,15 +71,15 @@
 {
     // Cookies are not bound to the document. Therefore, we don't need to pass
     // in the document object to find the targeted cookies in cookie manager.
+    // Note: this method is called by inspector only. No need to check if cookie is enabled.
     cookieManager().removeCookieWithName(url, cookieName);
 }
 
 String cookieRequestHeaderFieldValue(const Document* document, const KURL &url)
 {
-    if (!document->settings()->cookieEnabled())
-        return String();
-
-    return cookieManager().getCookie(url, WithHttpOnlyCookies);
+    if (cookiesEnabled(document))
+        return cookieManager().getCookie(url, WithHttpOnlyCookies);
+    return String();
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to