зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
5898cbcbdf
Коммит
b3433d151f
|
@ -26,21 +26,21 @@ function handleRequest(request, response)
|
||||||
// avoid confusing cache behaviors
|
// avoid confusing cache behaviors
|
||||||
response.setHeader("Cache-Control", "no-cache", false);
|
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("Set-Cookie", "myKey=strictSameSiteCookie; samesite=strict", true);
|
||||||
response.setHeader("Content-Type", "image/png");
|
response.setHeader("Content-Type", "image/png");
|
||||||
response.write(IMG_BYTES);
|
response.write(IMG_BYTES);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.queryString === "setRegularCookie") {
|
if (request.queryString.includes("setRegularCookie")) {
|
||||||
response.setHeader("Set-Cookie", "myKey=regularCookie;", true);
|
response.setHeader("Set-Cookie", "myKey=regularCookie;", true);
|
||||||
response.setHeader("Content-Type", "image/png");
|
response.setHeader("Content-Type", "image/png");
|
||||||
response.write(IMG_BYTES);
|
response.write(IMG_BYTES);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.queryString === "loadFrame") {
|
if (request.queryString.includes("loadFrame")) {
|
||||||
response.write(FRAME);
|
response.write(FRAME);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,12 +34,12 @@ function handleRequest(request, response)
|
||||||
// avoid confusing cache behaviors
|
// avoid confusing cache behaviors
|
||||||
response.setHeader("Cache-Control", "no-cache", false);
|
response.setHeader("Cache-Control", "no-cache", false);
|
||||||
|
|
||||||
if (request.queryString === "setSameSiteCookieUsingInlineScript") {
|
if (request.queryString.includes("setSameSiteCookieUsingInlineScript")) {
|
||||||
response.write(SET_COOKIE_FRAME);
|
response.write(SET_COOKIE_FRAME);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.queryString === "getCookieFrame") {
|
if (request.queryString.includes("getCookieFrame")) {
|
||||||
response.write(GET_COOKIE_FRAME);
|
response.write(GET_COOKIE_FRAME);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,14 +21,14 @@ function handleRequest(request, response)
|
||||||
// avoid confusing cache behaviors
|
// avoid confusing cache behaviors
|
||||||
response.setHeader("Cache-Control", "no-cache", false);
|
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("Set-Cookie", "myKey=strictSameSiteCookie; samesite=strict", true);
|
||||||
response.setHeader("Content-Type", "image/png");
|
response.setHeader("Content-Type", "image/png");
|
||||||
response.write(IMG_BYTES);
|
response.write(IMG_BYTES);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.queryString === "setLaxSameSiteCookie") {
|
if (request.queryString.includes("setLaxSameSiteCookie")) {
|
||||||
response.setHeader("Set-Cookie", "myKey=laxSameSiteCookie; samesite=lax", true);
|
response.setHeader("Set-Cookie", "myKey=laxSameSiteCookie; samesite=lax", true);
|
||||||
response.setHeader("Content-Type", "image/png");
|
response.setHeader("Content-Type", "image/png");
|
||||||
response.write(IMG_BYTES);
|
response.write(IMG_BYTES);
|
||||||
|
@ -37,18 +37,18 @@ function handleRequest(request, response)
|
||||||
|
|
||||||
// save the object state of the initial request, which returns
|
// save the object state of the initial request, which returns
|
||||||
// async once the server has processed the img request.
|
// async once the server has processed the img request.
|
||||||
if (request.queryString === "queryresult") {
|
if (request.queryString.includes("queryresult")) {
|
||||||
response.processAsync();
|
response.processAsync();
|
||||||
setObjectState("queryResult", response);
|
setObjectState("queryResult", response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.queryString === "loadFrame") {
|
if (request.queryString.includes("loadFrame")) {
|
||||||
response.write(FRAME);
|
response.write(FRAME);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.queryString === "checkCookie") {
|
if (request.queryString.includes("checkCookie")) {
|
||||||
var cookie = "unitialized";
|
var cookie = "unitialized";
|
||||||
if (request.hasHeader("Cookie")) {
|
if (request.hasHeader("Cookie")) {
|
||||||
cookie = request.getHeader("Cookie");
|
cookie = request.getHeader("Cookie");
|
||||||
|
|
|
@ -34,14 +34,14 @@ function handleRequest(request, response)
|
||||||
// avoid confusing cache behaviors
|
// avoid confusing cache behaviors
|
||||||
response.setHeader("Cache-Control", "no-cache", false);
|
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("Set-Cookie", "myKey=strictSameSiteCookie; samesite=strict", true);
|
||||||
response.setHeader("Content-Type", "image/png");
|
response.setHeader("Content-Type", "image/png");
|
||||||
response.write(IMG_BYTES);
|
response.write(IMG_BYTES);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.queryString === "setLaxSameSiteCookie") {
|
if (request.queryString.includes("setLaxSameSiteCookie")) {
|
||||||
response.setHeader("Set-Cookie", "myKey=laxSameSiteCookie; samesite=lax", true);
|
response.setHeader("Set-Cookie", "myKey=laxSameSiteCookie; samesite=lax", true);
|
||||||
response.setHeader("Content-Type", "image/png");
|
response.setHeader("Content-Type", "image/png");
|
||||||
response.write(IMG_BYTES);
|
response.write(IMG_BYTES);
|
||||||
|
@ -50,18 +50,18 @@ function handleRequest(request, response)
|
||||||
|
|
||||||
// save the object state of the initial request, which returns
|
// save the object state of the initial request, which returns
|
||||||
// async once the server has processed the img request.
|
// async once the server has processed the img request.
|
||||||
if (request.queryString === "queryresult") {
|
if (request.queryString.includes("queryresult")) {
|
||||||
response.processAsync();
|
response.processAsync();
|
||||||
setObjectState("queryResult", response);
|
setObjectState("queryResult", response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.queryString === "loadFrame") {
|
if (request.queryString.includes("loadFrame")) {
|
||||||
response.write(FRAME);
|
response.write(FRAME);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.queryString === "loadWin") {
|
if (request.queryString.includes("loadWin")) {
|
||||||
var cookie = "unitialized";
|
var cookie = "unitialized";
|
||||||
if (request.hasHeader("Cookie")) {
|
if (request.hasHeader("Cookie")) {
|
||||||
cookie = request.getHeader("Cookie");
|
cookie = request.getHeader("Cookie");
|
||||||
|
|
|
@ -52,7 +52,7 @@ function receiveMessage(event) {
|
||||||
is(event.data.result, tests[curTest].result, tests[curTest].description);
|
is(event.data.result, tests[curTest].result, tests[curTest].description);
|
||||||
curTest += 1;
|
curTest += 1;
|
||||||
|
|
||||||
// // lets see if we ran all the tests
|
// lets see if we ran all the tests
|
||||||
if (curTest == tests.length) {
|
if (curTest == tests.length) {
|
||||||
window.removeEventListener("message", receiveMessage);
|
window.removeEventListener("message", receiveMessage);
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
|
@ -64,7 +64,7 @@ function receiveMessage(event) {
|
||||||
|
|
||||||
function setupQueryResultAndRunTest() {
|
function setupQueryResultAndRunTest() {
|
||||||
let testframe = document.getElementById("testframe");
|
let testframe = document.getElementById("testframe");
|
||||||
testframe.src = tests[curTest].frameSRC;
|
testframe.src = tests[curTest].frameSRC + curTest;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCookieAndInitTest() {
|
function setCookieAndInitTest() {
|
||||||
|
@ -76,7 +76,7 @@ function setCookieAndInitTest() {
|
||||||
cookieImage.onerror = function() {
|
cookieImage.onerror = function() {
|
||||||
ok(false, "could not load image for test (" + tests[curTest].description + ")");
|
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
|
// fire up the test
|
||||||
|
|
|
@ -63,7 +63,7 @@ function receiveMessage(event) {
|
||||||
|
|
||||||
function setupQueryResultAndRunTest() {
|
function setupQueryResultAndRunTest() {
|
||||||
let getCookieFrame = document.getElementById("getCookieFrame");
|
let getCookieFrame = document.getElementById("getCookieFrame");
|
||||||
getCookieFrame.src = tests[curTest].getCookieSrc;
|
getCookieFrame.src = tests[curTest].getCookieSrc + curTest;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCookieAndInitTest() {
|
function setCookieAndInitTest() {
|
||||||
|
@ -75,7 +75,7 @@ function setCookieAndInitTest() {
|
||||||
setCookieFrame.onerror = function() {
|
setCookieFrame.onerror = function() {
|
||||||
ok(false, "could not load image for test (" + tests[curTest].description + ")");
|
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
|
// fire up the test
|
||||||
|
|
|
@ -77,7 +77,7 @@ function checkResult(aCookieVal) {
|
||||||
|
|
||||||
function setupQueryResultAndRunTest() {
|
function setupQueryResultAndRunTest() {
|
||||||
var myXHR = new XMLHttpRequest();
|
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) {
|
myXHR.onload = function(e) {
|
||||||
checkResult(myXHR.responseText);
|
checkResult(myXHR.responseText);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ function setupQueryResultAndRunTest() {
|
||||||
// give it some time and load the test frame
|
// give it some time and load the test frame
|
||||||
SimpleTest.executeSoon(function() {
|
SimpleTest.executeSoon(function() {
|
||||||
let testframe = document.getElementById("testframe");
|
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() {
|
cookieImage.onerror = function() {
|
||||||
ok(false, "could not set cookie for test (" + tests[curTest].description + ")");
|
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
|
// fire up the test
|
||||||
|
|
|
@ -78,7 +78,7 @@ function checkResult(aCookieVal) {
|
||||||
|
|
||||||
function setupQueryResultAndRunTest() {
|
function setupQueryResultAndRunTest() {
|
||||||
var myXHR = new XMLHttpRequest();
|
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) {
|
myXHR.onload = function(e) {
|
||||||
checkResult(myXHR.responseText);
|
checkResult(myXHR.responseText);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ function setupQueryResultAndRunTest() {
|
||||||
// give it some time and load the test window
|
// give it some time and load the test window
|
||||||
SimpleTest.executeSoon(function() {
|
SimpleTest.executeSoon(function() {
|
||||||
let testframe = document.getElementById("testframe");
|
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() {
|
cookieImage.onerror = function() {
|
||||||
ok(false, "could not set cookie for test (" + tests[curTest].description + ")");
|
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
|
// fire up the test
|
||||||
|
|
Загрузка…
Ссылка в новой задаче