diff --git a/toolkit/components/extensions/test/mochitest/mochitest-common.ini b/toolkit/components/extensions/test/mochitest/mochitest-common.ini index f991466a5161..01c539074bfc 100644 --- a/toolkit/components/extensions/test/mochitest/mochitest-common.ini +++ b/toolkit/components/extensions/test/mochitest/mochitest-common.ini @@ -50,6 +50,7 @@ support-files = redirect_auto.sjs redirection.sjs return_headers.sjs + return_headers_cors.sjs slow_response.sjs webrequest_worker.js !/dom/tests/mochitest/geolocation/network_geolocation.sjs @@ -163,3 +164,4 @@ skip-if = os == 'android' # Currently fails in emulator tests [test_ext_webrequest_urlClassification.html] [test_ext_window_postMessage.html] [test_ext_webrequest_redirect_bypass_cors.html] +[test_ext_fetch_origin.html] diff --git a/toolkit/components/extensions/test/mochitest/return_headers_cors.sjs b/toolkit/components/extensions/test/mochitest/return_headers_cors.sjs new file mode 100644 index 000000000000..ce8723a71c2d --- /dev/null +++ b/toolkit/components/extensions/test/mochitest/return_headers_cors.sjs @@ -0,0 +1,24 @@ +/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript sts=2 sw=2 et tw=80: */ +"use strict"; + +/* exported handleRequest */ + +function handleRequest(request, response) { + response.setStatusLine(request.httpVersion, 200, "OK"); + response.setHeader("Content-Type", "text/json", false); + response.setHeader("Access-Control-Allow-Credentials", "true", false); + response.setHeader("Access-Control-Allow-Origin", "*", false); + + + let headers = {}; + // Why on earth is this a nsISimpleEnumerator... + let enumerator = request.headers; + while (enumerator.hasMoreElements()) { + let header = enumerator.getNext().data; + headers[header.toLowerCase()] = request.getHeader(header); + } + + response.write(JSON.stringify(headers)); +} + diff --git a/toolkit/components/extensions/test/mochitest/test_ext_fetch_origin.html b/toolkit/components/extensions/test/mochitest/test_ext_fetch_origin.html new file mode 100644 index 000000000000..5f2d1deb975b --- /dev/null +++ b/toolkit/components/extensions/test/mochitest/test_ext_fetch_origin.html @@ -0,0 +1,60 @@ + + + + Test for simple WebExtension + + + + + + + + + + +