From ce83243b882d66e6d85b38ceb92d9be8ea4c64a0 Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Thu, 24 Mar 2016 17:17:01 -0700 Subject: [PATCH] Bug 1257861 - Test that we send cookies from XHRs in web workers when 3rd party cookies are disabled. r=sicking --- dom/workers/test/file_getcookie.sjs | 15 +++++ dom/workers/test/mochitest.ini | 2 + dom/workers/test/test_xhr_3rdparty.html | 74 +++++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 dom/workers/test/file_getcookie.sjs create mode 100644 dom/workers/test/test_xhr_3rdparty.html diff --git a/dom/workers/test/file_getcookie.sjs b/dom/workers/test/file_getcookie.sjs new file mode 100644 index 000000000000..b5204bdd71ec --- /dev/null +++ b/dom/workers/test/file_getcookie.sjs @@ -0,0 +1,15 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +function handleRequest(request, response) { + try { + var cookie = request.getHeader("Cookie"); + } catch (e) { + cookie = "EMPTY_COOKIE"; + } + + // avoid confusing cache behaviors. + response.setHeader("Cache-Control", "no-cache", false); + response.setHeader("Content-type", "text/plain", false); + response.setStatusLine(request.httpVersion, "200", "OK"); + response.write(cookie); +} diff --git a/dom/workers/test/mochitest.ini b/dom/workers/test/mochitest.ini index cd0bb2da084a..14d2e4166de7 100644 --- a/dom/workers/test/mochitest.ini +++ b/dom/workers/test/mochitest.ini @@ -25,6 +25,7 @@ support-files = eventDispatch_worker.js fibonacci_worker.js file_bug1010784_worker.js + file_getcookie.sjs foreign.js importForeignScripts_worker.js importScripts_mixedcontent.html @@ -242,6 +243,7 @@ skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 982828 [test_workersDisabled.html] [test_xhr.html] [test_xhr2.html] +[test_xhr_3rdparty.html] [test_xhr_headers.html] [test_xhr_implicit_cancel.html] [test_xhr_parameters.html] diff --git a/dom/workers/test/test_xhr_3rdparty.html b/dom/workers/test/test_xhr_3rdparty.html new file mode 100644 index 000000000000..4de5059743d5 --- /dev/null +++ b/dom/workers/test/test_xhr_3rdparty.html @@ -0,0 +1,74 @@ + + + + + + Test for DOM Worker Threads XHR (Bug 450452 ) + + + + +DOM Worker Threads XHR (Bug 450452) +

+ +
+
+
+ +