[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756
darin at chromium.org
darin at chromium.org
Fri Feb 26 22:19:08 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 7e1ed1a6da22a97e0dca7b79da20043645fc1216
Author: darin at chromium.org <darin at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Feb 12 23:29:39 2010 +0000
2010-02-11 Darin Fisher <darin at chromium.org>
Reviewed by Jeremy Orlow.
Introduce WebCookieJar, and provide for a frame specific cookie jar.
https://bugs.webkit.org/show_bug.cgi?id=34878
* WebKit.gyp:
* public/WebCookieJar.h: Added.
* public/WebFrameClient.h:
(WebKit::WebFrameClient::cookieJar):
* public/WebKitClient.h:
(WebKit::WebKitClient::cookieJar):
(WebKit::WebKitClient::setCookies):
(WebKit::WebKitClient::cookies):
(WebKit::WebKitClient::rawCookies):
(WebKit::WebKitClient::deleteCookie):
(WebKit::WebKitClient::cookiesEnabled):
* src/ChromiumBridge.cpp:
(WebCore::getCookieJar):
(WebCore::ChromiumBridge::setCookies):
(WebCore::ChromiumBridge::cookies):
(WebCore::ChromiumBridge::rawCookies):
(WebCore::ChromiumBridge::deleteCookie):
(WebCore::ChromiumBridge::cookiesEnabled):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54742 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index efa9c76..e87a05d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-02-11 Darin Fisher <darin at chromium.org>
+
+ Reviewed by Jeremy Orlow.
+
+ Pass the Document along to the ChromiumBridge cookie methods.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34878
+
+ * platform/chromium/ChromiumBridge.h:
+ * platform/network/chromium/CookieJarChromium.cpp:
+ (WebCore::setCookies):
+ (WebCore::cookies):
+ (WebCore::cookiesEnabled):
+ (WebCore::getRawCookies):
+ (WebCore::deleteCookie):
+
2010-02-12 Eric Seidel <eric at webkit.org>
No review, rolling out r54694.
diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h
index 83f9c81..8551491 100644
--- a/WebCore/platform/chromium/ChromiumBridge.h
+++ b/WebCore/platform/chromium/ChromiumBridge.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Google Inc. All rights reserved.
+ * Copyright (c) 2010, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -83,12 +83,12 @@ namespace WebCore {
static void clipboardWriteImage(NativeImagePtr, const KURL&, const String&);
// Cookies ------------------------------------------------------------
- static void setCookies(const KURL& url, const KURL& firstPartyForCookies, const String& value);
- static String cookies(const KURL& url, const KURL& firstPartyForCookies);
- static String cookieRequestHeaderFieldValue(const KURL& url, const KURL& firstPartyForCookies);
- static bool rawCookies(const KURL& url, const KURL& firstPartyForCookies, Vector<Cookie>*);
- static void deleteCookie(const KURL& url, const String& cookieName);
- static bool cookiesEnabled(const KURL& url, const KURL& firstPartyForCookies);
+ static void setCookies(const Document*, const KURL&, const String& value);
+ static String cookies(const Document*, const KURL&);
+ static String cookieRequestHeaderFieldValue(const Document*, const KURL&);
+ static bool rawCookies(const Document*, const KURL& url, Vector<Cookie>&);
+ static void deleteCookie(const Document*, const KURL& url, const String& cookieName);
+ static bool cookiesEnabled(const Document*);
// DNS ----------------------------------------------------------------
static void prefetchDNS(const String& hostname);
diff --git a/WebCore/platform/network/chromium/CookieJarChromium.cpp b/WebCore/platform/network/chromium/CookieJarChromium.cpp
index 41cf331..e17816a 100644
--- a/WebCore/platform/network/chromium/CookieJarChromium.cpp
+++ b/WebCore/platform/network/chromium/CookieJarChromium.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Google Inc. All rights reserved.
+ * Copyright (c) 2010, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -39,46 +39,32 @@ namespace WebCore {
void setCookies(Document* document, const KURL& url, const String& value)
{
- ChromiumBridge::setCookies(url, document->firstPartyForCookies(), value);
+ ChromiumBridge::setCookies(document, url, value);
}
String cookies(const Document* document, const KURL& url)
{
- return ChromiumBridge::cookies(url, document->firstPartyForCookies());
+ return ChromiumBridge::cookies(document, url);
}
String cookieRequestHeaderFieldValue(const Document* document, const KURL& url)
{
- // FIXME: move in ChromiumBridge?
- Vector<Cookie> cookies;
- getRawCookies(document, url, cookies);
- String cookieLine;
- // FIXME: Set $Version=v;
- for (size_t i = 0; i < cookies.size(); i++) {
- Cookie cookie = cookies[i];
- if (i > 0)
- cookieLine += "; ";
- if (!cookie.name.isEmpty())
- cookieLine += cookie.name + "=";
- cookieLine += cookie.value;
- // FIXME: set $Path, $Domain, ...
- }
- return cookieLine;
+ return ChromiumBridge::cookieRequestHeaderFieldValue(document, url);
}
bool cookiesEnabled(const Document* document)
{
- return ChromiumBridge::cookiesEnabled(document->cookieURL(), document->firstPartyForCookies());
+ return ChromiumBridge::cookiesEnabled(document);
}
bool getRawCookies(const Document* document, const KURL& url, Vector<Cookie>& rawCookies)
{
- return ChromiumBridge::rawCookies(url, document->firstPartyForCookies(), &rawCookies);
+ return ChromiumBridge::rawCookies(document, url, rawCookies);
}
-void deleteCookie(const Document*, const KURL& url, const String& cookieName)
+void deleteCookie(const Document* document, const KURL& url, const String& cookieName)
{
- return ChromiumBridge::deleteCookie(url, cookieName);
+ return ChromiumBridge::deleteCookie(document, url, cookieName);
}
} // namespace WebCore
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 0fd3615..3ab0b04 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,30 @@
+2010-02-11 Darin Fisher <darin at chromium.org>
+
+ Reviewed by Jeremy Orlow.
+
+ Introduce WebCookieJar, and provide for a frame specific cookie jar.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34878
+
+ * WebKit.gyp:
+ * public/WebCookieJar.h: Added.
+ * public/WebFrameClient.h:
+ (WebKit::WebFrameClient::cookieJar):
+ * public/WebKitClient.h:
+ (WebKit::WebKitClient::cookieJar):
+ (WebKit::WebKitClient::setCookies):
+ (WebKit::WebKitClient::cookies):
+ (WebKit::WebKitClient::rawCookies):
+ (WebKit::WebKitClient::deleteCookie):
+ (WebKit::WebKitClient::cookiesEnabled):
+ * src/ChromiumBridge.cpp:
+ (WebCore::getCookieJar):
+ (WebCore::ChromiumBridge::setCookies):
+ (WebCore::ChromiumBridge::cookies):
+ (WebCore::ChromiumBridge::rawCookies):
+ (WebCore::ChromiumBridge::deleteCookie):
+ (WebCore::ChromiumBridge::cookiesEnabled):
+
2010-02-12 Pavel Feldman <pfeldman at chromium.org>
Reviewed by David Levin.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index 4b0ad2b..9550682 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -92,6 +92,7 @@
'public/WebConsoleMessage.h',
'public/WebContextMenuData.h',
'public/WebCookie.h',
+ 'public/WebCookieJar.h',
'public/WebCrossOriginPreflightResultCache.h',
'public/WebCString.h',
'public/WebCursorInfo.h',
diff --git a/WebKit/chromium/public/WebCookieJar.h b/WebKit/chromium/public/WebCookieJar.h
new file mode 100644
index 0000000..df70341
--- /dev/null
+++ b/WebKit/chromium/public/WebCookieJar.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebCookieJar_h
+#define WebCookieJar_h
+
+namespace WebKit {
+class WebString;
+class WebURL;
+struct WebCookie;
+template <typename T> class WebVector;
+
+class WebCookieJar {
+public:
+ virtual void setCookie(const WebURL&, const WebURL& firstPartyForCookies, const WebString& cookie) { }
+ virtual WebString cookies(const WebURL&, const WebURL& firstPartyForCookies) { return WebString(); }
+ virtual WebString cookieRequestHeaderFieldValue(const WebURL&, const WebURL& firstPartyForCookies) { return WebString(); }
+ virtual void rawCookies(const WebURL&, const WebURL& firstPartyForCookies, WebVector<WebCookie>&) { }
+ virtual void deleteCookie(const WebURL&, const WebString& cookieName) { }
+ virtual bool cookiesEnabled(const WebURL&, const WebURL& firstPartyForCookies) { return true; }
+
+protected:
+ ~WebCookieJar() { }
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/public/WebFrameClient.h b/WebKit/chromium/public/WebFrameClient.h
index 4078151..ae2541a 100644
--- a/WebKit/chromium/public/WebFrameClient.h
+++ b/WebKit/chromium/public/WebFrameClient.h
@@ -38,6 +38,7 @@
namespace WebKit {
+class WebCookieJar;
class WebDataSource;
class WebFormElement;
class WebFrame;
@@ -74,6 +75,12 @@ public:
// May return null.
virtual WebMediaPlayer* createMediaPlayer(WebFrame*, WebMediaPlayerClient*) { return 0; }
+
+ // Services ------------------------------------------------------------
+
+ // A frame specific cookie jar. May return null.
+ virtual WebCookieJar* cookieJar() { return 0; }
+
// General notifications -----------------------------------------------
diff --git a/WebKit/chromium/public/WebKitClient.h b/WebKit/chromium/public/WebKitClient.h
index fbaa218..c5a04b2 100644
--- a/WebKit/chromium/public/WebKitClient.h
+++ b/WebKit/chromium/public/WebKitClient.h
@@ -49,6 +49,7 @@ namespace WebKit {
class WebApplicationCacheHost;
class WebApplicationCacheHostClient;
class WebClipboard;
+class WebCookieJar;
class WebMessagePortChannel;
class WebMimeRegistry;
class WebPluginListBuilder;
@@ -75,6 +76,9 @@ public:
// May return null on some platforms.
virtual WebThemeEngine* themeEngine() { return 0; }
+ // May return null.
+ virtual WebCookieJar* cookieJar() { return 0; }
+
// Application Cache --------------------------------------------
@@ -177,12 +181,12 @@ public:
// Network -------------------------------------------------------------
- virtual void setCookies(
- const WebURL& url, const WebURL& firstPartyForCookies, const WebString& cookies) { }
- virtual WebString cookies(const WebURL& url, const WebURL& firstPartyForCookies) { return WebString(); }
- virtual bool rawCookies(const WebURL& url, const WebURL& firstPartyForCookies, WebVector<WebCookie>*) { return false; }
- virtual void deleteCookie(const WebURL& url, const WebString& cookieName) { }
- virtual bool cookiesEnabled(const WebURL& url, const WebURL& firstPartyForCookies) { return true; }
+ // These cookie methods are DEPRECATED in favor of cookieJar accessor.
+ virtual void setCookies(const WebURL&, const WebURL& firstPartyForCookies, const WebString& cookies) { }
+ virtual WebString cookies(const WebURL&, const WebURL& firstPartyForCookies) { return WebString(); }
+ virtual bool rawCookies(const WebURL&, const WebURL& firstPartyForCookies, WebVector<WebCookie>*) { return false; }
+ virtual void deleteCookie(const WebURL&, const WebString& cookieName) { }
+ virtual bool cookiesEnabled(const WebURL&, const WebURL& firstPartyForCookies) { return true; }
// A suggestion to prefetch IP information for the given hostname.
virtual void prefetchHostName(const WebString&) { }
diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp
index 0fd0825..3d81b01 100644
--- a/WebKit/chromium/src/ChromiumBridge.cpp
+++ b/WebKit/chromium/src/ChromiumBridge.cpp
@@ -37,6 +37,7 @@
#include "ChromeClientImpl.h"
#include "WebClipboard.h"
#include "WebCookie.h"
+#include "WebCookieJar.h"
#include "WebCursorInfo.h"
#include "WebData.h"
#include "WebFrameClient.h"
@@ -112,6 +113,17 @@ static WebWidgetClient* toWebWidgetClient(Widget* widget)
return chromeClientImpl->webView()->client();
}
+static WebCookieJar* getCookieJar(const Document* document)
+{
+ WebFrameImpl* frameImpl = WebFrameImpl::fromFrame(document->frame());
+ if (!frameImpl || !frameImpl->client())
+ return 0;
+ WebCookieJar* cookieJar = frameImpl->client()->cookieJar();
+ if (!cookieJar)
+ cookieJar = webKitClient()->cookieJar();
+ return cookieJar;
+}
+
// Clipboard ------------------------------------------------------------------
bool ChromiumBridge::clipboardIsFormatAvailable(
@@ -173,25 +185,51 @@ void ChromiumBridge::clipboardWriteImage(NativeImagePtr image,
// Cookies --------------------------------------------------------------------
-void ChromiumBridge::setCookies(const KURL& url,
- const KURL& firstPartyForCookies,
- const String& cookie)
+void ChromiumBridge::setCookies(const Document* document, const KURL& url,
+ const String& value)
+{
+ WebCookieJar* cookieJar = getCookieJar(document);
+ if (cookieJar)
+ cookieJar->setCookie(url, document->firstPartyForCookies(), value);
+ else
+ webKitClient()->setCookies(url, document->firstPartyForCookies(), value); // DEPRECATED
+}
+
+String ChromiumBridge::cookies(const Document* document, const KURL& url)
{
- webKitClient()->setCookies(url, firstPartyForCookies, cookie);
+ String result;
+ WebCookieJar* cookieJar = getCookieJar(document);
+ if (cookieJar)
+ result = cookieJar->cookies(url, document->firstPartyForCookies());
+ else
+ result = webKitClient()->cookies(url, document->firstPartyForCookies()); // DEPRECATED
+ return result;
}
-String ChromiumBridge::cookies(const KURL& url,
- const KURL& firstPartyForCookies)
+String ChromiumBridge::cookieRequestHeaderFieldValue(const Document* document,
+ const KURL& url)
{
- return webKitClient()->cookies(url, firstPartyForCookies);
+ String result;
+ WebCookieJar* cookieJar = getCookieJar(document);
+ if (cookieJar)
+ result = cookieJar->cookieRequestHeaderFieldValue(url, document->firstPartyForCookies());
+ else {
+ // FIXME: This does not return http-only cookies
+ result = webKitClient()->cookies(url, document->firstPartyForCookies()); // DEPRECATED
+ }
+ return result;
}
-bool ChromiumBridge::rawCookies(const KURL& url, const KURL& firstPartyForCookies, Vector<Cookie>* rawCookies)
+bool ChromiumBridge::rawCookies(const Document* document, const KURL& url, Vector<Cookie>& rawCookies)
{
- rawCookies->clear();
+ rawCookies.clear();
WebVector<WebCookie> webCookies;
- if (!webKitClient()->rawCookies(url, firstPartyForCookies, &webCookies))
- return false;
+
+ WebCookieJar* cookieJar = getCookieJar(document);
+ if (cookieJar)
+ cookieJar->rawCookies(url, document->firstPartyForCookies(), webCookies);
+ else
+ webKitClient()->rawCookies(url, document->firstPartyForCookies(), &webCookies); // DEPRECATED
for (unsigned i = 0; i < webCookies.size(); ++i) {
const WebCookie& webCookie = webCookies[i];
@@ -203,20 +241,29 @@ bool ChromiumBridge::rawCookies(const KURL& url, const KURL& firstPartyForCookie
webCookie.httpOnly,
webCookie.secure,
webCookie.session);
- rawCookies->append(cookie);
+ rawCookies.append(cookie);
}
return true;
}
-void ChromiumBridge::deleteCookie(const KURL& url, const String& cookieName)
+void ChromiumBridge::deleteCookie(const Document* document, const KURL& url, const String& cookieName)
{
- webKitClient()->deleteCookie(url, cookieName);
+ WebCookieJar* cookieJar = getCookieJar(document);
+ if (cookieJar)
+ cookieJar->deleteCookie(url, cookieName);
+ else
+ webKitClient()->deleteCookie(url, cookieName); // DEPRECATED
}
-bool ChromiumBridge::cookiesEnabled(const KURL& url,
- const KURL& firstPartyForCookies)
+bool ChromiumBridge::cookiesEnabled(const Document* document)
{
- return webKitClient()->cookiesEnabled(url, firstPartyForCookies);
+ bool result;
+ WebCookieJar* cookieJar = getCookieJar(document);
+ if (cookieJar)
+ result = cookieJar->cookiesEnabled(document->cookieURL(), document->firstPartyForCookies());
+ else
+ result = webKitClient()->cookiesEnabled(document->cookieURL(), document->firstPartyForCookies()); // DEPRECATED
+ return result;
}
// DNS ------------------------------------------------------------------------
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list