Bug 1452699 - Work-around caching issues in test_same_site_cookies_*. r=ckerschb
authorFrancois Marier <francois@mozilla.com>
Fri, 13 Apr 2018 18:49:58 -0700
changeset 413912 a22a88728d52c16a24b8f8daf844dfef8ae4517b
parent 413911 aa20ed5dbcbdcacb559fcee3d44b4715d4528c99
child 413913 38a419def0a7ecbd8e4ae37423c6fe8de316bbea
push id33853
push usercbrindusan@mozilla.com
push dateTue, 17 Apr 2018 09:51:13 +0000
treeherdermozilla-central@8b0ba3f7d099 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckerschb
bugs1452699
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1452699 - Work-around caching issues in test_same_site_cookies_*. r=ckerschb MozReview-Commit-ID: cTH2uyPMTA
dom/security/test/general/file_same_site_cookies_cross_origin_context.sjs
dom/security/test/general/file_same_site_cookies_from_script.sjs
dom/security/test/general/file_same_site_cookies_subrequest.sjs
dom/security/test/general/file_same_site_cookies_toplevel_nav.sjs
dom/security/test/general/test_same_site_cookies_cross_origin_context.html
dom/security/test/general/test_same_site_cookies_from_script.html
dom/security/test/general/test_same_site_cookies_subrequest.html
dom/security/test/general/test_same_site_cookies_toplevel_nav.html
--- a/dom/security/test/general/file_same_site_cookies_cross_origin_context.sjs
+++ b/dom/security/test/general/file_same_site_cookies_cross_origin_context.sjs
@@ -21,30 +21,30 @@ const FRAME = `
   </body>
   </html>`;
 
 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;
   }
 
   // we should never get here, but just in case return something unexpected
   response.write("D'oh");
 }
--- a/dom/security/test/general/file_same_site_cookies_from_script.sjs
+++ b/dom/security/test/general/file_same_site_cookies_from_script.sjs
@@ -29,21 +29,21 @@ const GET_COOKIE_FRAME = `
   </body>
   </html>`;
 
 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;
   }
 
   // we should never get here, but just in case return something unexpected
   response.write("D'oh");
 }
--- a/dom/security/test/general/file_same_site_cookies_subrequest.sjs
+++ b/dom/security/test/general/file_same_site_cookies_subrequest.sjs
@@ -16,44 +16,44 @@ const FRAME = `
   </body>
   </html>`;
 
 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);
     return;
   }
 
   // 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");
     }
     else {
       cookie = "myKey=noCookie";
     }
     response.setHeader("Content-Type", "image/png");
--- a/dom/security/test/general/file_same_site_cookies_toplevel_nav.sjs
+++ b/dom/security/test/general/file_same_site_cookies_toplevel_nav.sjs
@@ -29,44 +29,44 @@ const WIN = `
   </body>
   </html>`;
 
 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);
     return;
   }
 
   // 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");
     }
     else {
       cookie = "myKey=noCookie";
     }
     response.write(WIN);
--- a/dom/security/test/general/test_same_site_cookies_cross_origin_context.html
+++ b/dom/security/test/general/test_same_site_cookies_cross_origin_context.html
@@ -47,41 +47,41 @@ var tests = [
 ];
 
 
 window.addEventListener("message", receiveMessage);
 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();
     return;
   }
   // otherwise it's time to run the next test
   setCookieAndInitTest();
 }
 
 function setupQueryResultAndRunTest() {
   let testframe = document.getElementById("testframe");
-  testframe.src = tests[curTest].frameSRC;
+  testframe.src = tests[curTest].frameSRC + curTest;
 }
 
 function setCookieAndInitTest() {
   var cookieImage = document.getElementById("cookieImage");
   cookieImage.onload = function() {
     ok(true, "trying to set cookie for test (" + tests[curTest].description + ")");
     setupQueryResultAndRunTest();
   }
   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
 setCookieAndInitTest();
 
 </script>
 </body>
 </html>
--- a/dom/security/test/general/test_same_site_cookies_from_script.html
+++ b/dom/security/test/general/test_same_site_cookies_from_script.html
@@ -58,29 +58,29 @@ function receiveMessage(event) {
     return;
   }
   // otherwise it's time to run the next test
   setCookieAndInitTest();
 }
 
 function setupQueryResultAndRunTest() {
   let getCookieFrame = document.getElementById("getCookieFrame");
-  getCookieFrame.src = tests[curTest].getCookieSrc;
+  getCookieFrame.src = tests[curTest].getCookieSrc + curTest;
 }
 
 function setCookieAndInitTest() {
   var cookieFrame = document.getElementById("setCookieFrame");
   setCookieFrame.onload = function() {
     ok(true, "trying to set cookie for test (" + tests[curTest].description + ")");
     setupQueryResultAndRunTest();
   }
   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
 setCookieAndInitTest();
 
 </script>
 </body>
 </html>
--- a/dom/security/test/general/test_same_site_cookies_subrequest.html
+++ b/dom/security/test/general/test_same_site_cookies_subrequest.html
@@ -72,42 +72,42 @@ function checkResult(aCookieVal) {
     return;
   }
   // otherwise it's time to run the next test
   setCookieAndInitTest();
 }
 
 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);
   }
   myXHR.onerror = function(e) {
     ok(false, "could not query results from server (" + e.message + ")");
   }
   myXHR.send();
 
   // 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;
   });
 }
 
 function setCookieAndInitTest() {
   var cookieImage = document.getElementById("cookieImage");
   cookieImage.onload = function() {
     ok(true, "set cookie for test (" + tests[curTest].description + ")");
     setupQueryResultAndRunTest();
   }
   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
 setCookieAndInitTest();
 
 </script>
 </body>
 </html>
--- a/dom/security/test/general/test_same_site_cookies_toplevel_nav.html
+++ b/dom/security/test/general/test_same_site_cookies_toplevel_nav.html
@@ -73,42 +73,42 @@ function checkResult(aCookieVal) {
     return;
   }
   // otherwise it's time to run the next test
   setCookieAndInitTest();
 }
 
 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);
   }
   myXHR.onerror = function(e) {
     ok(false, "could not query results from server (" + e.message + ")");
   }
   myXHR.send();
 
   // 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;
   });
 }
 
 function setCookieAndInitTest() {
   var cookieImage = document.getElementById("cookieImage");
   cookieImage.onload = function() {
     ok(true, "set cookie for test (" + tests[curTest].description + ")");
     setupQueryResultAndRunTest();
   }
   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
 setCookieAndInitTest();
 
 </script>
 </body>
 </html>