Commit e5dfd3d1 authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

[BlackBerry] HTTP GET header has a "Cookie" when refreshing a page after cookies have been cleared.

https://bugs.webkit.org/show_bug.cgi?id=84223

Patch by Jason Liu <jason.liu@torchmobile.com.cn> on 2012-04-18
Reviewed by George Staikos.

.:

* ManualTests/blackberry/clear-cookie-refresh-result.php: Added.
* ManualTests/blackberry/clear-cookie-refresh.php: Added.

Source/WebCore:

Webkit uses the old ResourceRequest when refreshing. Its cookies' header isn't removed after clicking
"clear cookies" button. We need to set cookies for this request again.

We must click "clear button" to test, so have to write a manual test case.

Test: ManualTests/blackberry/clear-cookie-refresh.php

* platform/network/blackberry/ResourceRequestBlackBerry.cpp:
(WebCore::ResourceRequest::initializePlatformRequest):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114498 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2e5e6a3d
2012-04-18 Jason Liu <jason.liu@torchmobile.com.cn>
[BlackBerry] HTTP GET header has a "Cookie" when refreshing a page after cookies have been cleared.
https://bugs.webkit.org/show_bug.cgi?id=84223
Reviewed by George Staikos.
* ManualTests/blackberry/clear-cookie-refresh-result.php: Added.
* ManualTests/blackberry/clear-cookie-refresh.php: Added.
2012-04-17 Yong Li <yoli@rim.com>
 
REGRESSION (r105453): Crash when handling touch events
......
<?php
echo 'This tests the function of clear cookies by clicking "Clear Cookies" button from Settings -> Privacy & Security.<br>';
echo 'It is for https://bugs.webkit.org/show_bug.cgi?id=84223.<br>';
echo 'Please clear the cookies from Settings -> Privacy & Security by pressing "Clear Cookies" button, then refresh this page to see the result.<br>';
if (isset($_COOKIE["cookieName"])) {
echo 'result: NOT PASS';
} else {
echo 'result: PASS';
}
?>
<?php
setcookie("cookieName", "cookieValue");
header("Location: clear-cookie-refresh-result.php");
?>
2012-04-18 Jason Liu <jason.liu@torchmobile.com.cn>
[BlackBerry] HTTP GET header has a "Cookie" when refreshing a page after cookies have been cleared.
https://bugs.webkit.org/show_bug.cgi?id=84223
Reviewed by George Staikos.
Webkit uses the old ResourceRequest when refreshing. Its cookies' header isn't removed after clicking
"clear cookies" button. We need to set cookies for this request again.
We must click "clear button" to test, so have to write a manual test case.
Test: ManualTests/blackberry/clear-cookie-refresh.php
* platform/network/blackberry/ResourceRequestBlackBerry.cpp:
(WebCore::ResourceRequest::initializePlatformRequest):
2012-04-17 Pavel Feldman <pfeldman@chromium.org>
 
Web Inspector: [Chromium] Module's require injects scripts before the debug id is set to the context.
......@@ -190,6 +190,9 @@ void ResourceRequest::initializePlatformRequest(NetworkRequest& platformRequest,
}
}
// When ResourceRequest is reused by CacheResourceLoader, page refreshing or redirection, its cookies may be dirtied. We won't use these cookies any more.
bool cookieHeaderMayBeDirty = isRedirect || cachePolicy() == WebCore::ReloadIgnoringCacheData || cachePolicy() == WebCore::ReturnCacheDataElseLoad;
for (HTTPHeaderMap::const_iterator it = httpHeaderFields().begin(); it != httpHeaderFields().end(); ++it) {
String key = it->first;
String value = it->second;
......@@ -198,14 +201,14 @@ void ResourceRequest::initializePlatformRequest(NetworkRequest& platformRequest,
// We wo't use the old cookies of resourceRequest for new location because these cookies may be changed by redirection.
if (!equalIgnoringCase(key, "Cookie"))
platformRequest.addHeader(key.latin1().data(), value.latin1().data());
else if (!isRedirect)
else if (!cookieHeaderMayBeDirty)
platformRequest.addHeader(key.latin1().data(), value.containsOnlyLatin1() ? value.latin1().data() : value.utf8().data());
}
}
// Redirection's response may add or update cookies, so we get cookies from CookieManager when redirection happens.
// If request's cookies may be dirty, they must be set again.
// If there aren't cookies in the header list, we need trying to add cookies.
if (cookiesEnabled && (isRedirect || !httpHeaderFields().contains("Cookie")) && !url().isNull()) {
if (cookiesEnabled && (cookieHeaderMayBeDirty || !httpHeaderFields().contains("Cookie")) && !url().isNull()) {
// Prepare a cookie header if there are cookies related to this url.
String cookiePairs = cookieManager().getCookie(url(), WithHttpOnlyCookies);
if (!cookiePairs.isEmpty())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment