Port bug 1631523 - Remove unused params in nsICookieService methods. rs=bustage-fix
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 21 Apr 2020 17:24:26 +1200
changeset 38892 1152857b0357b6f28236d108b8e437e6f199a97a
parent 38891 9585630b05750f19763c38486a64e86061845461
child 38893 cffb0a855c7b7d91ae6c70be8fd36d320bf10d95
push id401
push userclokep@gmail.com
push dateMon, 01 Jun 2020 20:41:59 +0000
reviewersbustage-fix
bugs1631523
Port bug 1631523 - Remove unused params in nsICookieService methods. rs=bustage-fix
mailnews/base/test/TestMailCookie.cpp
--- a/mailnews/base/test/TestMailCookie.cpp
+++ b/mailnews/base/test/TestMailCookie.cpp
@@ -28,39 +28,34 @@ static NS_DEFINE_CID(kPrefServiceCID, NS
 static const char kCookiesPermissions[] = "network.cookie.cookieBehavior";
 static const char kCookiesLifetimeEnabled[] = "network.cookie.lifetime.enabled";
 static const char kCookiesLifetimeDays[] = "network.cookie.lifetime.days";
 static const char kCookiesLifetimeCurrentSession[] =
     "network.cookie.lifetime.behavior";
 static const char kCookiesAskPermission[] = "network.cookie.warnAboutCookies";
 static const char kCookiesMaxPerHost[] = "network.cookie.maxPerHost";
 
-void SetACookieMail(nsICookieService *aCookieService, const char *aSpec1,
-                    const char *aSpec2, const char *aCookieString,
-                    const char *aServerTime) {
-  nsCOMPtr<nsIURI> uri1, uri2;
-  NS_NewURI(getter_AddRefs(uri1), aSpec1);
-  if (aSpec2) NS_NewURI(getter_AddRefs(uri2), aSpec2);
+void SetACookieMail(nsICookieService *aCookieService, const char *aSpec,
+                    const char *aCookieString) {
+  nsCOMPtr<nsIURI> uri;
+  NS_NewURI(getter_AddRefs(uri), aSpec);
 
   nsresult rv = aCookieService->SetCookieStringFromHttp(
-      uri1, uri2, nsDependentCString(aCookieString),
-      aServerTime ? nsDependentCString(aServerTime) : VoidCString(), nullptr);
+      uri, nsDependentCString(aCookieString), nullptr);
   EXPECT_TRUE(NS_SUCCEEDED(rv));
 }
 
 // returns true if cookie(s) for the given host were found; else false.
 // the cookie string is returned via aCookie.
-bool GetACookieMail(nsICookieService *aCookieService, const char *aSpec1,
-                    const char *aSpec2, nsACString &aCookie) {
-  nsCOMPtr<nsIURI> uri1, uri2;
-  NS_NewURI(getter_AddRefs(uri1), aSpec1);
-  if (aSpec2) NS_NewURI(getter_AddRefs(uri2), aSpec2);
+bool GetACookieMail(nsICookieService *aCookieService, const char *aSpec,
+                    nsACString &aCookie) {
+  nsCOMPtr<nsIURI> uri;
+  NS_NewURI(getter_AddRefs(uri), aSpec);
 
-  Unused << aCookieService->GetCookieStringFromHttp(uri1, uri2, nullptr,
-                                                    aCookie);
+  Unused << aCookieService->GetCookieStringFromHttp(uri, nullptr, aCookie);
   return !aCookie.IsEmpty();
 }
 
 // some #defines for comparison rules
 #define MUST_BE_NULL 0
 #define MUST_EQUAL 1
 #define MUST_CONTAIN 2
 #define MUST_NOT_CONTAIN 3
@@ -146,25 +141,23 @@ TEST(TestMailCookie, TestMailCookieMain)
    * somewhat contrived - still under development, and needs improving!
    */
 
   // *** mailnews tests
 
   // test some mailnews cookies to ensure blockage.
   // we use null firstURI's deliberately, since we have hacks to deal with
   // this situation...
-  SetACookieMail(cookieService, "mailbox://mail.co.uk/", nullptr,
-                 "test=mailnews", nullptr);
-  GetACookieMail(cookieService, "mailbox://mail.co.uk/", nullptr, cookie);
+  SetACookieMail(cookieService, "mailbox://mail.co.uk/", "test=mailnews");
+  GetACookieMail(cookieService, "mailbox://mail.co.uk/", cookie);
   EXPECT_TRUE(CheckResult(cookie.get(), MUST_BE_NULL));
-  GetACookieMail(cookieService, "http://mail.co.uk/", nullptr, cookie);
+  GetACookieMail(cookieService, "http://mail.co.uk/", cookie);
   EXPECT_TRUE(CheckResult(cookie.get(), MUST_BE_NULL));
-  SetACookieMail(cookieService, "http://mail.co.uk/", nullptr, "test=mailnews",
-                 nullptr);
-  GetACookieMail(cookieService, "mailbox://mail.co.uk/", nullptr, cookie);
+  SetACookieMail(cookieService, "http://mail.co.uk/", "test=mailnews");
+  GetACookieMail(cookieService, "mailbox://mail.co.uk/", cookie);
   EXPECT_TRUE(CheckResult(cookie.get(), MUST_BE_NULL));
-  GetACookieMail(cookieService, "http://mail.co.uk/", nullptr, cookie);
+  GetACookieMail(cookieService, "http://mail.co.uk/", cookie);
   EXPECT_TRUE(CheckResult(cookie.get(), MUST_EQUAL, "test=mailnews"));
-  SetACookieMail(cookieService, "http://mail.co.uk/", nullptr,
-                 "test=mailnews; max-age=0", nullptr);
-  GetACookieMail(cookieService, "http://mail.co.uk/", nullptr, cookie);
+  SetACookieMail(cookieService, "http://mail.co.uk/",
+                 "test=mailnews; max-age=0");
+  GetACookieMail(cookieService, "http://mail.co.uk/", cookie);
   EXPECT_TRUE(CheckResult(cookie.get(), MUST_BE_NULL));
 }