Title: [139883] trunk
Revision
139883
Author
[email protected]
Date
2013-01-16 08:00:38 -0800 (Wed, 16 Jan 2013)

Log Message

Web Inspector: cookies with empty value are parsed incorrectly
https://bugs.webkit.org/show_bug.cgi?id=107012

Reviewed by Pavel Feldman.

Source/WebCore:

Require cookie value to be a string, not a non-empty string, before
employing legacy compatibility hack of treating bare token as value
for the cookie with an empty name.

* inspector/front-end/CookieParser.js:
(WebInspector.CookieParser.prototype._addCookie):

LayoutTests:

* inspector/cookie-parser-expected.txt:
* inspector/cookie-parser.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139882 => 139883)


--- trunk/LayoutTests/ChangeLog	2013-01-16 15:35:19 UTC (rev 139882)
+++ trunk/LayoutTests/ChangeLog	2013-01-16 16:00:38 UTC (rev 139883)
@@ -1,3 +1,13 @@
+2013-01-16  Andrey Kosyakov  <[email protected]>
+
+        Web Inspector: cookies with empty value are parsed incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=107012
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/cookie-parser-expected.txt:
+        * inspector/cookie-parser.html:
+
 2013-01-16  Andrey Lushnikov  <[email protected]>
 
         Web Inspector: create helper InspectorTest method to dump editor HTML

Modified: trunk/LayoutTests/inspector/cookie-parser-expected.txt (139882 => 139883)


--- trunk/LayoutTests/inspector/cookie-parser-expected.txt	2013-01-16 15:35:19 UTC (rev 139882)
+++ trunk/LayoutTests/inspector/cookie-parser-expected.txt	2013-01-16 16:00:38 UTC (rev 139883)
@@ -130,4 +130,16 @@
     path : "/foo"
     secure : undefined
 }
+source: cooke1; Path=/; Domain=.example.com;
+name: , value: cooke1, httpOnly: false, secure: false, session: true, path: /, domain: .example.com, port: undefined, expires: n/a, size: 36
+{
+    domain : ".example.com"
+    path : "/"
+}
+source: cooke1=; Path=/; Domain=.example.com;
+name: cooke1, value: , httpOnly: false, secure: false, session: true, path: /, domain: .example.com, port: undefined, expires: n/a, size: 37
+{
+    domain : ".example.com"
+    path : "/"
+}
 

Modified: trunk/LayoutTests/inspector/cookie-parser.html (139882 => 139883)


--- trunk/LayoutTests/inspector/cookie-parser.html	2013-01-16 15:35:19 UTC (rev 139882)
+++ trunk/LayoutTests/inspector/cookie-parser.html	2013-01-16 16:00:38 UTC (rev 139883)
@@ -60,6 +60,8 @@
     InspectorTest.parseAndDumpSetCookie("cooke1 = value; Path=/; Domain=  .example.com \nCookie2 = value2; Path = /foo; Domain = foo.example.com");
     InspectorTest.parseAndDumpSetCookie("cooke1 = value; expires = Mon, Oct 18 2010 17:00 GMT+0000; Domain   =.example.com\nCookie2 = value2; Path = /foo; DOMAIN = foo.example.com; HttpOnly; Secure; Discard;");
     InspectorTest.parseAndDumpSetCookie("cooke1 = value; max-age= 1440; Domain   =.example.com\n Cookie2 = value2; Path = /foo; DOMAIN = foo.example.com; HttpOnly; Secure; Discard;");
+    InspectorTest.parseAndDumpSetCookie("cooke1; Path=/; Domain=.example.com;");
+    InspectorTest.parseAndDumpSetCookie("cooke1=; Path=/; Domain=.example.com;");
     InspectorTest.completeTest();
 }
 

Modified: trunk/Source/WebCore/ChangeLog (139882 => 139883)


--- trunk/Source/WebCore/ChangeLog	2013-01-16 15:35:19 UTC (rev 139882)
+++ trunk/Source/WebCore/ChangeLog	2013-01-16 16:00:38 UTC (rev 139883)
@@ -1,3 +1,17 @@
+2013-01-16  Andrey Kosyakov  <[email protected]>
+
+        Web Inspector: cookies with empty value are parsed incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=107012
+
+        Reviewed by Pavel Feldman.
+
+        Require cookie value to be a string, not a non-empty string, before
+        employing legacy compatibility hack of treating bare token as value
+        for the cookie with an empty name.
+
+        * inspector/front-end/CookieParser.js:
+        (WebInspector.CookieParser.prototype._addCookie):
+
 2013-01-16  Grzegorz Czajkowski  <[email protected]>
 
         Unreviewed EFL build fix after r139877.

Modified: trunk/Source/WebCore/inspector/front-end/CookieParser.js (139882 => 139883)


--- trunk/Source/WebCore/inspector/front-end/CookieParser.js	2013-01-16 15:35:19 UTC (rev 139882)
+++ trunk/Source/WebCore/inspector/front-end/CookieParser.js	2013-01-16 16:00:38 UTC (rev 139883)
@@ -171,7 +171,7 @@
             this._lastCookie.setSize(keyValue.position - this._lastCookiePosition);
         // Mozilla bug 169091: Mozilla, IE and Chrome treat single token (w/o "=") as
         // specifying a value for a cookie with empty name.
-        this._lastCookie = keyValue.value ? new WebInspector.Cookie(keyValue.key, keyValue.value, type) :
+        this._lastCookie = typeof keyValue.value === "string" ? new WebInspector.Cookie(keyValue.key, keyValue.value, type) :
             new WebInspector.Cookie("", keyValue.key, type);
         this._lastCookiePosition = keyValue.position;
         this._cookies.push(this._lastCookie);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to