Title: [92672] trunk
Revision
92672
Author
[email protected]
Date
2011-08-09 03:33:54 -0700 (Tue, 09 Aug 2011)

Log Message

Web Inspector: Resources panel does not show main resource cookies.
https://bugs.webkit.org/show_bug.cgi?id=65770

Reviewed by Pavel Feldman.

Source/WebCore:

Test: http/tests/inspector/resource-main-cookies.php

* inspector/InspectorPageAgent.cpp:
(WebCore::allResourcesURLsForFrame):
(WebCore::InspectorPageAgent::getCookies):
(WebCore::InspectorPageAgent::deleteCookie):

LayoutTests:

* http/tests/inspector/resource-main-cookies-expected.txt: Added.
* http/tests/inspector/resource-main-cookies.php: Added.
* platform/chromium/test_expectations.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (92671 => 92672)


--- trunk/LayoutTests/ChangeLog	2011-08-09 10:26:02 UTC (rev 92671)
+++ trunk/LayoutTests/ChangeLog	2011-08-09 10:33:54 UTC (rev 92672)
@@ -1,3 +1,14 @@
+2011-08-09  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Resources panel does not show main resource cookies.
+        https://bugs.webkit.org/show_bug.cgi?id=65770
+
+        Reviewed by Pavel Feldman.
+
+        * http/tests/inspector/resource-main-cookies-expected.txt: Added.
+        * http/tests/inspector/resource-main-cookies.php: Added.
+        * platform/chromium/test_expectations.txt:
+
 2011-08-09  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r92670.

Added: trunk/LayoutTests/http/tests/inspector/resource-main-cookies-expected.txt (0 => 92672)


--- trunk/LayoutTests/http/tests/inspector/resource-main-cookies-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/resource-main-cookies-expected.txt	2011-08-09 10:33:54 UTC (rev 92672)
@@ -0,0 +1,6 @@
+This tests that the cookie set by main resource is shown in resources panel.
+
+bug 65770.
+Page reloaded.
+Cookie: cookieName=cookieValue.
+
Property changes on: trunk/LayoutTests/http/tests/inspector/resource-main-cookies-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/http/tests/inspector/resource-main-cookies.php (0 => 92672)


--- trunk/LayoutTests/http/tests/inspector/resource-main-cookies.php	                        (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/resource-main-cookies.php	2011-08-09 10:33:54 UTC (rev 92672)
@@ -0,0 +1,51 @@
+<?php
+    if (!$_COOKIE["cookieName"])
+        setcookie("cookieName", "cookieValue");
+?>
+<html>
+<head>
+<script src=""
+<script>
+
+function test()
+{
+    var cookieName = "cookieName";
+    var cookieDomain = "127.0.0.1";
+    // Ensure cookie is deleted before testing.
+    PageAgent.deleteCookie(cookieName, cookieDomain, step1);
+
+    function step1()
+    {
+        InspectorTest.reloadPage(step2);
+    }
+
+    function step2()
+    {
+        WebInspector.Cookies.getCookiesAsync(step3);
+    }
+
+    function step3(allCookies, isAdvanced)
+    {
+        for (var i = 0; i < allCookies.length; i++) {
+          var cookie = allCookies[i];
+            if (cookie.name === cookieName && cookie.domain == cookieDomain) {
+                InspectorTest.addResult("Cookie: " + cookie.name + "=" + cookie.value + ".");
+            }
+        }
+        // Ensure cookie is deleted after testing.
+        PageAgent.deleteCookie(cookieName, cookieDomain, step4);
+    }
+
+    function step4()
+    {
+        InspectorTest.completeTest();
+    }
+}
+
+</script>
+</head>
+<body _onload_="runTest()">
+    <p>This tests that the cookie set by main resource is shown in resources panel.</p>
+    <a href="" 65770</a>.
+</body>
+</html>

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (92671 => 92672)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-08-09 10:26:02 UTC (rev 92671)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-08-09 10:33:54 UTC (rev 92672)
@@ -637,6 +637,9 @@
 BUGWK56602 SKIP : http/tests/inspector/network/network-size-chunked.html = FAIL
 BUGWK56602 SKIP : http/tests/inspector/network/network-size-sync.html = FAIL
 
+// PageAgent can not getCookies from DumpRenderTree.
+BUGWK65770 SKIP : http/tests/inspector/resource-main-cookies.php = FAIL
+
 BUGWK60110 WIN RELEASE : http/tests/inspector/resource-tree/resource-tree-reload.html = PASS TEXT
 BUGWK60110 SLOW WIN DEBUG : http/tests/inspector/resource-tree/resource-tree-reload.html = PASS TEXT
 BUGWK60110 SLOW LINUX : http/tests/inspector/resource-tree/resource-tree-reload.html = PASS TEXT

Modified: trunk/Source/WebCore/ChangeLog (92671 => 92672)


--- trunk/Source/WebCore/ChangeLog	2011-08-09 10:26:02 UTC (rev 92671)
+++ trunk/Source/WebCore/ChangeLog	2011-08-09 10:33:54 UTC (rev 92672)
@@ -1,3 +1,17 @@
+2011-08-09  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Resources panel does not show main resource cookies.
+        https://bugs.webkit.org/show_bug.cgi?id=65770
+
+        Reviewed by Pavel Feldman.
+
+        Test: http/tests/inspector/resource-main-cookies.php
+
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::allResourcesURLsForFrame):
+        (WebCore::InspectorPageAgent::getCookies):
+        (WebCore::InspectorPageAgent::deleteCookie):
+
 2011-08-09  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r92670.

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (92671 => 92672)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2011-08-09 10:26:02 UTC (rev 92671)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2011-08-09 10:33:54 UTC (rev 92672)
@@ -360,6 +360,19 @@
     return result;
 }
 
