Diff
Modified: trunk/Source/WebCore/ChangeLog (204701 => 204702)
--- trunk/Source/WebCore/ChangeLog 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebCore/ChangeLog 2016-08-22 06:02:52 UTC (rev 204702)
@@ -1,5 +1,42 @@
2016-08-21 Alex Christensen <[email protected]>
+ Use Document& instead of Document* when getting cookies
+ https://bugs.webkit.org/show_bug.cgi?id=161011
+
+ Reviewed by Darin Adler.
+
+ No change in behavior.
+
+ * 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::Document::referrer):
+ * inspector/InspectorPageAgent.cpp:
+ (WebCore::InspectorPageAgent::getCookies):
+ (WebCore::InspectorPageAgent::deleteCookie):
+ (WebCore::InspectorPageAgent::getResourceTree):
+ * loader/CookieJar.cpp:
+ (WebCore::networkingContext):
+ (WebCore::storageSession):
+ (WebCore::cookies):
+ (WebCore::setCookies):
+ (WebCore::cookiesEnabled):
+ (WebCore::cookieRequestHeaderFieldValue):
+ (WebCore::getRawCookies):
+ (WebCore::deleteCookie):
+ (WebCore::addCookie):
+ * loader/CookieJar.h:
+ * page/Navigator.cpp:
+ (WebCore::Navigator::cookieEnabled):
+ (WebCore::Navigator::javaEnabled):
+
+2016-08-21 Alex Christensen <[email protected]>
+
URLParser should parse IPv4 addresses
https://bugs.webkit.org/show_bug.cgi?id=161023
Modified: trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp (204701 => 204702)
--- trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp 2016-08-22 06:02:52 UTC (rev 204702)
@@ -444,7 +444,7 @@
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(*m_document)) {
// Exception (for sandboxed documents) ignored.
m_document->setCookie(m_handshake->serverSetCookie(), IGNORE_EXCEPTION);
}
Modified: trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp (204701 => 204702)
--- trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp 2016-08-22 06:02:52 UTC (rev 204702)
@@ -200,8 +200,8 @@
fields.append("Sec-WebSocket-Protocol: " + m_clientProtocol);
URL url = ""
- if (m_allowCookies) {
- String cookie = cookieRequestHeaderFieldValue(m_document, url);
+ if (m_allowCookies && m_document) {
+ String cookie = cookieRequestHeaderFieldValue(*m_document, url);
if (!cookie.isEmpty())
fields.append("Cookie: " + cookie);
}
@@ -249,8 +249,8 @@
request.setHTTPHeaderField(HTTPHeaderName::SecWebSocketProtocol, m_clientProtocol);
URL url = ""
- if (m_allowCookies) {
- String cookie = cookieRequestHeaderFieldValue(m_document, url);
+ if (m_allowCookies && m_document) {
+ String cookie = cookieRequestHeaderFieldValue(*m_document, url);
if (!cookie.isEmpty())
request.setHTTPHeaderField(HTTPHeaderName::Cookie, cookie);
}
Modified: trunk/Source/WebCore/dom/Document.cpp (204701 => 204702)
--- trunk/Source/WebCore/dom/Document.cpp 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebCore/dom/Document.cpp 2016-08-22 06:02:52 UTC (rev 204702)
@@ -4437,7 +4437,7 @@
return String();
if (!isDOMCookieCacheValid())
- setCachedDOMCookies(cookies(this, cookieURL));
+ setCachedDOMCookies(cookies(*this, cookieURL));
return cachedDOMCookies();
}
@@ -4461,7 +4461,7 @@
return;
invalidateDOMCookieCache();
- setCookies(this, cookieURL, value);
+ setCookies(*this, cookieURL, value);
}
String Document::referrer() const
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (204701 => 204702)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-08-22 06:02:52 UTC (rev 204702)
@@ -6415,7 +6415,7 @@
bool HTMLMediaElement::mediaPlayerGetRawCookies(const URL& url, Vector<Cookie>& cookies) const
{
- return getRawCookies(&document(), url, cookies);
+ return getRawCookies(document(), url, cookies);
}
#endif
Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (204701 => 204702)
--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp 2016-08-22 06:02:52 UTC (rev 204702)
@@ -516,10 +516,12 @@
for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
Document* document = frame->document();
+ if (!document)
+ continue;
for (auto& url : allResourcesURLsForFrame(frame)) {
Vector<Cookie> docCookiesList;
- rawCookiesImplemented = getRawCookies(document, URL(ParsedURLString, url), docCookiesList);
+ rawCookiesImplemented = getRawCookies(*document, URL(ParsedURLString, url), docCookiesList);
if (!rawCookiesImplemented) {
// FIXME: We need duplication checking for the String representation of cookies.
@@ -545,8 +547,10 @@
void InspectorPageAgent::deleteCookie(ErrorString&, const String& cookieName, const String& url)
{
URL parsedURL(ParsedURLString, url);
- for (Frame* frame = &m_page.mainFrame(); frame; frame = frame->tree().traverseNext())
- WebCore::deleteCookie(frame->document(), parsedURL, cookieName);
+ for (Frame* frame = &m_page.mainFrame(); frame; frame = frame->tree().traverseNext()) {
+ if (auto* document = frame->document())
+ WebCore::deleteCookie(*document, parsedURL, cookieName);
+ }
}
void InspectorPageAgent::getResourceTree(ErrorString&, RefPtr<Inspector::Protocol::Page::FrameResourceTree>& object)
Modified: trunk/Source/WebCore/loader/CookieJar.cpp (204701 => 204702)
--- trunk/Source/WebCore/loader/CookieJar.cpp 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebCore/loader/CookieJar.cpp 2016-08-22 06:02:52 UTC (rev 204702)
@@ -37,12 +37,10 @@
namespace WebCore {
-static NetworkingContext* networkingContext(const Document* document)
+static NetworkingContext* networkingContext(const Document& document)
{
// FIXME: Returning 0 means falling back to default context. That's not a choice that is appropriate to do at runtime
- if (!document)
- return nullptr;
- Frame* frame = document->frame();
+ Frame* frame = document.frame();
if (!frame)
return nullptr;
@@ -49,43 +47,43 @@
return frame->loader().networkingContext();
}
-inline NetworkStorageSession& storageSession(const Document* document)
+inline NetworkStorageSession& storageSession(const Document& document)
{
NetworkingContext* context = networkingContext(document);
return context ? context->storageSession() : NetworkStorageSession::defaultStorageSession();
}
-String cookies(const Document* document, const URL& url)
+String cookies(const Document& document, const URL& url)
{
- return platformStrategies()->cookiesStrategy()->cookiesForDOM(storageSession(document), document->firstPartyForCookies(), url);
+ return platformStrategies()->cookiesStrategy()->cookiesForDOM(storageSession(document), document.firstPartyForCookies(), url);
}
-void setCookies(Document* document, const URL& url, const String& cookieString)
+void setCookies(Document& document, const URL& url, const String& cookieString)
{
- platformStrategies()->cookiesStrategy()->setCookiesFromDOM(storageSession(document), document->firstPartyForCookies(), url, cookieString);
+ platformStrategies()->cookiesStrategy()->setCookiesFromDOM(storageSession(document), document.firstPartyForCookies(), url, cookieString);
}
-bool cookiesEnabled(const Document* document)
+bool cookiesEnabled(const Document& document)
{
- return platformStrategies()->cookiesStrategy()->cookiesEnabled(storageSession(document), document->firstPartyForCookies(), document->cookieURL());
+ return platformStrategies()->cookiesStrategy()->cookiesEnabled(storageSession(document), document.firstPartyForCookies(), document.cookieURL());
}
-String cookieRequestHeaderFieldValue(const Document* document, const URL& url)
+String cookieRequestHeaderFieldValue(const Document& document, const URL& url)
{
- return platformStrategies()->cookiesStrategy()->cookieRequestHeaderFieldValue(storageSession(document), document->firstPartyForCookies(), url);
+ return platformStrategies()->cookiesStrategy()->cookieRequestHeaderFieldValue(storageSession(document), document.firstPartyForCookies(), url);
}
-bool getRawCookies(const Document* document, const URL& url, Vector<Cookie>& cookies)
+bool getRawCookies(const Document& document, const URL& url, Vector<Cookie>& cookies)
{
- return platformStrategies()->cookiesStrategy()->getRawCookies(storageSession(document), document->firstPartyForCookies(), url, cookies);
+ return platformStrategies()->cookiesStrategy()->getRawCookies(storageSession(document), document.firstPartyForCookies(), url, cookies);
}
-void deleteCookie(const Document* document, const URL& url, const String& cookieName)
+void deleteCookie(const Document& document, const URL& url, const String& cookieName)
{
platformStrategies()->cookiesStrategy()->deleteCookie(storageSession(document), url, cookieName);
}
-void addCookie(const Document* document, const URL& url, const Cookie& cookie)
+void addCookie(const Document& document, const URL& url, const Cookie& cookie)
{
platformStrategies()->cookiesStrategy()->addCookie(storageSession(document), url, cookie);
}
Modified: trunk/Source/WebCore/loader/CookieJar.h (204701 => 204702)
--- trunk/Source/WebCore/loader/CookieJar.h 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebCore/loader/CookieJar.h 2016-08-22 06:02:52 UTC (rev 204702)
@@ -39,14 +39,14 @@
// Functions in this file take a Document pointer to determine which cookie storage to use. We should merge that into call sites, and use PlatformCookieJar directly.
// These two functions implement document.cookie API, with special rules for HttpOnly cookies.
-WEBCORE_EXPORT String cookies(const Document*, const URL&);
-WEBCORE_EXPORT void setCookies(Document*, const URL&, const String& cookieString);
+WEBCORE_EXPORT String cookies(const Document&, const URL&);
+WEBCORE_EXPORT void setCookies(Document&, const URL&, const String& cookieString);
-WEBCORE_EXPORT bool cookiesEnabled(const Document*);
-WEBCORE_EXPORT String cookieRequestHeaderFieldValue(const Document*, const URL&);
-WEBCORE_EXPORT bool getRawCookies(const Document*, const URL&, Vector<Cookie>&);
-WEBCORE_EXPORT void deleteCookie(const Document*, const URL&, const String& cookieName);
-WEBCORE_EXPORT void addCookie(const Document*, const URL&, const Cookie&);
+WEBCORE_EXPORT bool cookiesEnabled(const Document&);
+WEBCORE_EXPORT String cookieRequestHeaderFieldValue(const Document&, const URL&);
+WEBCORE_EXPORT bool getRawCookies(const Document&, const URL&, Vector<Cookie>&);
+WEBCORE_EXPORT void deleteCookie(const Document&, const URL&, const String& cookieName);
+WEBCORE_EXPORT void addCookie(const Document&, const URL&, const Cookie&);
}
Modified: trunk/Source/WebCore/page/Navigator.cpp (204701 => 204702)
--- trunk/Source/WebCore/page/Navigator.cpp 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebCore/page/Navigator.cpp 2016-08-22 06:02:52 UTC (rev 204702)
@@ -111,7 +111,11 @@
if (m_frame->page() && !m_frame->page()->settings().cookieEnabled())
return false;
- return cookiesEnabled(m_frame->document());
+ auto* document = m_frame->document();
+ if (!document)
+ return false;
+
+ return cookiesEnabled(*document);
}
bool Navigator::javaEnabled() const
Modified: trunk/Source/WebKit/mac/ChangeLog (204701 => 204702)
--- trunk/Source/WebKit/mac/ChangeLog 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebKit/mac/ChangeLog 2016-08-22 06:02:52 UTC (rev 204702)
@@ -1,3 +1,17 @@
+2016-08-21 Alex Christensen <[email protected]>
+
+ Use Document& instead of Document* when getting cookies
+ https://bugs.webkit.org/show_bug.cgi?id=161011
+
+ Reviewed by Darin Adler.
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::getCookies):
+ (WebKit::NetscapePluginInstanceProxy::setCookies):
+ * Plugins/WebNetscapePluginView.mm:
+ (-[WebNetscapePluginView getVariable:forURL:value:length:]):
+ (-[WebNetscapePluginView setVariable:forURL:value:length:]):
+
2016-08-16 Simon Fraser <[email protected]>
Rename didLayout(LayoutMilestones) to didReachLayoutMilestone(), and related WK2 functions
Modified: trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm (204701 => 204702)
--- trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm 2016-08-22 06:02:52 UTC (rev 204702)
@@ -1525,7 +1525,11 @@
return false;
if (Frame* frame = core([m_pluginView webFrame])) {
- String cookieString = cookies(frame->document(), url);
+ auto* document = frame->document();
+ if (!document)
+ return false;
+
+ String cookieString = cookies(*document, url);
WTF::CString cookieStringUTF8 = cookieString.utf8();
if (cookieStringUTF8.isNull())
return false;
@@ -1552,8 +1556,12 @@
String cookieString = String::fromUTF8(cookiesData, cookiesLength);
if (!cookieString)
return false;
-
- WebCore::setCookies(frame->document(), url, cookieString);
+
+ auto* document = frame->document();
+ if (!document)
+ return false;
+
+ WebCore::setCookies(*document, url, cookieString);
return true;
}
Modified: trunk/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm (204701 => 204702)
--- trunk/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm 2016-08-22 06:02:52 UTC (rev 204702)
@@ -2127,7 +2127,11 @@
break;
if (Frame* frame = core([self webFrame])) {
- String cookieString = cookies(frame->document(), URL);
+ auto* document = frame->document();
+ if (!document)
+ break;
+
+ String cookieString = cookies(*document, URL);
CString cookieStringUTF8 = cookieString.utf8();
if (cookieStringUTF8.isNull())
return NPERR_GENERIC_ERROR;
@@ -2177,7 +2181,8 @@
break;
if (Frame* frame = core([self webFrame])) {
- setCookies(frame->document(), URL, cookieString);
+ if (auto* document = frame->document())
+ setCookies(*document, URL, cookieString);
return NPERR_NO_ERROR;
}
Modified: trunk/Source/WebKit/win/ChangeLog (204701 => 204702)
--- trunk/Source/WebKit/win/ChangeLog 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebKit/win/ChangeLog 2016-08-22 06:02:52 UTC (rev 204702)
@@ -1,3 +1,13 @@
+2016-08-21 Alex Christensen <[email protected]>
+
+ Use Document& instead of Document* when getting cookies
+ https://bugs.webkit.org/show_bug.cgi?id=161011
+
+ Reviewed by Darin Adler.
+
+ * Plugins/PluginView.cpp:
+ (WebCore::PluginView::getValueForURL):
+
2016-08-16 Simon Fraser <[email protected]>
Rename didLayout(LayoutMilestones) to didReachLayoutMilestone(), and related WK2 functions
Modified: trunk/Source/WebKit/win/Plugins/PluginView.cpp (204701 => 204702)
--- trunk/Source/WebKit/win/Plugins/PluginView.cpp 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebKit/win/Plugins/PluginView.cpp 2016-08-22 06:02:52 UTC (rev 204702)
@@ -1281,8 +1281,8 @@
URL u(m_parentFrame->document()->baseURL(), url);
if (u.isValid()) {
Frame* frame = getFrame(parentFrame(), m_element);
- if (frame) {
- const CString cookieStr = cookies(frame->document(), u).utf8();
+ if (frame && frame->document()) {
+ const CString cookieStr = cookies(*frame->document(), u).utf8();
if (!cookieStr.isNull()) {
const int size = cookieStr.length();
*value = static_cast<char*>(NPN_MemAlloc(size+1));
@@ -1343,8 +1343,8 @@
if (u.isValid()) {
const String cookieStr = String::fromUTF8(value, len);
Frame* frame = getFrame(parentFrame(), m_element);
- if (frame && !cookieStr.isEmpty())
- setCookies(frame->document(), u, cookieStr);
+ if (frame && frame->document() && !cookieStr.isEmpty())
+ setCookies(*frame->document(), u, cookieStr);
} else
result = NPERR_INVALID_URL;
break;
Modified: trunk/Source/WebKit2/ChangeLog (204701 => 204702)
--- trunk/Source/WebKit2/ChangeLog 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebKit2/ChangeLog 2016-08-22 06:02:52 UTC (rev 204702)
@@ -1,3 +1,18 @@
+2016-08-21 Alex Christensen <[email protected]>
+
+ Use Document& instead of Document* when getting cookies
+ https://bugs.webkit.org/show_bug.cgi?id=161011
+
+ Reviewed by Darin Adler.
+
+ * WebProcess/Automation/WebAutomationSessionProxy.cpp:
+ (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
+ (WebKit::WebAutomationSessionProxy::deleteCookie):
+ * WebProcess/Plugins/PluginView.cpp:
+ (WebKit::PluginView::cookiesForURL):
+ (WebKit::PluginView::setCookiesForURL):
+ (WebKit::PluginView::getAuthenticationInfo):
+
2016-08-20 Gyuyoung Kim <[email protected]>
Unreviewed EFL build fix since r204668
Modified: trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp (204701 => 204702)
--- trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp 2016-08-22 06:02:52 UTC (rev 204702)
@@ -556,9 +556,9 @@
}
// This returns the same list of cookies as when evaluating `document.cookies` in _javascript_.
- WebCore::Document* document = frame->coreFrame()->document();
+ auto& document = *frame->coreFrame()->document();
Vector<WebCore::Cookie> foundCookies;
- WebCore::getRawCookies(document, document->cookieURL(), foundCookies);
+ WebCore::getRawCookies(document, document.cookieURL(), foundCookies);
WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidGetCookiesForFrame(callbackID, foundCookies, String()), 0);
}
@@ -579,8 +579,8 @@
return;
}
- WebCore::Document* document = frame->coreFrame()->document();
- WebCore::deleteCookie(document, document->cookieURL(), cookieName);
+ auto& document = *frame->coreFrame()->document();
+ WebCore::deleteCookie(document, document.cookieURL(), cookieName);
WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidDeleteCookie(callbackID, String()), 0);
}
Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (204701 => 204702)
--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp 2016-08-22 05:42:12 UTC (rev 204701)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp 2016-08-22 06:02:52 UTC (rev 204702)
@@ -1615,12 +1615,12 @@
String PluginView::cookiesForURL(const String& urlString)
{
- return cookies(&m_pluginElement->document(), URL(URL(), urlString));
+ return cookies(m_pluginElement->document(), URL(URL(), urlString));
}
void PluginView::setCookiesForURL(const String& urlString, const String& cookieString)
{
- setCookies(&m_pluginElement->document(), URL(URL(), urlString), cookieString);
+ setCookies(m_pluginElement->document(), URL(URL(), urlString), cookieString);
}
bool PluginView::getAuthenticationInfo(const ProtectionSpace& protectionSpace, String& username, String& password)