Bug 1452699 - Work-around caching issues in test_same_site_cookies_*. r=ckerschb

MozReview-Commit-ID: cTH2uyPMTA

--HG--
extra : rebase_source : e17cf902fe4df3fb209805f02838a0c01ab032be
This commit is contained in:
Francois Marier 2018-04-13 18:49:58 -07:00
Родитель 5898cbcbdf
Коммит b3433d151f
8 изменённых файлов: 26 добавлений и 26 удалений

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

@ -26,21 +26,21 @@ function handleRequest(request, response)
// avoid confusing cache behaviors
response.setHeader("Cache-Control", "no-cache", false);
if (request.queryString === "setSameSiteCookie") {
if (request.queryString.includes("setSameSiteCookie")) {
response.setHeader("Set-Cookie", "myKey=strictSameSiteCookie; samesite=strict", true);
response.setHeader("Content-Type", "image/png");
response.write(IMG_BYTES);
return;
}
if (request.queryString === "setRegularCookie") {
if (request.queryString.includes("setRegularCookie")) {
response.setHeader("Set-Cookie", "myKey=regularCookie;", true);
response.setHeader("Content-Type", "image/png");
response.write(IMG_BYTES);
return;
}
if (request.queryString === "loadFrame") {
if (request.queryString.includes("loadFrame")) {
response.write(FRAME);
return;
}

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

@ -34,12 +34,12 @@ function handleRequest(request, response)
// avoid confusing cache behaviors
response.setHeader("Cache-Control", "no-cache", false);
if (request.queryString === "setSameSiteCookieUsingInlineScript") {
if (request.queryString.includes("setSameSiteCookieUsingInlineScript")) {
response.write(SET_COOKIE_FRAME);
return;
}
if (request.queryString === "getCookieFrame") {
if (request.queryString.includes("getCookieFrame")) {
response.write(GET_COOKIE_FRAME);
return;
}

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

@ -21,14 +21,14 @@ function handleRequest(request, response)
// avoid confusing cache behaviors
response.setHeader("Cache-Control", "no-cache", false);
if (request.queryString === "setStrictSameSiteCookie") {
if (request.queryString.includes("setStrictSameSiteCookie")) {
response.setHeader("Set-Cookie", "myKey=strictSameSiteCookie; samesite=strict", true);
response.setHeader("Content-Type", "image/png");
response.write(IMG_BYTES);
return;
}
if (request.queryString === "setLaxSameSiteCookie") {
if (request.queryString.includes("setLaxSameSiteCookie")) {
response.setHeader("Set-Cookie", "myKey=laxSameSiteCookie; samesite=lax", true);
response.setHeader("Content-Type", "image/png");
response.write(IMG_BYTES);
@ -37,18 +37,18 @@ function handleRequest(request, response)
// save the object state of the initial request, which returns
// async once the server has processed the img request.
if (request.queryString === "queryresult") {
if (request.queryString.includes("queryresult")) {
response.processAsync();
setObjectState("queryResult", response);
return;
}
if (request.queryString === "loadFrame") {
if (request.queryString.includes("loadFrame")) {
response.write(FRAME);
return;
}
if (request.queryString === "checkCookie") {
if (request.queryString.includes("checkCookie")) {
var cookie = "unitialized";
if (request.hasHeader("Cookie")) {
cookie = request.getHeader("Cookie");

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

@ -34,14 +34,14 @@ function handleRequest(request, response)
// avoid confusing cache behaviors
response.setHeader("Cache-Control", "no-cache", false);
if (request.queryString === "setStrictSameSiteCookie") {
if (request.queryString.includes("setStrictSameSiteCookie")) {
response.setHeader("Set-Cookie", "myKey=strictSameSiteCookie; samesite=strict", true);
response.setHeader("Content-Type", "image/png");
response.write(IMG_BYTES);
return;
}
if (request.queryString === "setLaxSameSiteCookie") {
if (request.queryString.includes("setLaxSameSiteCookie")) {
response.setHeader("Set-Cookie", "myKey=laxSameSiteCookie; samesite=lax", true);
response.setHeader("Content-Type", "image/png");
response.write(IMG_BYTES);
@ -50,18 +50,18 @@ function handleRequest(request, response)
// save the object state of the initial request, which returns
// async once the server has processed the img request.
if (request.queryString === "queryresult") {
if (request.queryString.includes("queryresult")) {
response.processAsync();
setObjectState("queryResult", response);
return;
}
if (request.queryString === "loadFrame") {
if (request.queryString.includes("loadFrame")) {
response.write(FRAME);
return;
}
if (request.queryString === "loadWin") {
if (request.queryString.includes("loadWin")) {
var cookie = "unitialized";
if (request.hasHeader("Cookie")) {
cookie = request.getHeader("Cookie");

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

@ -52,7 +52,7 @@ function receiveMessage(event) {
is(event.data.result, tests[curTest].result, tests[curTest].description);
curTest += 1;
// // lets see if we ran all the tests
// lets see if we ran all the tests
if (curTest == tests.length) {
window.removeEventListener("message", receiveMessage);
SimpleTest.finish();
@ -64,7 +64,7 @@ function receiveMessage(event) {
function setupQueryResultAndRunTest() {
let testframe = document.getElementById("testframe");
testframe.src = tests[curTest].frameSRC;
testframe.src = tests[curTest].frameSRC + curTest;
}
function setCookieAndInitTest() {
@ -76,7 +76,7 @@ function setCookieAndInitTest() {
cookieImage.onerror = function() {
ok(false, "could not load image for test (" + tests[curTest].description + ")");
}
cookieImage.src = tests[curTest].imgSRC;
cookieImage.src = tests[curTest].imgSRC + curTest;
}
// fire up the test

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

@ -63,7 +63,7 @@ function receiveMessage(event) {
function setupQueryResultAndRunTest() {
let getCookieFrame = document.getElementById("getCookieFrame");
getCookieFrame.src = tests[curTest].getCookieSrc;
getCookieFrame.src = tests[curTest].getCookieSrc + curTest;
}
function setCookieAndInitTest() {
@ -75,7 +75,7 @@ function setCookieAndInitTest() {
setCookieFrame.onerror = function() {
ok(false, "could not load image for test (" + tests[curTest].description + ")");
}
cookieFrame.src = tests[curTest].setCookieSrc;
cookieFrame.src = tests[curTest].setCookieSrc + curTest;
}
// fire up the test

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

@ -77,7 +77,7 @@ function checkResult(aCookieVal) {
function setupQueryResultAndRunTest() {
var myXHR = new XMLHttpRequest();
myXHR.open("GET", "file_same_site_cookies_subrequest.sjs?queryresult");
myXHR.open("GET", "file_same_site_cookies_subrequest.sjs?queryresult" + curTest);
myXHR.onload = function(e) {
checkResult(myXHR.responseText);
}
@ -89,7 +89,7 @@ function setupQueryResultAndRunTest() {
// give it some time and load the test frame
SimpleTest.executeSoon(function() {
let testframe = document.getElementById("testframe");
testframe.src = tests[curTest].frameSRC;
testframe.src = tests[curTest].frameSRC + curTest;
});
}
@ -102,7 +102,7 @@ function setCookieAndInitTest() {
cookieImage.onerror = function() {
ok(false, "could not set cookie for test (" + tests[curTest].description + ")");
}
cookieImage.src = tests[curTest].imgSRC;
cookieImage.src = tests[curTest].imgSRC + curTest;
}
// fire up the test

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

@ -78,7 +78,7 @@ function checkResult(aCookieVal) {
function setupQueryResultAndRunTest() {
var myXHR = new XMLHttpRequest();
myXHR.open("GET", "file_same_site_cookies_toplevel_nav.sjs?queryresult");
myXHR.open("GET", "file_same_site_cookies_toplevel_nav.sjs?queryresult" + curTest);
myXHR.onload = function(e) {
checkResult(myXHR.responseText);
}
@ -90,7 +90,7 @@ function setupQueryResultAndRunTest() {
// give it some time and load the test window
SimpleTest.executeSoon(function() {
let testframe = document.getElementById("testframe");
testframe.src = tests[curTest].frameSRC;
testframe.src = tests[curTest].frameSRC + curTest;
});
}
@ -103,7 +103,7 @@ function setCookieAndInitTest() {
cookieImage.onerror = function() {
ok(false, "could not set cookie for test (" + tests[curTest].description + ")");
}
cookieImage.src = tests[curTest].imgSRC;
cookieImage.src = tests[curTest].imgSRC + curTest;
}
// fire up the test