+static Vector<KURL> allResourcesURLsForFrame(Frame* frame)
+{
+    Vector<KURL> result;
+
+    result.append(frame->loader()->documentLoader()->url());
+
+    Vector<CachedResource*> allResources = cachedResourcesForFrame(frame);
+    for (Vector<CachedResource*>::const_iterator it = allResources.begin(); it != allResources.end(); ++it)
+        result.append((*it)->url());
+
+    return result;
+}
+
 void InspectorPageAgent::getCookies(ErrorString*, RefPtr<InspectorArray>* cookies, WTF::String* cookiesString)
 {
     // If we can get raw cookies.
@@ -375,11 +388,10 @@
 
     for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext(mainFrame())) {
         Document* document = frame->document();
-        Vector<CachedResource*> allResources = cachedResourcesForFrame(frame);
-        for (Vector<CachedResource*>::const_iterator it = allResources.begin(); it != allResources.end(); ++it) {
+        Vector<KURL> allURLs = allResourcesURLsForFrame(frame);
+        for (Vector<KURL>::const_iterator it = allURLs.begin(); it != allURLs.end(); ++it) {
             Vector<Cookie> docCookiesList;
-            rawCookiesImplemented = getRawCookies(document, KURL(ParsedURLString, (*it)->url()), docCookiesList);
-
+            rawCookiesImplemented = getRawCookies(document, KURL(ParsedURLString, *it), docCookiesList);
             if (!rawCookiesImplemented) {
                 // FIXME: We need duplication checking for the String representation of cookies.
                 ExceptionCode ec = 0;
@@ -410,9 +422,9 @@
         if (document->url().host() != domain)
             continue;
 
-        Vector<CachedResource*> allResources = cachedResourcesForFrame(frame);
-        for (Vector<CachedResource*>::const_iterator it = allResources.begin(); it != allResources.end(); ++it)
-            WebCore::deleteCookie(document, KURL(ParsedURLString, (*it)->url()), cookieName);
+        Vector<KURL> allURLs = allResourcesURLsForFrame(frame);
+        for (Vector<KURL>::const_iterator it = allURLs.begin(); it != allURLs.end(); ++it)
+            WebCore::deleteCookie(document, KURL(ParsedURLString, *it), cookieName);
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to