~mozillateam/firefox/firefox-3.6.maverick

« back to all changes in this revision

Viewing changes to debian/patches/lp801778_bz667087_att542125-fix-cookie-regression.patch

  • Committer: Micah Gersten
  • Date: 2011-08-05 21:25:37 UTC
  • Revision ID: micahg@ubuntu.com-20110805212537-pykg447fx9aflxn6
* Drop patch for previous cookie regression, accepted upstream
  - drop debian/patches/lp801778_bz667087_att542125-fix-cookie-regression.patch
  - update debian/patches/series

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Description: Fix cookie regression from Firefox 3.6.18
2
 
 When talking to an hostname consisting of a single letter, Firefox 3.6.18 does 
3
 
 not set cookie. Previous versions did fine, as well as other browser such as 
4
 
 chromium.
5
 
Author: Chris Coulson <chris.coulson@canonical.com>
6
 
Bug-Ubuntu: https://bugs.launchpad.net/bugs/801778
7
 
Forwarded: https://bugzilla.mozilla.org/show_bug.cgi?id=667087
8
 
Origin: https://bug667087.bugzilla.mozilla.org/attachment.cgi?id=542125
9
 
 
10
 
diff --git a/extensions/cookie/test/unit/test_bug667087.js b/extensions/cookie/test/unit/test_bug667087.js
11
 
new file mode 100644
12
 
--- /dev/null
13
 
+++ b/extensions/cookie/test/unit/test_bug667087.js
14
 
@@ -0,0 +1,19 @@
15
 
+/* Any copyright is dedicated to the Public Domain.
16
 
+   http://creativecommons.org/publicdomain/zero/1.0/ */
17
 
+
18
 
+const Cc = Components.classes;
19
 
+const Ci = Components.interfaces;
20
 
+
21
 
+Components.utils.import("resource://gre/modules/NetUtil.jsm");
22
 
+
23
 
+function run_test() {
24
 
+  var cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
25
 
+  var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2);
26
 
+  var expiry = (Date.now() + 1000) * 1000;
27
 
+
28
 
+  // Test our handling of host names with a single character consisting only
29
 
+  // of a single character
30
 
+  cm.add("a", "/", "foo", "bar", false, false, true, expiry);
31
 
+  do_check_eq(cm.countCookiesFromHost("a"), 1);
32
 
+  do_check_eq(cs.getCookieString(NetUtil.newURI("http://a"), null), "foo=bar");
33
 
+}
34
 
diff --git a/netwerk/cookie/src/nsCookieService.cpp b/netwerk/cookie/src/nsCookieService.cpp
35
 
--- a/netwerk/cookie/src/nsCookieService.cpp
36
 
+++ b/netwerk/cookie/src/nsCookieService.cpp
37
 
@@ -1343,17 +1343,17 @@ nsCookieService::GetCookieInternal(nsIUR
38
 
       }
39
 
 
40
 
       // all checks passed - add to list and check if lastAccessed stamp needs updating
41
 
       foundCookieList.AppendElement(cookie);
42
 
       if (currentTimeInUsec - cookie->LastAccessed() > kCookieStaleThreshold)
43
 
         stale = PR_TRUE;
44
 
     }
45
 
 
46
 
-    if (!nextDot || (nextDot <= end && *(nextDot + 1) == '\0'))
47
 
+    if (!nextDot || (nextDot <= end && *(nextDot + 1) == '\0' && *nextDot == '.'))
48
 
       break;
49
 
 
50
 
     currentDot = nextDot;
51
 
     nextDot = *currentDot ? strchr(currentDot + 1, '.') : nsnull;
52
 
   } while (1);
53
 
 
54
 
   PRInt32 count = foundCookieList.Length();
55
 
   if (count == 0)
56
 
@@ -2223,17 +2223,17 @@ nsCookieService::CountCookiesFromHostInt
57
 
         // check if we've found the oldest cookie so far
58
 
         if (aData.oldestTime > iter.current->LastAccessed()) {
59
 
           aData.oldestTime = iter.current->LastAccessed();
60
 
           aData.iter = iter;
61
 
         }
62
 
       }
63
 
     }
64
 
 
65
 
-    if (!nextDot || (nextDot <= end && *(nextDot + 1) == '\0'))
66
 
+    if (!nextDot || (nextDot <= end && *(nextDot + 1) == '\0' && *nextDot == '.'))
67
 
       break;
68
 
 
69
 
     currentDot = nextDot;
70
 
     nextDot = *currentDot ? strchr(currentDot + 1, '.') : nsnull;
71
 
   } while (1);
72
 
 
73
 
   return countFromHost;
74
 
 }
75
 
@@ -2276,17 +2276,17 @@ nsCookieService::GetCookiesFromHost(cons
76
 
   do {
77
 
     nsCookieEntry *entry = mDBState->hostTable.GetEntry(currentDot);
78
 
     for (nsListIter iter(entry); iter.current; ++iter) {
79
 
       // only append non-expired cookies
80
 
       if (iter.current->Expiry() > currentTime)
81
 
         cookieList.AppendObject(iter.current);
82
 
     }
83
 
 
84
 
-    if (!nextDot || (nextDot <= end && *(nextDot + 1) == '\0'))
85
 
+    if (!nextDot || (nextDot <= end && *(nextDot + 1) == '\0' && *nextDot == '.'))
86
 
       break;
87
 
 
88
 
     currentDot = nextDot;
89
 
     nextDot = *currentDot ? strchr(currentDot + 1, '.') : nsnull;
90
 
   } while (1);
91
 
 
92
 
   return NS_NewArrayEnumerator(aEnumerator, cookieList);
93
 
 }