WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
WIP Patch
bug-99340-20121019153407.patch (text/plain), 21.04 KB, created by
Mark Pilgrim (Google)
on 2012-10-19 12:35:37 PDT
(
hide
)
Description:
WIP Patch
Filename:
MIME Type:
Creator:
Mark Pilgrim (Google)
Created:
2012-10-19 12:35:37 PDT
Size:
21.04 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 131931) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,49 @@ >+2012-10-19 Mark Pilgrim <pilgrim@chromium.org> >+ >+ [Chromium] Remove cookie-related functions from PlatformSupport >+ https://bugs.webkit.org/show_bug.cgi?id=99340 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Additional information of the change such as approach, rationale. Please add per-function descriptions below (OOPS!). >+ >+ No new tests (OOPS!). >+ >+ * Modules/websockets/WebSocketChannel.cpp: >+ (WebCore::WebSocketChannel::processBuffer): >+ * Modules/websockets/WebSocketHandshake.cpp: >+ (WebCore::WebSocketHandshake::clientHandshakeMessage): >+ (WebCore::WebSocketHandshake::clientHandshakeRequest): >+ * dom/Document.cpp: >+ (WebCore::Document::cookie): >+ (WebCore::Document::setCookie): >+ (WebCore): >+ (WebCore::Document::cookiesEnabled): >+ * dom/Document.h: >+ (Document): >+ * inspector/InspectorPageAgent.cpp: >+ (WebCore::InspectorPageAgent::getCookies): >+ (WebCore::InspectorPageAgent::deleteCookie): >+ * loader/FrameLoaderClient.h: >+ (WebCore): >+ (FrameLoaderClient): >+ (WebCore::FrameLoaderClient::cookieJar): >+ * page/Navigator.cpp: >+ (WebCore::Navigator::cookieEnabled): >+ * platform/CookieJar.h: >+ (WebCore): >+ (CookieJar): >+ (WebCore::CookieJar::CookieJar): >+ * platform/chromium/PlatformSupport.h: >+ (PlatformSupport): >+ * platform/network/chromium/CookieJarChromium.cpp: >+ (WebCore::CookieJar::setCookies): >+ (WebCore::CookieJar::cookies): >+ (WebCore::CookieJar::cookieRequestHeaderFieldValue): >+ (WebCore::CookieJar::cookiesEnabled): >+ (WebCore::CookieJar::getRawCookies): >+ (WebCore::CookieJar::deleteCookie): >+ > 2012-10-19 Justin Novosad <junov@chromium.org> > > [Chromium] Reduce memory footprint of canvas pattern object with deferred rendering >Index: Source/WebCore/Modules/websockets/WebSocketChannel.cpp >=================================================================== >--- Source/WebCore/Modules/websockets/WebSocketChannel.cpp (revision 131896) >+++ Source/WebCore/Modules/websockets/WebSocketChannel.cpp (working copy) >@@ -430,7 +430,7 @@ bool WebSocketChannel::processBuffer() > if (m_identifier) > InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(m_document, m_identifier, m_handshake->serverHandshakeResponse()); > if (!m_handshake->serverSetCookie().isEmpty()) { >- if (cookiesEnabled(m_document)) { >+ if (m_document->cookiesEnabled()) { > ExceptionCode ec; // Exception (for sandboxed documents) ignored. > m_document->setCookie(m_handshake->serverSetCookie(), ec); > } >Index: Source/WebCore/Modules/websockets/WebSocketHandshake.cpp >=================================================================== >--- Source/WebCore/Modules/websockets/WebSocketHandshake.cpp (revision 131896) >+++ Source/WebCore/Modules/websockets/WebSocketHandshake.cpp (working copy) >@@ -39,6 +39,9 @@ > #include "Cookie.h" > #include "CookieJar.h" > #include "Document.h" >+#include "Frame.h" >+#include "FrameLoader.h" >+#include "FrameLoaderClient.h" > #include "HTTPHeaderMap.h" > #include "HTTPParsers.h" > #include "KURL.h" >@@ -200,7 +203,12 @@ CString WebSocketHandshake::clientHandsh > KURL url = httpURLForAuthenticationAndCookies(); > if (m_context->isDocument()) { > Document* document = static_cast<Document*>(m_context); >- String cookie = cookieRequestHeaderFieldValue(document, url); >+ String cookie; >+ Frame* frame = document->frame(); >+ if (frame) { >+ CookieJar cookieJar = frame->loader()->client()->cookieJar(); >+ cookie = cookieJar.cookieRequestHeaderFieldValue(url, document->firstPartyForCookies()); >+ } > if (!cookie.isEmpty()) > fields.append("Cookie: " + cookie); > // Set "Cookie2: <cookie>" if cookies 2 exists for url? >@@ -249,7 +257,12 @@ PassRefPtr<WebSocketHandshakeRequest> We > KURL url = httpURLForAuthenticationAndCookies(); > if (m_context->isDocument()) { > Document* document = static_cast<Document*>(m_context); >- String cookie = cookieRequestHeaderFieldValue(document, url); >+ String cookie; >+ Frame* frame = document->frame(); >+ if (frame) { >+ CookieJar cookieJar = frame->loader()->client()->cookieJar(); >+ cookie = cookieJar.cookieRequestHeaderFieldValue(url, document->firstPartyForCookies()); >+ } > if (!cookie.isEmpty()) > request->addHeaderField("Cookie", cookie); > // Set "Cookie2: <cookie>" if cookies 2 exists for url? >Index: Source/WebCore/dom/Document.cpp >=================================================================== >--- Source/WebCore/dom/Document.cpp (revision 131896) >+++ Source/WebCore/dom/Document.cpp (working copy) >@@ -3815,7 +3815,9 @@ String Document::cookie(ExceptionCode& e > if (cookieURL.isEmpty()) > return String(); > >- return cookies(this, cookieURL); >+ if (!frame()) >+ return String(); >+ return frame()->loader()->client()->cookieJar().cookies(cookieURL, this->firstPartyForCookies()); > } > > void Document::setCookie(const String& value, ExceptionCode& ec) >@@ -3836,7 +3838,23 @@ void Document::setCookie(const String& v > if (cookieURL.isEmpty()) > return; > >- setCookies(this, cookieURL, value); >+ if (!frame()) >+ return; >+ frame()->loader()->client()->cookieJar().setCookies(cookieURL, this->firstPartyForCookies(), value); >+} >+ >+bool Document::cookiesEnabled() >+{ >+ if (!page()) >+ return false; >+ >+ if (!page()->settings()->cookieEnabled()) >+ return false; >+ >+ if (!frame()) >+ return false; >+ >+ return frame()->loader()->client()->cookieJar().cookiesEnabled(this->cookieURL(), this->firstPartyForCookies()); > } > > String Document::referrer() const >Index: Source/WebCore/dom/Document.h >=================================================================== >--- Source/WebCore/dom/Document.h (revision 131896) >+++ Source/WebCore/dom/Document.h (working copy) >@@ -817,6 +817,7 @@ public: > > String cookie(ExceptionCode&) const; > void setCookie(const String&, ExceptionCode&); >+ bool cookiesEnabled(); > > String referrer() const; > >Index: Source/WebCore/inspector/InspectorPageAgent.cpp >=================================================================== >--- Source/WebCore/inspector/InspectorPageAgent.cpp (revision 131896) >+++ Source/WebCore/inspector/InspectorPageAgent.cpp (working copy) >@@ -49,6 +49,8 @@ > #include "Document.h" > #include "DocumentLoader.h" > #include "Frame.h" >+#include "FrameLoader.h" >+#include "FrameLoaderClient.h" > #include "FrameView.h" > #include "GeolocationController.h" > #include "GeolocationError.h" >@@ -511,9 +513,10 @@ void InspectorPageAgent::getCookies(Erro > for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext(mainFrame())) { > Document* document = frame->document(); > Vector<KURL> allURLs = allResourcesURLsForFrame(frame); >+ CookieJar cookieJar = frame->loader()->client()->cookieJar(); > for (Vector<KURL>::const_iterator it = allURLs.begin(); it != allURLs.end(); ++it) { > Vector<Cookie> docCookiesList; >- rawCookiesImplemented = getRawCookies(document, KURL(ParsedURLString, *it), docCookiesList); >+ rawCookiesImplemented = cookieJar.getRawCookies(KURL(ParsedURLString, *it), document->firstPartyForCookies(), docCookiesList); > if (!rawCookiesImplemented) { > // FIXME: We need duplication checking for the String representation of cookies. > ExceptionCode ec = 0; >@@ -549,8 +552,9 @@ void InspectorPageAgent::deleteCookie(Er > continue; > > Vector<KURL> allURLs = allResourcesURLsForFrame(frame); >+ CookieJar cookieJar = frame->loader()->client()->cookieJar(); > for (Vector<KURL>::const_iterator it = allURLs.begin(); it != allURLs.end(); ++it) >- WebCore::deleteCookie(document, KURL(ParsedURLString, *it), cookieName); >+ cookieJar.deleteCookie(KURL(ParsedURLString, *it), cookieName); > } > } > >Index: Source/WebCore/loader/FrameLoaderClient.h >=================================================================== >--- Source/WebCore/loader/FrameLoaderClient.h (revision 131896) >+++ Source/WebCore/loader/FrameLoaderClient.h (working copy) >@@ -30,6 +30,7 @@ > #ifndef FrameLoaderClient_h > #define FrameLoaderClient_h > >+#include "CookieJar.h" > #include "FrameLoaderTypes.h" > #include "IconURL.h" > #include "LayoutMilestones.h" >@@ -64,6 +65,7 @@ namespace WebCore { > class AuthenticationChallenge; > class CachedFrame; > class Color; >+ class CookieJar; > class DOMWindowExtension; > class DOMWrapperWorld; > class DocumentLoader; >@@ -349,6 +351,8 @@ namespace WebCore { > #if ENABLE(MEDIA_STREAM) > virtual void dispatchWillStartUsingPeerConnectionHandler(RTCPeerConnectionHandler*) { } > #endif >+ >+ virtual CookieJar cookieJar() { return CookieJar(); } > }; > > } // namespace WebCore >Index: Source/WebCore/page/Navigator.cpp >=================================================================== >--- Source/WebCore/page/Navigator.cpp (revision 131896) >+++ Source/WebCore/page/Navigator.cpp (working copy) >@@ -23,7 +23,6 @@ > #include "config.h" > #include "Navigator.h" > >-#include "CookieJar.h" > #include "DOMMimeTypeArray.h" > #include "DOMPluginArray.h" > #include "Document.h" >@@ -118,7 +117,7 @@ bool Navigator::cookieEnabled() const > if (m_frame->page() && !m_frame->page()->settings()->cookieEnabled()) > return false; > >- return cookiesEnabled(m_frame->document()); >+ return m_frame->document()->cookiesEnabled(); > } > > bool Navigator::javaEnabled() const >Index: Source/WebCore/platform/CookieJar.h >=================================================================== >--- Source/WebCore/platform/CookieJar.h (revision 131896) >+++ Source/WebCore/platform/CookieJar.h (working copy) >@@ -26,6 +26,10 @@ > #ifndef CookieJar_h > #define CookieJar_h > >+#if PLATFORM(CHROMIUM) >+#include <public/WebCookieJar.h> >+#endif >+ > #include <wtf/Forward.h> > #include <wtf/HashSet.h> > #include <wtf/text/WTFString.h> >@@ -33,23 +37,34 @@ > > namespace WebCore { > >- class Document; >- class KURL; >+class KURL; >+struct Cookie; > >- struct Cookie; >+class CookieJar { >+public: >+#if PLATFORM(CHROMIUM) >+ CookieJar() { m_webCookieJar = 0; }; >+ CookieJar(WebKit::WebCookieJar* webCookieJar) { m_webCookieJar = webCookieJar; }; >+#endif > > // cookies omits HttpOnly cookies. >- String cookies(const Document*, const KURL&); >- String cookieRequestHeaderFieldValue(const Document*, const KURL&); >- void setCookies(Document*, const KURL&, const String&); >- bool cookiesEnabled(const Document*); >- bool getRawCookies(const Document*, const KURL&, Vector<Cookie>&); >- void deleteCookie(const Document*, const KURL&, const String&); >+ String cookies(const KURL&, const KURL&); >+ String cookieRequestHeaderFieldValue(const KURL&, const KURL&); >+ void setCookies(const KURL&, const KURL&, const String&); >+ bool cookiesEnabled(const KURL&, const KURL&); >+ bool getRawCookies(const KURL&, const KURL&, Vector<Cookie>&); >+ void deleteCookie(const KURL&, const String&); > > void getHostnamesWithCookies(HashSet<String>& hostnames); > void deleteCookiesForHostname(const String& hostname); > void deleteAllCookies(); > >-} >+#if PLATFORM(CHROMIUM) >+private: >+ WebKit::WebCookieJar* m_webCookieJar; >+#endif >+}; >+ >+} // namespace WebCore > > #endif >Index: Source/WebCore/platform/chromium/PlatformSupport.h >=================================================================== >--- Source/WebCore/platform/chromium/PlatformSupport.h (revision 131896) >+++ Source/WebCore/platform/chromium/PlatformSupport.h (working copy) >@@ -78,14 +78,6 @@ struct FontRenderStyle; > > class PlatformSupport { > public: >- // Cookies ------------------------------------------------------------ >- 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&, Vector<Cookie>&); >- static void deleteCookie(const Document*, const KURL&, const String& cookieName); >- static bool cookiesEnabled(const Document*); >- > // Font --------------------------------------------------------------- > #if OS(WINDOWS) > static bool ensureFontLoaded(HFONT); >Index: Source/WebCore/platform/network/chromium/CookieJarChromium.cpp >=================================================================== >--- Source/WebCore/platform/network/chromium/CookieJarChromium.cpp (revision 131896) >+++ Source/WebCore/platform/network/chromium/CookieJarChromium.cpp (working copy) >@@ -35,36 +35,61 @@ > #include "Document.h" > #include "PlatformSupport.h" > >+#include <public/WebCookie.h> >+#include <public/WebCookieJar.h> >+#include <public/WebString.h> >+#include <public/WebURL.h> >+#include <public/WebVector.h> >+ > namespace WebCore { > >-void setCookies(Document* document, const KURL& url, const String& value) >+void CookieJar::setCookies(const KURL& url, const KURL& firstPartyForCookies, const String& value) > { >- PlatformSupport::setCookies(document, url, value); >+ if (m_webCookieJar) >+ m_webCookieJar->setCookie(url, firstPartyForCookies, value); > } > >-String cookies(const Document* document, const KURL& url) >+String CookieJar::cookies(const KURL& url, const KURL& firstPartyForCookies) > { >- return PlatformSupport::cookies(document, url); >+ if (!m_webCookieJar) >+ return String(); >+ return m_webCookieJar->cookies(url, firstPartyForCookies); > } > >-String cookieRequestHeaderFieldValue(const Document* document, const KURL& url) >+String CookieJar::cookieRequestHeaderFieldValue(const KURL& url, const KURL& firstPartyForCookies) > { >- return PlatformSupport::cookieRequestHeaderFieldValue(document, url); >+ if (!m_webCookieJar) >+ return String(); >+ return m_webCookieJar->cookieRequestHeaderFieldValue(url, firstPartyForCookies); > } > >-bool cookiesEnabled(const Document* document) >+bool CookieJar::cookiesEnabled(const KURL& url, const KURL& firstPartyForCookies) > { >- return PlatformSupport::cookiesEnabled(document); >+ if (!m_webCookieJar) >+ return false; >+ return m_webCookieJar->cookiesEnabled(url, firstPartyForCookies); > } > >-bool getRawCookies(const Document* document, const KURL& url, Vector<Cookie>& rawCookies) >+bool CookieJar::getRawCookies(const KURL& url, const KURL& firstPartyForCookies, Vector<Cookie>& rawCookies) > { >- return PlatformSupport::rawCookies(document, url, rawCookies); >+ rawCookies.clear(); >+ WebKit::WebVector<WebKit::WebCookie> webCookies; >+ >+ if (m_webCookieJar) >+ m_webCookieJar->rawCookies(url, firstPartyForCookies, webCookies); >+ >+ for (unsigned i = 0; i < webCookies.size(); ++i) { >+ const WebKit::WebCookie& webCookie = webCookies[i]; >+ Cookie cookie(webCookie.name, webCookie.value, webCookie.domain, webCookie.path, webCookie.expires, webCookie.httpOnly, webCookie.secure, webCookie.session); >+ rawCookies.append(cookie); >+ } >+ return true; > } > >-void deleteCookie(const Document* document, const KURL& url, const String& cookieName) >+void CookieJar::deleteCookie(const KURL& url, const String& cookieName) > { >- return PlatformSupport::deleteCookie(document, url, cookieName); >+ if (m_webCookieJar) >+ m_webCookieJar->deleteCookie(url, cookieName); > } > > void getHostnamesWithCookies(HashSet<String>& hostnames) >Index: Source/WebKit/chromium/ChangeLog >=================================================================== >--- Source/WebKit/chromium/ChangeLog (revision 131931) >+++ Source/WebKit/chromium/ChangeLog (working copy) >@@ -1,3 +1,19 @@ >+2012-10-19 Mark Pilgrim <pilgrim@chromium.org> >+ >+ [Chromium] Remove cookie-related functions from PlatformSupport >+ https://bugs.webkit.org/show_bug.cgi?id=99340 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Additional information of the change such as approach, rationale. Please add per-function descriptions below (OOPS!). >+ >+ * src/FrameLoaderClientImpl.cpp: >+ (WebKit::FrameLoaderClientImpl::cookieJar): >+ * src/FrameLoaderClientImpl.h: >+ (FrameLoaderClientImpl): >+ * src/PlatformSupport.cpp: >+ (WebCore): >+ > 2012-09-08 Alpha Lam <hclam@chromium.org> > > [chromium] Implement deferred image decoding >Index: Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp >=================================================================== >--- Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp (revision 131896) >+++ Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp (working copy) >@@ -1648,5 +1648,15 @@ void FrameLoaderClientImpl::dispatchWill > } > #endif > >+WebCore::CookieJar FrameLoaderClientImpl::cookieJar() >+{ >+ WebFrameImpl* frameImpl = WebFrameImpl::fromFrame(m_webFrame->frame()->document()->frame()); >+ if (!frameImpl || !frameImpl->client()) >+ return WebCore::CookieJar(0); >+ WebCookieJar* webCookieJar = frameImpl->client()->cookieJar(frameImpl); >+ if (!webCookieJar) >+ webCookieJar = WebKit::Platform::current()->cookieJar(); >+ return WebCore::CookieJar(webCookieJar); >+} > > } // namespace WebKit >Index: Source/WebKit/chromium/src/FrameLoaderClientImpl.h >=================================================================== >--- Source/WebKit/chromium/src/FrameLoaderClientImpl.h (revision 131896) >+++ Source/WebKit/chromium/src/FrameLoaderClientImpl.h (working copy) >@@ -225,6 +225,8 @@ public: > virtual void dispatchWillStartUsingPeerConnectionHandler(WebCore::RTCPeerConnectionHandler*) OVERRIDE; > #endif > >+ virtual WebCore::CookieJar cookieJar() OVERRIDE; >+ > private: > void makeDocumentView(); > >Index: Source/WebKit/chromium/src/PlatformSupport.cpp >=================================================================== >--- Source/WebKit/chromium/src/PlatformSupport.cpp (revision 131896) >+++ Source/WebKit/chromium/src/PlatformSupport.cpp (working copy) >@@ -124,86 +124,6 @@ static WebWidgetClient* toWebWidgetClien > return static_cast<WebViewImpl*>(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(frameImpl); >- if (!cookieJar) >- cookieJar = WebKit::Platform::current()->cookieJar(); >- return cookieJar; >-} >- >-// Cookies -------------------------------------------------------------------- >- >-void PlatformSupport::setCookies(const Document* document, const KURL& url, >- const String& value) >-{ >- WebCookieJar* cookieJar = getCookieJar(document); >- if (cookieJar) >- cookieJar->setCookie(url, document->firstPartyForCookies(), value); >-} >- >-String PlatformSupport::cookies(const Document* document, const KURL& url) >-{ >- String result; >- WebCookieJar* cookieJar = getCookieJar(document); >- if (cookieJar) >- result = cookieJar->cookies(url, document->firstPartyForCookies()); >- return result; >-} >- >-String PlatformSupport::cookieRequestHeaderFieldValue(const Document* document, >- const KURL& url) >-{ >- String result; >- WebCookieJar* cookieJar = getCookieJar(document); >- if (cookieJar) >- result = cookieJar->cookieRequestHeaderFieldValue(url, document->firstPartyForCookies()); >- return result; >-} >- >-bool PlatformSupport::rawCookies(const Document* document, const KURL& url, Vector<Cookie>& rawCookies) >-{ >- rawCookies.clear(); >- WebVector<WebCookie> webCookies; >- >- WebCookieJar* cookieJar = getCookieJar(document); >- if (cookieJar) >- cookieJar->rawCookies(url, document->firstPartyForCookies(), webCookies); >- >- for (unsigned i = 0; i < webCookies.size(); ++i) { >- const WebCookie& webCookie = webCookies[i]; >- Cookie cookie(webCookie.name, >- webCookie.value, >- webCookie.domain, >- webCookie.path, >- webCookie.expires, >- webCookie.httpOnly, >- webCookie.secure, >- webCookie.session); >- rawCookies.append(cookie); >- } >- return true; >-} >- >-void PlatformSupport::deleteCookie(const Document* document, const KURL& url, const String& cookieName) >-{ >- WebCookieJar* cookieJar = getCookieJar(document); >- if (cookieJar) >- cookieJar->deleteCookie(url, cookieName); >-} >- >-bool PlatformSupport::cookiesEnabled(const Document* document) >-{ >- bool result = false; >- WebCookieJar* cookieJar = getCookieJar(document); >- if (cookieJar) >- result = cookieJar->cookiesEnabled(document->cookieURL(), document->firstPartyForCookies()); >- return result; >-} >- > // Font ----------------------------------------------------------------------- > > #if OS(WINDOWS)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 99340
:
168741
|
169674
|
169683
|
170450
|
170456
|
170459
|
171274
|
171280
|
171282
|
171284
|
171287
|
171290
|
171293
|
171296
|
171684
|
171848
|
171875
|
171908
|
172373
|
172384
|
172862
|
172878
|
173031
|
174188
|
174206
|
174675
|
174753