--- a/netwerk/test/TestCookie.cpp
+++ b/netwerk/test/TestCookie.cpp
@@ -66,17 +66,17 @@ SetTime(PRTime offsetTime,nsAutoCString&
nsresult
SetACookie(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);
- sBuffer = PR_sprintf_append(sBuffer, " for host \"%s\": SET ", aSpec1);
+ sBuffer = PR_sprintf_append(sBuffer, R"( for host "%s": SET )", aSpec1);
nsresult rv = aCookieService->SetCookieStringFromHttp(uri1, uri2, nullptr, (char *)aCookieString, aServerTime, nullptr);
// the following code is useless. the cookieservice blindly returns NS_OK
// from SetCookieString. we have to call GetCookie to see if the cookie was
// set correctly...
if (NS_FAILED(rv)) {
sBuffer = PR_sprintf_append(sBuffer, "nothing\n");
} else {
sBuffer = PR_sprintf_append(sBuffer, "\"%s\"\n", aCookieString);
@@ -85,17 +85,17 @@ SetACookie(nsICookieService *aCookieServ
}
nsresult
SetACookieNoHttp(nsICookieService *aCookieService, const char *aSpec, const char* aCookieString)
{
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), aSpec);
- sBuffer = PR_sprintf_append(sBuffer, " for host \"%s\": SET ", aSpec);
+ sBuffer = PR_sprintf_append(sBuffer, R"( for host "%s": SET )", aSpec);
nsresult rv = aCookieService->SetCookieString(uri, nullptr, (char *)aCookieString, nullptr);
// the following code is useless. the cookieservice blindly returns NS_OK
// from SetCookieString. we have to call GetCookie to see if the cookie was
// set correctly...
if (NS_FAILED(rv)) {
sBuffer = PR_sprintf_append(sBuffer, "nothing\n");
} else {
sBuffer = PR_sprintf_append(sBuffer, "\"%s\"\n", aCookieString);
@@ -108,17 +108,17 @@ SetACookieNoHttp(nsICookieService *aCook
bool
GetACookie(nsICookieService *aCookieService, const char *aSpec1, const char *aSpec2, char **aCookie)
{
nsCOMPtr<nsIURI> uri1, uri2;
NS_NewURI(getter_AddRefs(uri1), aSpec1);
if (aSpec2)
NS_NewURI(getter_AddRefs(uri2), aSpec2);
- sBuffer = PR_sprintf_append(sBuffer, " \"%s\": GOT ", aSpec1);
+ sBuffer = PR_sprintf_append(sBuffer, R"( "%s": GOT )", aSpec1);
nsresult rv = aCookieService->GetCookieStringFromHttp(uri1, uri2, nullptr, aCookie);
if (NS_FAILED(rv)) {
sBuffer = PR_sprintf_append(sBuffer, "XXX GetCookieString() failed!\n");
}
if (!*aCookie) {
sBuffer = PR_sprintf_append(sBuffer, "nothing\n");
} else {
sBuffer = PR_sprintf_append(sBuffer, "\"%s\"\n", *aCookie);
@@ -129,17 +129,17 @@ GetACookie(nsICookieService *aCookieServ
// returns true if cookie(s) for the given host were found; else false.
// the cookie string is returned via aCookie.
bool
GetACookieNoHttp(nsICookieService *aCookieService, const char *aSpec, char **aCookie)
{
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), aSpec);
- sBuffer = PR_sprintf_append(sBuffer, " \"%s\": GOT ", aSpec);
+ sBuffer = PR_sprintf_append(sBuffer, R"( "%s": GOT )", aSpec);
nsresult rv = aCookieService->GetCookieString(uri, nullptr, aCookie);
if (NS_FAILED(rv)) {
sBuffer = PR_sprintf_append(sBuffer, "XXX GetCookieString() failed!\n");
}
if (!*aCookie) {
sBuffer = PR_sprintf_append(sBuffer, "nothing\n");
} else {
sBuffer = PR_sprintf_append(sBuffer, "\"%s\"\n", *aCookie);
@@ -350,17 +350,17 @@ main(int32_t argc, char *argv[])
SetACookie(cookieService, "http://www.domain.com", nullptr, "test=domain; domain=..domain.com", nullptr);
GetACookie(cookieService, "http://foo.domain.com", nullptr, getter_Copies(cookie));
rv[12] = CheckResult(cookie.get(), MUST_BE_NULL);
SetACookie(cookieService, "http://www.domain.com", nullptr, "test=domain; domain=..domain.com.", nullptr);
GetACookie(cookieService, "http://foo.domain.com", nullptr, getter_Copies(cookie));
rv[13] = CheckResult(cookie.get(), MUST_BE_NULL);
- SetACookie(cookieService, "http://path.net/path/file", nullptr, "test=taco; path=\"/bogus\"", nullptr);
+ SetACookie(cookieService, "http://path.net/path/file", nullptr, R"(test=taco; path="/bogus")", nullptr);
GetACookie(cookieService, "http://path.net/path/file", nullptr, getter_Copies(cookie));
rv[14] = CheckResult(cookie.get(), MUST_EQUAL, "test=taco");
SetACookie(cookieService, "http://path.net/path/file", nullptr, "test=taco; max-age=-1", nullptr);
GetACookie(cookieService, "http://path.net/path/file", nullptr, getter_Copies(cookie));
rv[15] = CheckResult(cookie.get(), MUST_BE_NULL);
allTestsPassed = PrintResult(rv, 16) && allTestsPassed;
@@ -450,20 +450,20 @@ main(int32_t argc, char *argv[])
GetACookie(cookieService, "http://expireme.org/", nullptr, getter_Copies(cookie));
rv[1] = CheckResult(cookie.get(), MUST_BE_NULL);
SetACookie(cookieService, "http://expireme.org/", nullptr, "test=expiry; expires=bad", nullptr);
GetACookie(cookieService, "http://expireme.org/", nullptr, getter_Copies(cookie));
rv[2] = CheckResult(cookie.get(), MUST_EQUAL, "test=expiry");
SetACookie(cookieService, "http://expireme.org/", nullptr, "test=expiry; expires=Thu, 10 Apr 1980 16:33:12 GMT", nullptr);
GetACookie(cookieService, "http://expireme.org/", nullptr, getter_Copies(cookie));
rv[3] = CheckResult(cookie.get(), MUST_BE_NULL);
- SetACookie(cookieService, "http://expireme.org/", nullptr, "test=expiry; expires=\"Thu, 10 Apr 1980 16:33:12 GMT", nullptr);
+ SetACookie(cookieService, "http://expireme.org/", nullptr, R"(test=expiry; expires="Thu, 10 Apr 1980 16:33:12 GMT)", nullptr);
GetACookie(cookieService, "http://expireme.org/", nullptr, getter_Copies(cookie));
rv[4] = CheckResult(cookie.get(), MUST_BE_NULL);
- SetACookie(cookieService, "http://expireme.org/", nullptr, "test=expiry; expires=\"Thu, 10 Apr 1980 16:33:12 GMT\"", nullptr);
+ SetACookie(cookieService, "http://expireme.org/", nullptr, R"(test=expiry; expires="Thu, 10 Apr 1980 16:33:12 GMT")", nullptr);
GetACookie(cookieService, "http://expireme.org/", nullptr, getter_Copies(cookie));
rv[5] = CheckResult(cookie.get(), MUST_BE_NULL);
SetACookie(cookieService, "http://expireme.org/", nullptr, "test=expiry; max-age=60", nullptr);
GetACookie(cookieService, "http://expireme.org/", nullptr, getter_Copies(cookie));
rv[6] = CheckResult(cookie.get(), MUST_EQUAL, "test=expiry");
SetACookie(cookieService, "http://expireme.org/", nullptr, "test=expiry; max-age=-20", nullptr);
GetACookie(cookieService, "http://expireme.org/", nullptr, getter_Copies(cookie));
@@ -550,17 +550,17 @@ main(int32_t argc, char *argv[])
SetACookie(cookieService, "http://parser.test/", nullptr, "test=parser; domain=.parser.test; ;; ;=; ,,, ===,abc,=; abracadabra! max-age=20;=;;", nullptr);
GetACookie(cookieService, "http://parser.test/", nullptr, getter_Copies(cookie));
rv[0] = CheckResult(cookie.get(), MUST_EQUAL, "test=parser");
SetACookie(cookieService, "http://parser.test/", nullptr, "test=parser; domain=.parser.test; max-age=0", nullptr);
GetACookie(cookieService, "http://parser.test/", nullptr, getter_Copies(cookie));
rv[1] = CheckResult(cookie.get(), MUST_BE_NULL);
SetACookie(cookieService, "http://parser.test/", nullptr, "test=\"fubar! = foo;bar\\\";\" parser; domain=.parser.test; max-age=6\nfive; max-age=2.63,", nullptr);
GetACookie(cookieService, "http://parser.test/", nullptr, getter_Copies(cookie));
- rv[2] = CheckResult(cookie.get(), MUST_CONTAIN, "test=\"fubar! = foo");
+ rv[2] = CheckResult(cookie.get(), MUST_CONTAIN, R"(test="fubar! = foo)");
rv[3] = CheckResult(cookie.get(), MUST_CONTAIN, "five");
SetACookie(cookieService, "http://parser.test/", nullptr, "test=kill; domain=.parser.test; max-age=0 \n five; max-age=0", nullptr);
GetACookie(cookieService, "http://parser.test/", nullptr, getter_Copies(cookie));
rv[4] = CheckResult(cookie.get(), MUST_BE_NULL);
// test the handling of VALUE-only cookies (see bug 169091),
// i.e. "six" should assume an empty NAME, which allows other VALUE-only
// cookies to overwrite it
--- a/netwerk/test/urltest.cpp
+++ b/netwerk/test/urltest.cpp
@@ -334,17 +334,17 @@ nsresult doMakeAbsTest(const char* i_URL
{ "http://a/b/c/d;p?q#f", "g?http://foo", "http://a/b/c/g?http://foo" },
{"http://a/b/c/d;p?q#f", "g/h?http://foo", "http://a/b/c/g/h?http://foo" },
{ "http://a/b/c/d;p?q#f", "g/h/../H?http://foo","http://a/b/c/g/H?http://foo" },
{ "http://a/b/c/d;p?q#f", "g/h/../H?http://foo?baz", "http://a/b/c/g/H?http://foo?baz" },
{ "http://a/b/c/d;p?q#f", "g/h/../H?http://foo;baz", "http://a/b/c/g/H?http://foo;baz" },
{ "http://a/b/c/d;p?q#f", "g/h/../H?http://foo#bar", "http://a/b/c/g/H?http://foo#bar" },
{ "http://a/b/c/d;p?q#f", "g/h/../H;baz?http://foo", "http://a/b/c/g/H;baz?http://foo" },
{ "http://a/b/c/d;p?q#f", "g/h/../H;baz?http://foo#bar", "http://a/b/c/g/H;baz?http://foo#bar" },
- { "http://a/b/c/d;p?q#f", "g/h/../H;baz?C:\\temp", "http://a/b/c/g/H;baz?C:\\temp" },
+ { "http://a/b/c/d;p?q#f", R"(g/h/../H;baz?C:\temp)", R"(http://a/b/c/g/H;baz?C:\temp)" },
{ "http://a/b/c/d;p?q#f", "", "http://a/b/c/d;p?q" },
{ "http://a/b/c/d;p?q#f", "#", "http://a/b/c/d;p?q#" },
{ "http://a/b/c;p/d;p?q#f", "../g;p" , "http://a/b/g;p" },
};
const int numTests = sizeof(tests) / sizeof(tests[0]);
int failed = 0;