Backed out changeset b634b7b787d5 (bug 1609491) for wpt failures at /cookies/http-state/general-tests.html on a CLOSED TREE

This commit is contained in:
Coroiu Cristina 2020-01-20 20:57:54 +02:00
Родитель 30da6b4936
Коммит 9490b63809
12 изменённых файлов: 49 добавлений и 30 удалений

Просмотреть файл

@ -218,8 +218,8 @@ async function assignCookiesUnderFirstParty(aURL, aFirstParty, aCookieValue) {
async function generateCookies(aThirdParty) {
// we generate two different cookies for two first party domains.
let cookies = [];
cookies.push("a=" + Math.random().toString());
cookies.push("b=" + Math.random().toString());
cookies.push(Math.random().toString());
cookies.push(Math.random().toString());
let firstSiteURL;
let secondSiteURL;

Просмотреть файл

@ -169,8 +169,8 @@ function waitOnFaviconLoaded(aFaviconURL) {
async function generateCookies(aHost) {
// we generate two different cookies for two userContextIds.
let cookies = [];
cookies.push("a=" + Math.random().toString());
cookies.push("b=" + Math.random().toString());
cookies.push(Math.random().toString());
cookies.push(Math.random().toString());
// Then, we add cookies into the site for 'personal' and 'work'.
let tabInfoA = await openTabInUserContext(aHost, USER_CONTEXT_ID_PERSONAL);

Просмотреть файл

@ -220,8 +220,8 @@ add_task(async function test_favicon_privateBrowsing() {
// Generate two random cookies for non-private window and private window
// respectively.
let cookies = [];
cookies.push("a=" + Math.random().toString());
cookies.push("b=" + Math.random().toString());
cookies.push(Math.random().toString());
cookies.push(Math.random().toString());
// Open a tab in private window and add a cookie into it.
await assignCookies(privateWindow.gBrowser, TEST_SITE, cookies[0]);

Просмотреть файл

@ -135,7 +135,7 @@ add_task(async function test() {
for (let userContextId of Object.keys(USER_CONTEXTS)) {
// Load the page in 3 different contexts and set a cookie
// which should only be visible in that context.
let cookie = USER_CONTEXTS[userContextId] + "=true";
let cookie = USER_CONTEXTS[userContextId];
// Open our tab in the given user context.
let { tab, browser } = await openTabInUserContext(userContextId);

Просмотреть файл

@ -25,7 +25,7 @@ add_task(async function() {
const browser = BrowserTestUtils.addTab(gBrowser, tabURL).linkedBrowser;
await BrowserTestUtils.browserLoaded(browser);
const { short_name } = await ManifestObtainer.browserObtainManifest(browser);
is(short_name, "🍪=true");
is(short_name, "🍪");
const tab = gBrowser.getTabForBrowser(browser);
gBrowser.removeTab(tab);
});

Просмотреть файл

@ -1,7 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<script>
document.cookie = "🍪=true";
document.cookie = "🍪";
</script>
<link
rel="manifest"

Просмотреть файл

@ -3572,7 +3572,11 @@ void nsCookieService::AddInternal(const nsCookieKey& aKey, nsCookie* aCookie,
reject control chars or non-ASCII chars. This is erring on the loose
side, since there's probably no good reason to enforce this strictness.
5. Attribute "HttpOnly", not covered in the RFCs, is supported
5. cookie <NAME> is optional, where spec requires it. This is a fairly
trivial case, but allows the flexibility of setting only a cookie <VALUE>
with a blank <NAME> and is required by some sites (see bug 169091).
6. Attribute "HttpOnly", not covered in the RFCs, is supported
(see bug 178993).
** Begin BNF:
@ -3592,7 +3596,7 @@ void nsCookieService::AddInternal(const nsCookieKey& aKey, nsCookie* aCookie,
set-cookie = "Set-Cookie:" cookies
cookies = cookie *( cookie-sep cookie )
cookie = NAME "=" VALUE *(";" cookie-av) ; cookie NAME/VALUE must come first
cookie = [NAME "="] VALUE *(";" cookie-av) ; cookie NAME/VALUE must come first
NAME = token ; cookie name
VALUE = value ; cookie value
cookie-av = token ["=" value]
@ -3717,18 +3721,20 @@ bool nsCookieService::ParseAttributes(nsCString& aCookieHeader,
// extract cookie <NAME> & <VALUE> (first attribute), and copy the strings.
// if we find multiple cookies, return for processing
// note: if there's no '=', we assume the cookie is invalid and fail to
// parse it. we used to accept such cookie pair values in the past.
// note: if there's no '=', we assume token is <VALUE>. this is required by
// some sites (see bug 169091).
// XXX fix the parser to parse according to <VALUE> grammar for this case
newCookie = GetTokenValue(cookieStart, cookieEnd, tokenString, tokenValue,
equalsFound);
if (equalsFound) {
aCookieData.name() = tokenString;
aCookieData.value() = tokenValue;
} else {
aCookieData.value() = tokenString;
}
// extract remaining attributes
while (cookieStart != cookieEnd && !newCookie) {
bool equalsFound;
newCookie = GetTokenValue(cookieStart, cookieEnd, tokenString, tokenValue,
equalsFound);
@ -3785,11 +3791,6 @@ bool nsCookieService::ParseAttributes(nsCString& aCookieHeader,
return newCookie;
}
// If the name=value pair wasn't found, let's abort the parsing.
if (!equalsFound) {
return newCookie;
}
// Cookie accepted.
aAcceptedByParser = true;

Просмотреть файл

@ -619,7 +619,7 @@ TEST(TestCookie, TestCookieMain)
nullptr);
GetACookie(cookieService, "http://parser.test/", nullptr, cookie);
EXPECT_TRUE(CheckResult(cookie.get(), MUST_CONTAIN, R"(test="fubar! = foo)"));
EXPECT_TRUE(CheckResult(cookie.get(), MUST_NOT_CONTAIN, "five"));
EXPECT_TRUE(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);
@ -631,10 +631,10 @@ TEST(TestCookie, TestCookieMain)
// cookies to overwrite it
SetACookie(cookieService, "http://parser.test/", nullptr, "six", nullptr);
GetACookie(cookieService, "http://parser.test/", nullptr, cookie);
EXPECT_TRUE(CheckResult(cookie.get(), MUST_BE_NULL));
EXPECT_TRUE(CheckResult(cookie.get(), MUST_EQUAL, "six"));
SetACookie(cookieService, "http://parser.test/", nullptr, "seven", nullptr);
GetACookie(cookieService, "http://parser.test/", nullptr, cookie);
EXPECT_TRUE(CheckResult(cookie.get(), MUST_BE_NULL));
EXPECT_TRUE(CheckResult(cookie.get(), MUST_EQUAL, "seven"));
SetACookie(cookieService, "http://parser.test/", nullptr, " =eight", nullptr);
GetACookie(cookieService, "http://parser.test/", nullptr, cookie);
EXPECT_TRUE(CheckResult(cookie.get(), MUST_EQUAL, "eight"));

Просмотреть файл

@ -1,4 +1,13 @@
[chromium-tests.html]
[chromium0009 - chromium0009]
expected: FAIL
[chromium0012 - chromium0012]
expected: FAIL
[disabled-chromium0022 - disabled-chromium0022]
expected: FAIL
[chromium0010 - chromium0010]
expected: FAIL

Просмотреть файл

@ -2,6 +2,15 @@
[name0025 - name0025]
expected: FAIL
[name0023 - name0023]
expected: FAIL
[name0032 - name0032]
expected: FAIL
[name0031 - name0031]
expected: FAIL
[name0033 - name0033]
expected: FAIL

Просмотреть файл

@ -87,12 +87,12 @@ PartitionedStorageHelper.runPartitioningTestInNormalAndPrivateMode(
// getDataCallback
async win => {
return win.document.cookie.replace("=true", "");
return win.document.cookie;
},
// addDataCallback
async (win, value) => {
win.document.cookie = value + "=true";
win.document.cookie = value;
return true;
},

Просмотреть файл

@ -19,13 +19,13 @@ function handleRequest(req, resp) {
let setCookieScript = "";
if (opts.setRedCookie) {
resp.setHeader("Set-Cookie", "red=true", false);
setCookieScript = '<script>document.cookie="red=true";</script>';
resp.setHeader("Set-Cookie", "red", false);
setCookieScript = '<script>document.cookie="red";</script>';
}
if (opts.setGreenCookie) {
resp.setHeader("Set-Cookie", "green=true", false);
setCookieScript = '<script>document.cookie="green=true";</script>';
resp.setHeader("Set-Cookie", "green", false);
setCookieScript = '<script>document.cookie="green";</script>';
}
if (opts.iframe) {
@ -43,14 +43,14 @@ function handleRequest(req, resp) {
}
if (req.hasHeader("Cookie") &&
req.getHeader("Cookie").split(";").indexOf("red=true") >= 0) {
req.getHeader("Cookie").split(";").indexOf("red") >= 0) {
resp.write('<html style="background: #f00;">' + setCookieScript + '</html>');
resp.finish();
return;
}
if (req.hasHeader("Cookie") &&
req.getHeader("Cookie").split(";").indexOf("green=true") >= 0) {
req.getHeader("Cookie").split(";").indexOf("green") >= 0) {
resp.write('<html style="background: #0f0;">' + setCookieScript + '</html>');
resp.finish();
return;