From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- netwerk/test/mochitests/beltzner.jpg | Bin 0 -> 9995 bytes netwerk/test/mochitests/beltzner.jpg^headers^ | 3 + netwerk/test/mochitests/empty.html | 16 + netwerk/test/mochitests/file_1331680.js | 23 ++ netwerk/test/mochitests/file_1502055.sjs | 17 + netwerk/test/mochitests/file_1503201.sjs | 4 + netwerk/test/mochitests/file_chromecommon.js | 15 + .../file_documentcookie_maxage_chromescript.js | 45 +++ .../mochitests/file_domain_hierarchy_inner.html | 13 + .../file_domain_hierarchy_inner.html^headers^ | 4 + .../file_domain_hierarchy_inner_inner.html | 13 + ...file_domain_hierarchy_inner_inner.html^headers^ | 4 + .../file_domain_hierarchy_inner_inner_inner.html | 13 + ...omain_hierarchy_inner_inner_inner.html^headers^ | 1 + netwerk/test/mochitests/file_domain_inner.html | 13 + .../mochitests/file_domain_inner.html^headers^ | 4 + .../test/mochitests/file_domain_inner_inner.html | 13 + .../file_domain_inner_inner.html^headers^ | 4 + .../mochitests/file_iframe_allow_same_origin.html | 8 + .../test/mochitests/file_iframe_allow_scripts.html | 6 + netwerk/test/mochitests/file_image_inner.html | 14 + .../test/mochitests/file_image_inner.html^headers^ | 4 + .../test/mochitests/file_image_inner_inner.html | 19 + .../file_image_inner_inner.html^headers^ | 4 + netwerk/test/mochitests/file_lnk.lnk | Bin 0 -> 1531 bytes netwerk/test/mochitests/file_loadflags_inner.html | 16 + .../mochitests/file_loadflags_inner.html^headers^ | 4 + .../mochitests/file_loadinfo_redirectchain.sjs | 109 ++++++ netwerk/test/mochitests/file_localhost_inner.html | 13 + .../mochitests/file_localhost_inner.html^headers^ | 4 + netwerk/test/mochitests/file_loopback_inner.html | 13 + .../mochitests/file_loopback_inner.html^headers^ | 4 + netwerk/test/mochitests/file_subdomain_inner.html | 13 + .../mochitests/file_subdomain_inner.html^headers^ | 4 + netwerk/test/mochitests/file_testcommon.js | 85 +++++ netwerk/test/mochitests/file_testloadflags.js | 130 +++++++ .../mochitests/file_testloadflags_chromescript.js | 144 ++++++++ netwerk/test/mochitests/iframe_1502055.html | 33 ++ netwerk/test/mochitests/image1.png | Bin 0 -> 821 bytes netwerk/test/mochitests/image1.png^headers^ | 3 + netwerk/test/mochitests/image2.png | Bin 0 -> 821 bytes netwerk/test/mochitests/image2.png^headers^ | 3 + netwerk/test/mochitests/method.sjs | 9 + netwerk/test/mochitests/mochitest.ini | 139 +++++++ netwerk/test/mochitests/origin_header.sjs | 10 + .../test/mochitests/origin_header_form_post.html | 19 + .../origin_header_form_post_xorigin.html | 19 + netwerk/test/mochitests/partial_content.sjs | 193 ++++++++++ netwerk/test/mochitests/redirect.sjs | 4 + netwerk/test/mochitests/redirect_idn.html | 0 netwerk/test/mochitests/redirect_idn.html^headers^ | 3 + netwerk/test/mochitests/redirect_to.sjs | 4 + netwerk/test/mochitests/rel_preconnect.sjs | 17 + netwerk/test/mochitests/reset_cookie_xhr.sjs | 15 + netwerk/test/mochitests/set_cookie_xhr.sjs | 15 + .../test/mochitests/signed_web_packaged_app.sjs | 73 ++++ netwerk/test/mochitests/subResources.sjs | 78 ++++ netwerk/test/mochitests/sw_1502055.js | 1 + netwerk/test/mochitests/test1.css | 2 + netwerk/test/mochitests/test1.css^headers^ | 3 + netwerk/test/mochitests/test2.css | 2 + netwerk/test/mochitests/test2.css^headers^ | 3 + netwerk/test/mochitests/test_1331680.html | 87 +++++ netwerk/test/mochitests/test_1331680_iframe.html | 68 ++++ netwerk/test/mochitests/test_1331680_xhr.html | 90 +++++ netwerk/test/mochitests/test_1396395.html | 48 +++ netwerk/test/mochitests/test_1421324.html | 88 +++++ netwerk/test/mochitests/test_1425031.html | 73 ++++ netwerk/test/mochitests/test_1502055.html | 49 +++ netwerk/test/mochitests/test_1503201.html | 28 ++ netwerk/test/mochitests/test_accept_header.html | 87 +++++ netwerk/test/mochitests/test_accept_header.sjs | 62 ++++ .../mochitests/test_arraybufferinputstream.html | 89 +++++ .../test_arraybufferinputstream_large.html | 45 +++ .../test_different_domain_in_hierarchy.html | 15 + netwerk/test/mochitests/test_differentdomain.html | 15 + .../mochitests/test_documentcookies_maxage.html | 149 ++++++++ netwerk/test/mochitests/test_fetch_lnk.html | 17 + netwerk/test/mochitests/test_idn_redirect.html | 35 ++ netwerk/test/mochitests/test_image.html | 14 + netwerk/test/mochitests/test_loadflags.html | 21 ++ .../mochitests/test_loadinfo_redirectchain.html | 269 ++++++++++++++ netwerk/test/mochitests/test_origin_header.html | 398 +++++++++++++++++++++ .../mochitests/test_partially_cached_content.html | 95 +++++ netwerk/test/mochitests/test_redirect_ref.html | 29 ++ netwerk/test/mochitests/test_rel_preconnect.html | 61 ++++ netwerk/test/mochitests/test_same_base_domain.html | 15 + .../test/mochitests/test_same_base_domain_2.html | 15 + .../test/mochitests/test_same_base_domain_3.html | 15 + .../test/mochitests/test_same_base_domain_4.html | 15 + .../test/mochitests/test_same_base_domain_5.html | 15 + .../test/mochitests/test_same_base_domain_6.html | 26 ++ netwerk/test/mochitests/test_samedomain.html | 15 + netwerk/test/mochitests/test_uri_scheme.html | 50 +++ .../mochitests/test_viewsource_unlinkable.html | 25 ++ netwerk/test/mochitests/test_xhr_method_case.html | 65 ++++ netwerk/test/mochitests/web_packaged_app.sjs | 47 +++ 97 files changed, 3682 insertions(+) create mode 100644 netwerk/test/mochitests/beltzner.jpg create mode 100644 netwerk/test/mochitests/beltzner.jpg^headers^ create mode 100644 netwerk/test/mochitests/empty.html create mode 100644 netwerk/test/mochitests/file_1331680.js create mode 100644 netwerk/test/mochitests/file_1502055.sjs create mode 100644 netwerk/test/mochitests/file_1503201.sjs create mode 100644 netwerk/test/mochitests/file_chromecommon.js create mode 100644 netwerk/test/mochitests/file_documentcookie_maxage_chromescript.js create mode 100644 netwerk/test/mochitests/file_domain_hierarchy_inner.html create mode 100644 netwerk/test/mochitests/file_domain_hierarchy_inner.html^headers^ create mode 100644 netwerk/test/mochitests/file_domain_hierarchy_inner_inner.html create mode 100644 netwerk/test/mochitests/file_domain_hierarchy_inner_inner.html^headers^ create mode 100644 netwerk/test/mochitests/file_domain_hierarchy_inner_inner_inner.html create mode 100644 netwerk/test/mochitests/file_domain_hierarchy_inner_inner_inner.html^headers^ create mode 100644 netwerk/test/mochitests/file_domain_inner.html create mode 100644 netwerk/test/mochitests/file_domain_inner.html^headers^ create mode 100644 netwerk/test/mochitests/file_domain_inner_inner.html create mode 100644 netwerk/test/mochitests/file_domain_inner_inner.html^headers^ create mode 100644 netwerk/test/mochitests/file_iframe_allow_same_origin.html create mode 100644 netwerk/test/mochitests/file_iframe_allow_scripts.html create mode 100644 netwerk/test/mochitests/file_image_inner.html create mode 100644 netwerk/test/mochitests/file_image_inner.html^headers^ create mode 100644 netwerk/test/mochitests/file_image_inner_inner.html create mode 100644 netwerk/test/mochitests/file_image_inner_inner.html^headers^ create mode 100644 netwerk/test/mochitests/file_lnk.lnk create mode 100644 netwerk/test/mochitests/file_loadflags_inner.html create mode 100644 netwerk/test/mochitests/file_loadflags_inner.html^headers^ create mode 100644 netwerk/test/mochitests/file_loadinfo_redirectchain.sjs create mode 100644 netwerk/test/mochitests/file_localhost_inner.html create mode 100644 netwerk/test/mochitests/file_localhost_inner.html^headers^ create mode 100644 netwerk/test/mochitests/file_loopback_inner.html create mode 100644 netwerk/test/mochitests/file_loopback_inner.html^headers^ create mode 100644 netwerk/test/mochitests/file_subdomain_inner.html create mode 100644 netwerk/test/mochitests/file_subdomain_inner.html^headers^ create mode 100644 netwerk/test/mochitests/file_testcommon.js create mode 100644 netwerk/test/mochitests/file_testloadflags.js create mode 100644 netwerk/test/mochitests/file_testloadflags_chromescript.js create mode 100644 netwerk/test/mochitests/iframe_1502055.html create mode 100644 netwerk/test/mochitests/image1.png create mode 100644 netwerk/test/mochitests/image1.png^headers^ create mode 100644 netwerk/test/mochitests/image2.png create mode 100644 netwerk/test/mochitests/image2.png^headers^ create mode 100644 netwerk/test/mochitests/method.sjs create mode 100644 netwerk/test/mochitests/mochitest.ini create mode 100644 netwerk/test/mochitests/origin_header.sjs create mode 100644 netwerk/test/mochitests/origin_header_form_post.html create mode 100644 netwerk/test/mochitests/origin_header_form_post_xorigin.html create mode 100644 netwerk/test/mochitests/partial_content.sjs create mode 100644 netwerk/test/mochitests/redirect.sjs create mode 100644 netwerk/test/mochitests/redirect_idn.html create mode 100644 netwerk/test/mochitests/redirect_idn.html^headers^ create mode 100644 netwerk/test/mochitests/redirect_to.sjs create mode 100644 netwerk/test/mochitests/rel_preconnect.sjs create mode 100644 netwerk/test/mochitests/reset_cookie_xhr.sjs create mode 100644 netwerk/test/mochitests/set_cookie_xhr.sjs create mode 100644 netwerk/test/mochitests/signed_web_packaged_app.sjs create mode 100644 netwerk/test/mochitests/subResources.sjs create mode 100644 netwerk/test/mochitests/sw_1502055.js create mode 100644 netwerk/test/mochitests/test1.css create mode 100644 netwerk/test/mochitests/test1.css^headers^ create mode 100644 netwerk/test/mochitests/test2.css create mode 100644 netwerk/test/mochitests/test2.css^headers^ create mode 100644 netwerk/test/mochitests/test_1331680.html create mode 100644 netwerk/test/mochitests/test_1331680_iframe.html create mode 100644 netwerk/test/mochitests/test_1331680_xhr.html create mode 100644 netwerk/test/mochitests/test_1396395.html create mode 100644 netwerk/test/mochitests/test_1421324.html create mode 100644 netwerk/test/mochitests/test_1425031.html create mode 100644 netwerk/test/mochitests/test_1502055.html create mode 100644 netwerk/test/mochitests/test_1503201.html create mode 100644 netwerk/test/mochitests/test_accept_header.html create mode 100644 netwerk/test/mochitests/test_accept_header.sjs create mode 100644 netwerk/test/mochitests/test_arraybufferinputstream.html create mode 100644 netwerk/test/mochitests/test_arraybufferinputstream_large.html create mode 100644 netwerk/test/mochitests/test_different_domain_in_hierarchy.html create mode 100644 netwerk/test/mochitests/test_differentdomain.html create mode 100644 netwerk/test/mochitests/test_documentcookies_maxage.html create mode 100644 netwerk/test/mochitests/test_fetch_lnk.html create mode 100644 netwerk/test/mochitests/test_idn_redirect.html create mode 100644 netwerk/test/mochitests/test_image.html create mode 100644 netwerk/test/mochitests/test_loadflags.html create mode 100644 netwerk/test/mochitests/test_loadinfo_redirectchain.html create mode 100644 netwerk/test/mochitests/test_origin_header.html create mode 100644 netwerk/test/mochitests/test_partially_cached_content.html create mode 100644 netwerk/test/mochitests/test_redirect_ref.html create mode 100644 netwerk/test/mochitests/test_rel_preconnect.html create mode 100644 netwerk/test/mochitests/test_same_base_domain.html create mode 100644 netwerk/test/mochitests/test_same_base_domain_2.html create mode 100644 netwerk/test/mochitests/test_same_base_domain_3.html create mode 100644 netwerk/test/mochitests/test_same_base_domain_4.html create mode 100644 netwerk/test/mochitests/test_same_base_domain_5.html create mode 100644 netwerk/test/mochitests/test_same_base_domain_6.html create mode 100644 netwerk/test/mochitests/test_samedomain.html create mode 100644 netwerk/test/mochitests/test_uri_scheme.html create mode 100644 netwerk/test/mochitests/test_viewsource_unlinkable.html create mode 100644 netwerk/test/mochitests/test_xhr_method_case.html create mode 100644 netwerk/test/mochitests/web_packaged_app.sjs (limited to 'netwerk/test/mochitests') diff --git a/netwerk/test/mochitests/beltzner.jpg b/netwerk/test/mochitests/beltzner.jpg new file mode 100644 index 0000000000..75849bc40d Binary files /dev/null and b/netwerk/test/mochitests/beltzner.jpg differ diff --git a/netwerk/test/mochitests/beltzner.jpg^headers^ b/netwerk/test/mochitests/beltzner.jpg^headers^ new file mode 100644 index 0000000000..cb51f27018 --- /dev/null +++ b/netwerk/test/mochitests/beltzner.jpg^headers^ @@ -0,0 +1,3 @@ +Cache-Control: no-store +Set-Cookie: mike=beltzer + diff --git a/netwerk/test/mochitests/empty.html b/netwerk/test/mochitests/empty.html new file mode 100644 index 0000000000..e60f5abdf4 --- /dev/null +++ b/netwerk/test/mochitests/empty.html @@ -0,0 +1,16 @@ + + + + + + + + + + This page does nothing. If the loading page managed to load this, the test + probably succeeded. + + diff --git a/netwerk/test/mochitests/file_1331680.js b/netwerk/test/mochitests/file_1331680.js new file mode 100644 index 0000000000..637c1f2a6d --- /dev/null +++ b/netwerk/test/mochitests/file_1331680.js @@ -0,0 +1,23 @@ +/* eslint-env mozilla/chrome-script */ + +"use strict"; + +var observer = { + observe(subject, topic, data) { + if (topic == "cookie-changed") { + let cookie = subject.QueryInterface(Ci.nsICookie); + sendAsyncMessage("cookieName", cookie.name + "=" + cookie.value); + sendAsyncMessage("cookieOperation", data); + } + }, +}; + +addMessageListener("createObserver", function (e) { + Services.obs.addObserver(observer, "cookie-changed"); + sendAsyncMessage("createObserver:return"); +}); + +addMessageListener("removeObserver", function (e) { + Services.obs.removeObserver(observer, "cookie-changed"); + sendAsyncMessage("removeObserver:return"); +}); diff --git a/netwerk/test/mochitests/file_1502055.sjs b/netwerk/test/mochitests/file_1502055.sjs new file mode 100644 index 0000000000..71a4ddfa66 --- /dev/null +++ b/netwerk/test/mochitests/file_1502055.sjs @@ -0,0 +1,17 @@ +function handleRequest(request, response) { + var count = parseInt(getState("count")); + if (!count) { + count = 0; + } + + if (count == 0) { + response.setStatusLine(request.httpVersion, "200", "OK"); + response.setHeader("Content-Type", "text/html", false); + response.write("Hello world!"); + setState("count", "1"); + return; + } + + response.setStatusLine(request.httpVersion, "304", "Not Modified"); + response.setHeader("Clear-Site-Data", '"storage"'); +} diff --git a/netwerk/test/mochitests/file_1503201.sjs b/netwerk/test/mochitests/file_1503201.sjs new file mode 100644 index 0000000000..ac5c304103 --- /dev/null +++ b/netwerk/test/mochitests/file_1503201.sjs @@ -0,0 +1,4 @@ +function handleRequest(request, response) { + response.setStatusLine(request.httpVersion, 401, "Unauthorized"); + response.setHeader("WWW-Authenticate", 'Bearer realm="foo"'); +} diff --git a/netwerk/test/mochitests/file_chromecommon.js b/netwerk/test/mochitests/file_chromecommon.js new file mode 100644 index 0000000000..986a9d7ef1 --- /dev/null +++ b/netwerk/test/mochitests/file_chromecommon.js @@ -0,0 +1,15 @@ +/* eslint-env mozilla/chrome-script */ + +"use strict"; + +// eslint-disable-next-line mozilla/use-services +let cs = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager); + +addMessageListener("getCookieCountAndClear", () => { + let count = cs.cookies.length; + cs.removeAll(); + + sendAsyncMessage("getCookieCountAndClear:return", { count }); +}); + +cs.removeAll(); diff --git a/netwerk/test/mochitests/file_documentcookie_maxage_chromescript.js b/netwerk/test/mochitests/file_documentcookie_maxage_chromescript.js new file mode 100644 index 0000000000..dc1e8eb05f --- /dev/null +++ b/netwerk/test/mochitests/file_documentcookie_maxage_chromescript.js @@ -0,0 +1,45 @@ +/* eslint-env mozilla/chrome-script */ + +"use strict"; + +function getCookieService() { + // eslint-disable-next-line mozilla/use-services + return Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager); +} + +function getCookies(cs) { + let cookies = []; + for (let cookie of cs.cookies) { + cookies.push({ + host: cookie.host, + path: cookie.path, + name: cookie.name, + value: cookie.value, + expires: cookie.expires, + }); + } + return cookies; +} + +function removeAllCookies(cs) { + cs.removeAll(); +} + +addMessageListener("init", _ => { + let cs = getCookieService(); + removeAllCookies(cs); + sendAsyncMessage("init:return"); +}); + +addMessageListener("getCookies", _ => { + let cs = getCookieService(); + let cookies = getCookies(cs); + removeAllCookies(cs); + sendAsyncMessage("getCookies:return", { cookies }); +}); + +addMessageListener("shutdown", _ => { + let cs = getCookieService(); + removeAllCookies(cs); + sendAsyncMessage("shutdown:return"); +}); diff --git a/netwerk/test/mochitests/file_domain_hierarchy_inner.html b/netwerk/test/mochitests/file_domain_hierarchy_inner.html new file mode 100644 index 0000000000..713432196f --- /dev/null +++ b/netwerk/test/mochitests/file_domain_hierarchy_inner.html @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/netwerk/test/mochitests/file_domain_hierarchy_inner.html^headers^ b/netwerk/test/mochitests/file_domain_hierarchy_inner.html^headers^ new file mode 100644 index 0000000000..a56be562a4 --- /dev/null +++ b/netwerk/test/mochitests/file_domain_hierarchy_inner.html^headers^ @@ -0,0 +1,4 @@ +Set-Cookie: meta=tag +Cache-Control: no-cache, no-store, must-revalidate +Pragma: no-cache +Expires: 0 diff --git a/netwerk/test/mochitests/file_domain_hierarchy_inner_inner.html b/netwerk/test/mochitests/file_domain_hierarchy_inner_inner.html new file mode 100644 index 0000000000..dfceac2c6c --- /dev/null +++ b/netwerk/test/mochitests/file_domain_hierarchy_inner_inner.html @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/netwerk/test/mochitests/file_domain_hierarchy_inner_inner.html^headers^ b/netwerk/test/mochitests/file_domain_hierarchy_inner_inner.html^headers^ new file mode 100644 index 0000000000..1ab9133473 --- /dev/null +++ b/netwerk/test/mochitests/file_domain_hierarchy_inner_inner.html^headers^ @@ -0,0 +1,4 @@ +Set-Cookie: meta2=tag2 +Cache-Control: no-cache, no-store, must-revalidate +Pragma: no-cache +Expires: 0 diff --git a/netwerk/test/mochitests/file_domain_hierarchy_inner_inner_inner.html b/netwerk/test/mochitests/file_domain_hierarchy_inner_inner_inner.html new file mode 100644 index 0000000000..d306efb1c0 --- /dev/null +++ b/netwerk/test/mochitests/file_domain_hierarchy_inner_inner_inner.html @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/netwerk/test/mochitests/file_domain_hierarchy_inner_inner_inner.html^headers^ b/netwerk/test/mochitests/file_domain_hierarchy_inner_inner_inner.html^headers^ new file mode 100644 index 0000000000..add3336ec9 --- /dev/null +++ b/netwerk/test/mochitests/file_domain_hierarchy_inner_inner_inner.html^headers^ @@ -0,0 +1 @@ +Set-Cookie: meta3=tag3 diff --git a/netwerk/test/mochitests/file_domain_inner.html b/netwerk/test/mochitests/file_domain_inner.html new file mode 100644 index 0000000000..30a0821980 --- /dev/null +++ b/netwerk/test/mochitests/file_domain_inner.html @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/netwerk/test/mochitests/file_domain_inner.html^headers^ b/netwerk/test/mochitests/file_domain_inner.html^headers^ new file mode 100644 index 0000000000..a56be562a4 --- /dev/null +++ b/netwerk/test/mochitests/file_domain_inner.html^headers^ @@ -0,0 +1,4 @@ +Set-Cookie: meta=tag +Cache-Control: no-cache, no-store, must-revalidate +Pragma: no-cache +Expires: 0 diff --git a/netwerk/test/mochitests/file_domain_inner_inner.html b/netwerk/test/mochitests/file_domain_inner_inner.html new file mode 100644 index 0000000000..5850e3fa0f --- /dev/null +++ b/netwerk/test/mochitests/file_domain_inner_inner.html @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/netwerk/test/mochitests/file_domain_inner_inner.html^headers^ b/netwerk/test/mochitests/file_domain_inner_inner.html^headers^ new file mode 100644 index 0000000000..1ab9133473 --- /dev/null +++ b/netwerk/test/mochitests/file_domain_inner_inner.html^headers^ @@ -0,0 +1,4 @@ +Set-Cookie: meta2=tag2 +Cache-Control: no-cache, no-store, must-revalidate +Pragma: no-cache +Expires: 0 diff --git a/netwerk/test/mochitests/file_iframe_allow_same_origin.html b/netwerk/test/mochitests/file_iframe_allow_same_origin.html new file mode 100644 index 0000000000..c34187bb0a --- /dev/null +++ b/netwerk/test/mochitests/file_iframe_allow_same_origin.html @@ -0,0 +1,8 @@ + + + + diff --git a/netwerk/test/mochitests/file_iframe_allow_scripts.html b/netwerk/test/mochitests/file_iframe_allow_scripts.html new file mode 100644 index 0000000000..01504841a1 --- /dev/null +++ b/netwerk/test/mochitests/file_iframe_allow_scripts.html @@ -0,0 +1,6 @@ + + + + diff --git a/netwerk/test/mochitests/file_image_inner.html b/netwerk/test/mochitests/file_image_inner.html new file mode 100644 index 0000000000..6daf7224da --- /dev/null +++ b/netwerk/test/mochitests/file_image_inner.html @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/netwerk/test/mochitests/file_image_inner.html^headers^ b/netwerk/test/mochitests/file_image_inner.html^headers^ new file mode 100644 index 0000000000..a56be562a4 --- /dev/null +++ b/netwerk/test/mochitests/file_image_inner.html^headers^ @@ -0,0 +1,4 @@ +Set-Cookie: meta=tag +Cache-Control: no-cache, no-store, must-revalidate +Pragma: no-cache +Expires: 0 diff --git a/netwerk/test/mochitests/file_image_inner_inner.html b/netwerk/test/mochitests/file_image_inner_inner.html new file mode 100644 index 0000000000..1e605f1a25 --- /dev/null +++ b/netwerk/test/mochitests/file_image_inner_inner.html @@ -0,0 +1,19 @@ + + + + + + + + + + + + diff --git a/netwerk/test/mochitests/file_image_inner_inner.html^headers^ b/netwerk/test/mochitests/file_image_inner_inner.html^headers^ new file mode 100644 index 0000000000..1ab9133473 --- /dev/null +++ b/netwerk/test/mochitests/file_image_inner_inner.html^headers^ @@ -0,0 +1,4 @@ +Set-Cookie: meta2=tag2 +Cache-Control: no-cache, no-store, must-revalidate +Pragma: no-cache +Expires: 0 diff --git a/netwerk/test/mochitests/file_lnk.lnk b/netwerk/test/mochitests/file_lnk.lnk new file mode 100644 index 0000000000..abce7587d2 Binary files /dev/null and b/netwerk/test/mochitests/file_lnk.lnk differ diff --git a/netwerk/test/mochitests/file_loadflags_inner.html b/netwerk/test/mochitests/file_loadflags_inner.html new file mode 100644 index 0000000000..5fc7e8d913 --- /dev/null +++ b/netwerk/test/mochitests/file_loadflags_inner.html @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/netwerk/test/mochitests/file_loadflags_inner.html^headers^ b/netwerk/test/mochitests/file_loadflags_inner.html^headers^ new file mode 100644 index 0000000000..a56be562a4 --- /dev/null +++ b/netwerk/test/mochitests/file_loadflags_inner.html^headers^ @@ -0,0 +1,4 @@ +Set-Cookie: meta=tag +Cache-Control: no-cache, no-store, must-revalidate +Pragma: no-cache +Expires: 0 diff --git a/netwerk/test/mochitests/file_loadinfo_redirectchain.sjs b/netwerk/test/mochitests/file_loadinfo_redirectchain.sjs new file mode 100644 index 0000000000..0c89f7d538 --- /dev/null +++ b/netwerk/test/mochitests/file_loadinfo_redirectchain.sjs @@ -0,0 +1,109 @@ +/* + * Redirect handler specifically for the needs of: + * Bug 1194052 - Append Principal to RedirectChain within LoadInfo before the channel is succesfully openend + */ + +function createIframeContent(aQuery) { + var content = ` + + + + Bug 1194052 - LoadInfo redirect chain subtest + + + + + `; + + return content; +} + +function handleRequest(request, response) { + response.setHeader("Cache-Control", "no-cache", false); + var queryString = request.queryString; + + if ( + queryString == "iframe-redir-https-2" || + queryString == "iframe-redir-err-2" + ) { + var query = queryString.replace("iframe-", ""); + // send upgrade-insecure-requests CSP header + response.setHeader("Content-Type", "text/html", false); + response.setHeader( + "Content-Security-Policy", + "upgrade-insecure-requests", + false + ); + response.write(createIframeContent(query)); + return; + } + + // at the end of the redirectchain we return some text + // for sanity checking + if (queryString == "redir-0" || queryString == "redir-https-0") { + response.setHeader("Content-Type", "text/html", false); + response.write("checking redirectchain"); + return; + } + + // special case redir-err-1 and return an error to trigger the fallback + if (queryString == "redir-err-1") { + response.setStatusLine("1.1", 404, "Bad request"); + return; + } + + // must be a redirect + var newLocation = ""; + switch (queryString) { + case "redir-err-2": + newLocation = + "http://example.com/tests/netwerk/test/mochitests/file_loadinfo_redirectchain.sjs?redir-err-1"; + break; + + case "redir-https-2": + newLocation = + "http://example.com/tests/netwerk/test/mochitests/file_loadinfo_redirectchain.sjs?redir-https-1"; + break; + + case "redir-https-1": + newLocation = + "http://example.com/tests/netwerk/test/mochitests/file_loadinfo_redirectchain.sjs?redir-https-0"; + break; + + case "redir-2": + newLocation = + "http://mochi.test:8888/tests/netwerk/test/mochitests/file_loadinfo_redirectchain.sjs?redir-1"; + break; + + case "redir-1": + newLocation = + "http://mochi.test:8888/tests/netwerk/test/mochitests/file_loadinfo_redirectchain.sjs?redir-0"; + break; + } + + response.setStatusLine("1.1", 302, "Found"); + response.setHeader("Location", newLocation, false); +} diff --git a/netwerk/test/mochitests/file_localhost_inner.html b/netwerk/test/mochitests/file_localhost_inner.html new file mode 100644 index 0000000000..d291370a47 --- /dev/null +++ b/netwerk/test/mochitests/file_localhost_inner.html @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/netwerk/test/mochitests/file_localhost_inner.html^headers^ b/netwerk/test/mochitests/file_localhost_inner.html^headers^ new file mode 100644 index 0000000000..a56be562a4 --- /dev/null +++ b/netwerk/test/mochitests/file_localhost_inner.html^headers^ @@ -0,0 +1,4 @@ +Set-Cookie: meta=tag +Cache-Control: no-cache, no-store, must-revalidate +Pragma: no-cache +Expires: 0 diff --git a/netwerk/test/mochitests/file_loopback_inner.html b/netwerk/test/mochitests/file_loopback_inner.html new file mode 100644 index 0000000000..91aa1d89c5 --- /dev/null +++ b/netwerk/test/mochitests/file_loopback_inner.html @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/netwerk/test/mochitests/file_loopback_inner.html^headers^ b/netwerk/test/mochitests/file_loopback_inner.html^headers^ new file mode 100644 index 0000000000..a56be562a4 --- /dev/null +++ b/netwerk/test/mochitests/file_loopback_inner.html^headers^ @@ -0,0 +1,4 @@ +Set-Cookie: meta=tag +Cache-Control: no-cache, no-store, must-revalidate +Pragma: no-cache +Expires: 0 diff --git a/netwerk/test/mochitests/file_subdomain_inner.html b/netwerk/test/mochitests/file_subdomain_inner.html new file mode 100644 index 0000000000..a48f36a7de --- /dev/null +++ b/netwerk/test/mochitests/file_subdomain_inner.html @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/netwerk/test/mochitests/file_subdomain_inner.html^headers^ b/netwerk/test/mochitests/file_subdomain_inner.html^headers^ new file mode 100644 index 0000000000..a56be562a4 --- /dev/null +++ b/netwerk/test/mochitests/file_subdomain_inner.html^headers^ @@ -0,0 +1,4 @@ +Set-Cookie: meta=tag +Cache-Control: no-cache, no-store, must-revalidate +Pragma: no-cache +Expires: 0 diff --git a/netwerk/test/mochitests/file_testcommon.js b/netwerk/test/mochitests/file_testcommon.js new file mode 100644 index 0000000000..8db5c644d4 --- /dev/null +++ b/netwerk/test/mochitests/file_testcommon.js @@ -0,0 +1,85 @@ +"use strict"; + +const SCRIPT_URL = SimpleTest.getTestFileURL("file_chromecommon.js"); + +var gExpectedCookies; +var gExpectedLoads; + +var gPopup; + +var gScript; + +var gLoads = 0; + +function setupTest(uri, cookies, loads) { + SimpleTest.waitForExplicitFinish(); + + var prefSet = new Promise(resolve => { + SpecialPowers.pushPrefEnv( + { + set: [ + ["network.cookie.cookieBehavior", 1], + // cookieBehavior 1 allows cookies from chrome script if we enable + // exceptions. + ["network.cookie.rejectForeignWithExceptions.enabled", false], + // Bug 1617611: Fix all the tests broken by "cookies SameSite=lax by default" + ["network.cookie.sameSite.laxByDefault", false], + ], + }, + resolve + ); + }); + + gScript = SpecialPowers.loadChromeScript(SCRIPT_URL); + gExpectedCookies = cookies; + gExpectedLoads = loads; + + // Listen for MessageEvents. + window.addEventListener("message", messageReceiver); + + prefSet.then(() => { + // load a window which contains an iframe; each will attempt to set + // cookies from their respective domains. + gPopup = window.open(uri, "hai", "width=100,height=100"); + }); +} + +function finishTest() { + gScript.destroy(); + SpecialPowers.clearUserPref("network.cookie.sameSite.laxByDefault"); + SimpleTest.finish(); +} + +/** Receives MessageEvents to this window. */ +// Count and check loads. +function messageReceiver(evt) { + is(evt.data, "message", "message data received from popup"); + if (evt.data != "message") { + gPopup.close(); + window.removeEventListener("message", messageReceiver); + + finishTest(); + return; + } + + // only run the test when all our children are done loading & setting cookies + if (++gLoads == gExpectedLoads) { + gPopup.close(); + window.removeEventListener("message", messageReceiver); + + runTest(); + } +} + +// runTest() is run by messageReceiver(). +// Count and check cookies. +function runTest() { + // set a cookie from a domain of "localhost" + document.cookie = "oh=hai"; + + gScript.addMessageListener("getCookieCountAndClear:return", ({ count }) => { + is(count, gExpectedCookies, "total number of cookies"); + finishTest(); + }); + gScript.sendAsyncMessage("getCookieCountAndClear"); +} diff --git a/netwerk/test/mochitests/file_testloadflags.js b/netwerk/test/mochitests/file_testloadflags.js new file mode 100644 index 0000000000..56c9596a41 --- /dev/null +++ b/netwerk/test/mochitests/file_testloadflags.js @@ -0,0 +1,130 @@ +"use strict"; + +const SCRIPT_URL = SimpleTest.getTestFileURL( + "file_testloadflags_chromescript.js" +); + +let gScript; +var gExpectedCookies; +var gExpectedHeaders; +var gExpectedLoads; + +var gObs; +var gPopup; + +var gHeaders = 0; +var gLoads = 0; + +// setupTest() is run from 'onload='. +function setupTest(uri, domain, cookies, loads, headers) { + info( + "setupTest uri: " + + uri + + " domain: " + + domain + + " cookies: " + + cookies + + " loads: " + + loads + + " headers: " + + headers + ); + + SimpleTest.waitForExplicitFinish(); + + var prefSet = new Promise(resolve => { + SpecialPowers.pushPrefEnv( + { + set: [ + ["network.cookie.cookieBehavior", 1], + ["network.cookie.sameSite.schemeful", false], + ], + }, + resolve + ); + }); + + gExpectedCookies = cookies; + gExpectedLoads = loads; + gExpectedHeaders = headers; + + gScript = SpecialPowers.loadChromeScript(SCRIPT_URL); + gScript.addMessageListener("info", ({ str }) => info(str)); + gScript.addMessageListener("ok", ({ c, m }) => ok(c, m)); + gScript.addMessageListener("observer:gotCookie", ({ cookie, uri }) => { + isnot( + cookie.indexOf("oh=hai"), + -1, + "cookie 'oh=hai' is in header for " + uri + ); + ++gHeaders; + }); + + var scriptReady = new Promise(resolve => { + gScript.addMessageListener("init:return", resolve); + gScript.sendAsyncMessage("init", { domain }); + }); + + // Listen for MessageEvents. + window.addEventListener("message", messageReceiver); + + Promise.all([prefSet, scriptReady]).then(() => { + // load a window which contains an iframe; each will attempt to set + // cookies from their respective domains. + gPopup = window.open(uri, "hai", "width=100,height=100"); + }); +} + +function finishTest() { + gScript.addMessageListener("shutdown:return", () => { + gScript.destroy(); + SimpleTest.finish(); + }); + gScript.sendAsyncMessage("shutdown"); +} + +/** Receives MessageEvents to this window. */ +// Count and check loads. +function messageReceiver(evt) { + ok( + evt.data == "f_lf_i msg data img" || evt.data == "f_lf_i msg data page", + "message data received from popup" + ); + if (evt.data == "f_lf_i msg data img") { + info("message data received from popup for image"); + } + if (evt.data == "f_lf_i msg data page") { + info("message data received from popup for page"); + } + if (evt.data != "f_lf_i msg data img" && evt.data != "f_lf_i msg data page") { + info("got this message but don't know what it is " + evt.data); + gPopup.close(); + window.removeEventListener("message", messageReceiver); + + finishTest(); + return; + } + + // only run the test when all our children are done loading & setting cookies + if (++gLoads == gExpectedLoads) { + gPopup.close(); + window.removeEventListener("message", messageReceiver); + + runTest(); + } +} + +// runTest() is run by messageReceiver(). +// Check headers, and count and check cookies. +function runTest() { + // set a cookie from a domain of "localhost" + document.cookie = "o=noes"; + + is(gHeaders, gExpectedHeaders, "number of observed request headers"); + gScript.addMessageListener("getCookieCount:return", ({ count }) => { + is(count, gExpectedCookies, "total number of cookies"); + finishTest(); + }); + + gScript.sendAsyncMessage("getCookieCount"); +} diff --git a/netwerk/test/mochitests/file_testloadflags_chromescript.js b/netwerk/test/mochitests/file_testloadflags_chromescript.js new file mode 100644 index 0000000000..a74920d2c2 --- /dev/null +++ b/netwerk/test/mochitests/file_testloadflags_chromescript.js @@ -0,0 +1,144 @@ +/* eslint-env mozilla/chrome-script */ +/* eslint-disable mozilla/use-services */ + +"use strict"; + +var gObs; + +function info(s) { + sendAsyncMessage("info", { str: String(s) }); +} + +function ok(c, m) { + sendAsyncMessage("ok", { c, m }); +} + +function is(a, b, m) { + ok(Object.is(a, b), m + " (" + a + " === " + b + ")"); +} + +// Count headers. +function obs() { + info("adding observer"); + + this.os = Cc["@mozilla.org/observer-service;1"].getService( + Ci.nsIObserverService + ); + this.os.addObserver(this, "http-on-modify-request"); +} + +obs.prototype = { + observe(theSubject, theTopic, theData) { + info("theSubject " + theSubject); + info("theTopic " + theTopic); + info("theData " + theData); + + var channel = theSubject.QueryInterface(Ci.nsIHttpChannel); + info("channel " + channel); + try { + info("channel.URI " + channel.URI); + info("channel.URI.spec " + channel.URI.spec); + channel.visitRequestHeaders({ + visitHeader(aHeader, aValue) { + info(aHeader + ": " + aValue); + }, + }); + } catch (err) { + ok(false, "catch error " + err); + } + + // Ignore notifications we don't care about (like favicons) + if ( + !channel.URI.spec.includes( + "http://example.org/tests/netwerk/test/mochitests/" + ) + ) { + info("ignoring this one"); + return; + } + + sendAsyncMessage("observer:gotCookie", { + cookie: channel.getRequestHeader("Cookie"), + uri: channel.URI.spec, + }); + }, + + remove() { + info("removing observer"); + + this.os.removeObserver(this, "http-on-modify-request"); + this.os = null; + }, +}; + +function getCookieCount(cs) { + let count = 0; + for (let cookie of cs.cookies) { + info("cookie: " + cookie); + info( + "cookie host " + + cookie.host + + " path " + + cookie.path + + " name " + + cookie.name + + " value " + + cookie.value + + " isSecure " + + cookie.isSecure + + " expires " + + cookie.expires + ); + ++count; + } + + return count; +} + +addMessageListener("init", ({ domain }) => { + let cs = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager); + + info("we are going to remove these cookies"); + + let count = getCookieCount(cs); + info(count + " cookies"); + + cs.removeAll(); + cs.add( + domain, + "/", + "oh", + "hai", + false, + false, + true, + Math.pow(2, 62), + {}, + Ci.nsICookie.SAMESITE_NONE, + Ci.nsICookie.SCHEME_HTTPS + ); + is( + cs.countCookiesFromHost(domain), + 1, + "number of cookies for domain " + domain + ); + + gObs = new obs(); + sendAsyncMessage("init:return"); +}); + +addMessageListener("getCookieCount", () => { + let cs = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager); + let count = getCookieCount(cs); + + cs.removeAll(); + sendAsyncMessage("getCookieCount:return", { count }); +}); + +addMessageListener("shutdown", () => { + gObs.remove(); + + let cs = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager); + cs.removeAll(); + sendAsyncMessage("shutdown:return"); +}); diff --git a/netwerk/test/mochitests/iframe_1502055.html b/netwerk/test/mochitests/iframe_1502055.html new file mode 100644 index 0000000000..7f3e915978 --- /dev/null +++ b/netwerk/test/mochitests/iframe_1502055.html @@ -0,0 +1,33 @@ + + + + + + + diff --git a/netwerk/test/mochitests/image1.png b/netwerk/test/mochitests/image1.png new file mode 100644 index 0000000000..272d67c0ce Binary files /dev/null and b/netwerk/test/mochitests/image1.png differ diff --git a/netwerk/test/mochitests/image1.png^headers^ b/netwerk/test/mochitests/image1.png^headers^ new file mode 100644 index 0000000000..2390289e01 --- /dev/null +++ b/netwerk/test/mochitests/image1.png^headers^ @@ -0,0 +1,3 @@ +Cache-Control: no-store +Set-Cookie: foo=bar + diff --git a/netwerk/test/mochitests/image2.png b/netwerk/test/mochitests/image2.png new file mode 100644 index 0000000000..272d67c0ce Binary files /dev/null and b/netwerk/test/mochitests/image2.png differ diff --git a/netwerk/test/mochitests/image2.png^headers^ b/netwerk/test/mochitests/image2.png^headers^ new file mode 100644 index 0000000000..6c0eea5ab6 --- /dev/null +++ b/netwerk/test/mochitests/image2.png^headers^ @@ -0,0 +1,3 @@ +Cache-Control: no-store +Set-Cookie: foo2=bar2 + diff --git a/netwerk/test/mochitests/method.sjs b/netwerk/test/mochitests/method.sjs new file mode 100644 index 0000000000..f29b20aa00 --- /dev/null +++ b/netwerk/test/mochitests/method.sjs @@ -0,0 +1,9 @@ +function handleRequest(request, response) { + // avoid confusing cache behaviors + response.setHeader("Cache-Control", "no-cache", false); + response.setHeader("Content-Type", "text/plain", false); + response.setHeader("Access-Control-Allow-Origin", "*", false); + + // echo method + response.write(request.method); +} diff --git a/netwerk/test/mochitests/mochitest.ini b/netwerk/test/mochitests/mochitest.ini new file mode 100644 index 0000000000..0f1b40bf2f --- /dev/null +++ b/netwerk/test/mochitests/mochitest.ini @@ -0,0 +1,139 @@ +[DEFAULT] +support-files = + method.sjs + partial_content.sjs + rel_preconnect.sjs + set_cookie_xhr.sjs + reset_cookie_xhr.sjs + web_packaged_app.sjs + file_documentcookie_maxage_chromescript.js + file_loadinfo_redirectchain.sjs + file_1331680.js + file_1503201.sjs + file_iframe_allow_scripts.html + file_iframe_allow_same_origin.html + redirect_idn.html^headers^ + redirect_idn.html + empty.html + redirect.sjs + redirect_to.sjs + origin_header.sjs + origin_header_form_post.html + origin_header_form_post_xorigin.html + subResources.sjs + beltzner.jpg + beltzner.jpg^headers^ + file_chromecommon.js + file_domain_hierarchy_inner.html + file_domain_hierarchy_inner.html^headers^ + file_domain_hierarchy_inner_inner.html + file_domain_hierarchy_inner_inner.html^headers^ + file_domain_hierarchy_inner_inner_inner.html + file_domain_hierarchy_inner_inner_inner.html^headers^ + file_domain_inner.html + file_domain_inner.html^headers^ + file_domain_inner_inner.html + file_domain_inner_inner.html^headers^ + file_image_inner.html + file_image_inner.html^headers^ + file_image_inner_inner.html + file_image_inner_inner.html^headers^ + file_lnk.lnk + file_loadflags_inner.html + file_loadflags_inner.html^headers^ + file_localhost_inner.html + file_localhost_inner.html^headers^ + file_loopback_inner.html + file_loopback_inner.html^headers^ + file_subdomain_inner.html + file_subdomain_inner.html^headers^ + file_testcommon.js + file_testloadflags.js + file_testloadflags_chromescript.js + image1.png + image1.png^headers^ + image2.png + image2.png^headers^ + test1.css + test1.css^headers^ + test2.css + test2.css^headers^ +prefs = + javascript.options.large_arraybuffers=true + +[test_arraybufferinputstream.html] +[test_arraybufferinputstream_large.html] +# Large ArrayBuffers not supported on 32-bit. TSan shadow memory causes OOMs. +skip-if = bits == 32 || tsan || asan +[test_documentcookies_maxage.html] +# Bug 1617611: Fix all the tests broken by "cookies SameSite=lax by default" +skip-if = xorigin +[test_idn_redirect.html] +skip-if = + http3 +[test_loadinfo_redirectchain.html] +fail-if = xorigin +skip-if = + http3 +[test_partially_cached_content.html] +[test_rel_preconnect.html] +[test_redirect_ref.html] +skip-if = + http3 +[test_uri_scheme.html] +skip-if = (verify && debug && os == 'mac') +[test_viewsource_unlinkable.html] +[test_xhr_method_case.html] +[test_1331680.html] +[test_1331680_iframe.html] +[test_1331680_xhr.html] +skip-if = verify +[test_1396395.html] +skip-if = + http3 +[test_1421324.html] +[test_1425031.html] +[test_1503201.html] +[test_origin_header.html] +skip-if = + http3 +[test_1502055.html] +support-files = sw_1502055.js file_1502055.sjs iframe_1502055.html +[test_accept_header.html] +support-files = test_accept_header.sjs +[test_different_domain_in_hierarchy.html] +skip-if = + http3 +[test_differentdomain.html] +skip-if = + http3 +[test_fetch_lnk.html] +[test_image.html] +skip-if = + http3 +[test_loadflags.html] +# Bug 1617611: Fix all the tests broken by "cookies SameSite=lax by default" +skip-if = + xorigin + http3 +[test_same_base_domain.html] +skip-if = + http3 +[test_same_base_domain_2.html] +skip-if = + http3 +[test_same_base_domain_3.html] +skip-if = + http3 +[test_same_base_domain_4.html] +skip-if = + http3 +[test_same_base_domain_5.html] +skip-if = + http3 +[test_same_base_domain_6.html] +skip-if = + http3 +[test_samedomain.html] +skip-if = + http3 diff --git a/netwerk/test/mochitests/origin_header.sjs b/netwerk/test/mochitests/origin_header.sjs new file mode 100644 index 0000000000..72cc4b2ae6 --- /dev/null +++ b/netwerk/test/mochitests/origin_header.sjs @@ -0,0 +1,10 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +function handleRequest(request, response) { + response.setHeader("Content-Type", "text/plain", false); + response.setHeader("Cache-Control", "no-cache", false); + + var origin = request.hasHeader("Origin") ? request.getHeader("Origin") : ""; + response.write("Origin: " + origin); +} diff --git a/netwerk/test/mochitests/origin_header_form_post.html b/netwerk/test/mochitests/origin_header_form_post.html new file mode 100644 index 0000000000..01c2df5ef2 --- /dev/null +++ b/netwerk/test/mochitests/origin_header_form_post.html @@ -0,0 +1,19 @@ + + + + + + + +
+ +
+ + diff --git a/netwerk/test/mochitests/origin_header_form_post_xorigin.html b/netwerk/test/mochitests/origin_header_form_post_xorigin.html new file mode 100644 index 0000000000..52e173747b --- /dev/null +++ b/netwerk/test/mochitests/origin_header_form_post_xorigin.html @@ -0,0 +1,19 @@ + + + + + + + +
+ +
+ + diff --git a/netwerk/test/mochitests/partial_content.sjs b/netwerk/test/mochitests/partial_content.sjs new file mode 100644 index 0000000000..67bfff377a --- /dev/null +++ b/netwerk/test/mochitests/partial_content.sjs @@ -0,0 +1,193 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* Debug and Error wrapper functions for dump(). + */ +function ERR(response, responseCode, responseCodeStr, msg) { + // Reset state var. + setState("expectedRequestType", ""); + // Dump to console log and send to client in response. + dump("SERVER ERROR: " + msg + "\n"); + response.write("HTTP/1.1 " + responseCode + " " + responseCodeStr + "\r\n"); + response.write("Content-Type: text/html; charset=UTF-8\r\n"); + response.write("Content-Length: " + msg.length + "\r\n"); + response.write("\r\n"); + response.write(msg); +} + +function DBG(msg) { + // Dump to console only. + dump("SERVER DEBUG: " + msg + "\n"); +} + +/* Delivers content in parts to test partially cached content: requires two + * requests for the same resource. + * + * First call will respond with partial content, but a 200 header and + * Content-Length equal to the full content length. No Range or If-Range + * headers are allowed in the request. + * + * Second call will require Range and If-Range in the request headers, and + * will respond with the range requested. + */ +function handleRequest(request, response) { + DBG("Trying to seize power"); + response.seizePower(); + + DBG("About to check state vars"); + // Get state var to determine if this is the first or second request. + var expectedRequestType; + var lastModified; + if (getState("expectedRequestType") === "") { + DBG("First call: Should be requesting full content."); + expectedRequestType = "fullRequest"; + // Set state var for second request. + setState("expectedRequestType", "partialRequest"); + // Create lastModified variable for responses. + lastModified = new Date().toUTCString(); + setState("lastModified", lastModified); + } else if (getState("expectedRequestType") === "partialRequest") { + DBG("Second call: Should be requesting undelivered content."); + expectedRequestType = "partialRequest"; + // Reset state var for first request. + setState("expectedRequestType", ""); + // Get last modified date and reset state var. + lastModified = getState("lastModified"); + } else { + ERR( + response, + 500, + "Internal Server Error", + 'Invalid expectedRequestType "' + + expectedRequestType + + '"in ' + + "server state db." + ); + return; + } + + // Look for Range and If-Range + var range = request.hasHeader("Range") ? request.getHeader("Range") : ""; + var ifRange = request.hasHeader("If-Range") + ? request.getHeader("If-Range") + : ""; + + if (expectedRequestType === "fullRequest") { + // Should not have Range or If-Range in first request. + if (range && range.length) { + ERR( + response, + 400, + "Bad Request", + 'Should not receive "Range: ' + range + '" for first, full request.' + ); + return; + } + if (ifRange && ifRange.length) { + ERR( + response, + 400, + "Bad Request", + 'Should not receive "Range: ' + range + '" for first, full request.' + ); + return; + } + } else if (expectedRequestType === "partialRequest") { + // Range AND If-Range should both be present in second request. + if (!range) { + ERR( + response, + 400, + "Bad Request", + 'Should receive "Range: " for second, partial request.' + ); + return; + } + if (!ifRange) { + ERR( + response, + 400, + "Bad Request", + 'Should receive "If-Range: " for second, partial request.' + ); + return; + } + } else { + // Somewhat redundant, but a check for errors in this test code. + ERR( + response, + 500, + "Internal Server Error", + 'expectedRequestType not set correctly: "' + expectedRequestType + '"' + ); + return; + } + + // Prepare content in two parts for responses. + var partialContent = + '

First response

'; + var remainderContent = + '

Second response

'; + var totalLength = partialContent.length + remainderContent.length; + + DBG("totalLength: " + totalLength); + + // Prepare common headers for the two responses. + let date = new Date(); + DBG("Date: " + date.toUTCString() + ", Last-Modified: " + lastModified); + var commonHeaders = + "Date: " + + date.toUTCString() + + "\r\n" + + "Last-Modified: " + + lastModified + + "\r\n" + + "Content-Type: text/html; charset=UTF-8\r\n" + + "ETag: abcd0123\r\n" + + "Accept-Ranges: bytes\r\n"; + + // Prepare specific headers and content for first and second responses. + if (expectedRequestType === "fullRequest") { + DBG("First response: Sending partial content with a full header"); + response.write("HTTP/1.1 200 OK\r\n"); + response.write(commonHeaders); + // Set Content-Length to full length of resource. + response.write("Content-Length: " + totalLength + "\r\n"); + response.write("\r\n"); + response.write(partialContent); + } else if (expectedRequestType === "partialRequest") { + DBG("Second response: Sending remaining content with a range header"); + response.write("HTTP/1.1 206 Partial Content\r\n"); + response.write(commonHeaders); + // Set Content-Length to length of bytes transmitted. + response.write("Content-Length: " + remainderContent.length + "\r\n"); + response.write( + "Content-Range: bytes " + + partialContent.length + + "-" + + (totalLength - 1) + + "/" + + totalLength + + "\r\n" + ); + response.write("\r\n"); + response.write(remainderContent); + } else { + // Somewhat redundant, but a check for errors in this test code. + ERR( + response, + 500, + "Internal Server Error", + "Something very bad happened here: expectedRequestType is invalid " + + 'towards the end of handleRequest! - "' + + expectedRequestType + + '"' + ); + return; + } + + response.finish(); +} diff --git a/netwerk/test/mochitests/redirect.sjs b/netwerk/test/mochitests/redirect.sjs new file mode 100644 index 0000000000..73efea59cf --- /dev/null +++ b/netwerk/test/mochitests/redirect.sjs @@ -0,0 +1,4 @@ +function handleRequest(request, response) { + response.setStatusLine(request.httpVersion, 301, "Moved Permanently"); + response.setHeader("Location", "empty.html#"); +} diff --git a/netwerk/test/mochitests/redirect_idn.html b/netwerk/test/mochitests/redirect_idn.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/netwerk/test/mochitests/redirect_idn.html^headers^ b/netwerk/test/mochitests/redirect_idn.html^headers^ new file mode 100644 index 0000000000..753f65db87 --- /dev/null +++ b/netwerk/test/mochitests/redirect_idn.html^headers^ @@ -0,0 +1,3 @@ +HTTP 301 Moved Permanently +Location: http://exämple.test/tests/netwerk/test/mochitests/empty.html +X-Comment: Bug 1142083 - This is a redirect to http://exämple.test diff --git a/netwerk/test/mochitests/redirect_to.sjs b/netwerk/test/mochitests/redirect_to.sjs new file mode 100644 index 0000000000..f090c70849 --- /dev/null +++ b/netwerk/test/mochitests/redirect_to.sjs @@ -0,0 +1,4 @@ +function handleRequest(request, response) { + response.setStatusLine(request.httpVersion, 308, "Permanent Redirect"); + response.setHeader("Location", request.queryString); +} diff --git a/netwerk/test/mochitests/rel_preconnect.sjs b/netwerk/test/mochitests/rel_preconnect.sjs new file mode 100644 index 0000000000..5423c877f0 --- /dev/null +++ b/netwerk/test/mochitests/rel_preconnect.sjs @@ -0,0 +1,17 @@ +// Generate response header "Link: ; rel=preconnect" +// HREF is provided by the request header X-Link + +function handleRequest(request, response) { + response.setHeader("Cache-Control", "no-cache", false); + response.setHeader( + "Link", + "<" + + request.queryString + + ">; rel=preconnect" + + ", " + + "<" + + request.queryString + + ">; rel=preconnect; crossOrigin=anonymous" + ); + response.write("check that header"); +} diff --git a/netwerk/test/mochitests/reset_cookie_xhr.sjs b/netwerk/test/mochitests/reset_cookie_xhr.sjs new file mode 100644 index 0000000000..3620958d29 --- /dev/null +++ b/netwerk/test/mochitests/reset_cookie_xhr.sjs @@ -0,0 +1,15 @@ +function handleRequest(request, response) { + var queryString = request.queryString; + switch (queryString) { + case "set_cookie": + response.setHeader("Set-Cookie", "testXHR1=xhr_val1; path=/", false); + break; + case "modify_cookie": + response.setHeader( + "Set-Cookie", + "testXHR1=xhr_val2; path=/; HttpOnly", + false + ); + break; + } +} diff --git a/netwerk/test/mochitests/set_cookie_xhr.sjs b/netwerk/test/mochitests/set_cookie_xhr.sjs new file mode 100644 index 0000000000..19855bfec9 --- /dev/null +++ b/netwerk/test/mochitests/set_cookie_xhr.sjs @@ -0,0 +1,15 @@ +function handleRequest(request, response) { + var queryString = request.queryString; + switch (queryString) { + case "xhr1": + response.setHeader("Set-Cookie", "xhr1=xhr_val1; path=/", false); + break; + case "xhr2": + response.setHeader( + "Set-Cookie", + "xhr2=xhr_val2; path=/; HttpOnly", + false + ); + break; + } +} diff --git a/netwerk/test/mochitests/signed_web_packaged_app.sjs b/netwerk/test/mochitests/signed_web_packaged_app.sjs new file mode 100644 index 0000000000..dc386ad6fe --- /dev/null +++ b/netwerk/test/mochitests/signed_web_packaged_app.sjs @@ -0,0 +1,73 @@ +function handleRequest(request, response) { + response.setHeader("Content-Type", "application/package", false); + response.write(signedPackage); +} + +// The package content +// getData formats it as described at http://www.w3.org/TR/web-packaging/#streamable-package-format +var signedPackage = `manifest-signature: MIIF1AYJKoZIhvcNAQcCoIIFxTCCBcECAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHAaCCA54wggOaMIICgqADAgECAgEEMA0GCSqGSIb3DQEBCwUAMHMxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEkMCIGA1UEChMbRXhhbXBsZSBUcnVzdGVkIENvcnBvcmF0aW9uMRkwFwYDVQQDExBUcnVzdGVkIFZhbGlkIENBMB4XDTE1MTExOTAzMDEwNVoXDTM1MTExOTAzMDEwNVowdDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MSQwIgYDVQQKExtFeGFtcGxlIFRydXN0ZWQgQ29ycG9yYXRpb24xGjAYBgNVBAMTEVRydXN0ZWQgQ29ycCBDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzPback9X7RRxKTc3/5o2vm9Ro6XNiSM9NPsN3djjCIVz50bY0rJkP98zsqpFjnLwqHeJigxyYoqFexRhRLgKrG10CxNl4rxP6CEPENjvj5FfbX/HUZpT/DelNR18F498yD95vSHcSrCc3JrjV3bKA+wgt11E4a0Ba95S1RuwtehZw1+Y4hO8nHpbSGfjD0BpluFY2nDoYAm+aWSrsmLuJsKLO8Xn2I1brZFJUynR3q1ujuDE9EJk1niDLfOeVgXM4AavJS5C0ZBHhAhR2W+K9NN97jpkpmHFqecTwDXB7rEhsyB3185cI7anaaQfHHfH5+4SD+cMDNtYIOSgLO06ZwIDAQABozgwNjAMBgNVHRMBAf8EAjAAMBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMDMA4GA1UdDwEB/wQEAwIHgDANBgkqhkiG9w0BAQsFAAOCAQEAlnVyLz5dPhS0ZhZD6qJOUzSo6nFwMxNX1m0oS37mevtuh0b0o1gmEuMw3mVxiAVkC2vPsoxBL2wLlAkcEdBPxGEqhBmtiBY3F3DgvEkf+/sOY1rnr6O1qLZuBAnPzA1Vnco8Jwf0DYF0PxaRd8yT5XSl5qGpM2DItEldZwuKKaL94UEgIeC2c+Uv/IOyrv+EyftX96vcmRwr8ghPFLQ+36H5nuAKEpDD170EvfWl1zs0dUPiqSI6l+hy5V14gl63Woi34L727+FKx8oatbyZtdvbeeOmenfTLifLomnZdx+3WMLkp3TLlHa5xDLwifvZtBP2d3c6zHp7gdrGU1u2WTGCAf4wggH6AgEBMHgwczELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MSQwIgYDVQQKExtFeGFtcGxlIFRydXN0ZWQgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFRydXN0ZWQgVmFsaWQgQ0ECAQQwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTE1MTEyNTAzMDQzMFowIwYJKoZIhvcNAQkEMRYEFD4ut4oKoYdcGzyfQE6ROeazv+uNMA0GCSqGSIb3DQEBAQUABIIBAFG99dKBSOzQmYVn6lHKWERVDtYXbDTIVF957ID8YH9B5unlX/PdludTNbP5dzn8GWQV08tNRgoXQ5sgxjifHunrpaR1WiR6XqvwOCBeA5NB688jxGNxth6zg6fCGFaynsYMX3FlglfIW+AYwyQUclbv+C4UORJpBjvuknOnK+UDBLVSoP9ivL6KhylYna3oFcs0SMsumc/jf/oQW51LzFHpn61TRUqdDgvGhwcjgphMhKj23KwkjwRspU2oIWNRAuhZgqDD5BJlNniCr9X5Hx1dW6tIVISO91CLAryYkGZKRJYekXctCpIvldUkIDeh2tAw5owr0jtsVd6ovFF3bV4=\r +--NKWXJUAFXB\r +Content-Location: manifest.webapp\r +Content-Type: application/x-web-app-manifest+json\r +\r +{ + "moz-package-origin": "http://mochi.test:8888", + "name": "My App", + "moz-resources": [ + { + "src": "page2.html", + "integrity": "JREF3JbXGvZ+I1KHtoz3f46ZkeIPrvXtG4VyFQrJ7II=" + }, + { + "src": "index.html", + "integrity": "Jkvco7U8WOY9s0YREsPouX+DWK7FWlgZwA0iYYSrb7Q=" + }, + { + "src": "scripts/script.js", + "integrity": "6TqtNArQKrrsXEQWu3D9ZD8xvDRIkhyV6zVdTcmsT5Q=" + }, + { + "src": "scripts/library.js", + "integrity": "TN2ByXZiaBiBCvS4MeZ02UyNi44vED+KjdjLInUl4o8=" + } + ], + "moz-permissions": [ + { + "systemXHR": { + "description": "Needed to download stuff" + } + } + ], + "package-identifier": "09bc9714-7ab6-4320-9d20-fde4c237522c", + "description": "A great app!" +}\r +--NKWXJUAFXB\r +Content-Location: page2.html\r +Content-Type: text/html\r +\r + + page2.html + +\r +--NKWXJUAFXB\r +Content-Location: index.html\r +Content-Type: text/html\r +\r + + Last updated: 2015/10/28 + + +\r +--NKWXJUAFXB\r +Content-Location: scripts/script.js\r +Content-Type: text/javascript\r +\r +// script.js +\r +--NKWXJUAFXB\r +Content-Location: scripts/library.js\r +Content-Type: text/javascript\r +\r +// library.js +\r +--NKWXJUAFXB--`; diff --git a/netwerk/test/mochitests/subResources.sjs b/netwerk/test/mochitests/subResources.sjs new file mode 100644 index 0000000000..ec2cfaa750 --- /dev/null +++ b/netwerk/test/mochitests/subResources.sjs @@ -0,0 +1,78 @@ +const kTwoDays = 2 * 24 * 60 * 60; +const kInTwoDays = new Date().getTime() + kTwoDays * 1000; + +function getDateInTwoDays() { + let date2 = new Date(kInTwoDays); + let days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; + let months = [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec", + ]; + let day = date2.getUTCDate(); + if (day < 10) { + day = "0" + day; + } + let month = months[date2.getUTCMonth()]; + let year = date2.getUTCFullYear(); + let hour = date2.getUTCHours(); + if (hour < 10) { + hour = "0" + hour; + } + let minute = date2.getUTCMinutes(); + if (minute < 10) { + minute = "0" + minute; + } + let second = date2.getUTCSeconds(); + if (second < 10) { + second = "0" + second; + } + return ( + days[date2.getUTCDay()] + + ", " + + day + + "-" + + month + + "-" + + year + + " " + + hour + + ":" + + minute + + ":" + + second + + " GMT" + ); +} + +function handleRequest(aRequest, aResponse) { + aResponse.setStatusLine(aRequest.httpVersion, 200); + + let suffix = " path=/; domain:.mochi.test"; + + if (aRequest.queryString.includes("3")) { + aResponse.setHeader( + "Set-Cookie", + "test3=value3; expires=Fri, 02-Jan-2037 00:00:01 GMT;" + suffix + ); + } else if (aRequest.queryString.includes("4")) { + let date2 = getDateInTwoDays(); + + aResponse.setHeader( + "Set-Cookie", + "test4=value4; expires=" + date2 + ";" + suffix + ); + } + + aResponse.setHeader("Content-Type", "text/javascript", false); + aResponse.write("42;"); +} diff --git a/netwerk/test/mochitests/sw_1502055.js b/netwerk/test/mochitests/sw_1502055.js new file mode 100644 index 0000000000..40a8c178f1 --- /dev/null +++ b/netwerk/test/mochitests/sw_1502055.js @@ -0,0 +1 @@ +/* empty */ diff --git a/netwerk/test/mochitests/test1.css b/netwerk/test/mochitests/test1.css new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/netwerk/test/mochitests/test1.css @@ -0,0 +1,2 @@ + + diff --git a/netwerk/test/mochitests/test1.css^headers^ b/netwerk/test/mochitests/test1.css^headers^ new file mode 100644 index 0000000000..729babb5a4 --- /dev/null +++ b/netwerk/test/mochitests/test1.css^headers^ @@ -0,0 +1,3 @@ +Cache-Control: no-cache +Set-Cookie: css=bar + diff --git a/netwerk/test/mochitests/test2.css b/netwerk/test/mochitests/test2.css new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/netwerk/test/mochitests/test2.css @@ -0,0 +1,2 @@ + + diff --git a/netwerk/test/mochitests/test2.css^headers^ b/netwerk/test/mochitests/test2.css^headers^ new file mode 100644 index 0000000000..b12d32c72b --- /dev/null +++ b/netwerk/test/mochitests/test2.css^headers^ @@ -0,0 +1,3 @@ +Cache-Control: no-cache +Set-Cookie: css2=bar2 + diff --git a/netwerk/test/mochitests/test_1331680.html b/netwerk/test/mochitests/test_1331680.html new file mode 100644 index 0000000000..30d74de0af --- /dev/null +++ b/netwerk/test/mochitests/test_1331680.html @@ -0,0 +1,87 @@ + + + + + Cookies set in content processes update immediately. + + + + +Mozilla Bug 1331680 +

+ +
+
+ + diff --git a/netwerk/test/mochitests/test_1331680_iframe.html b/netwerk/test/mochitests/test_1331680_iframe.html new file mode 100644 index 0000000000..85842332b1 --- /dev/null +++ b/netwerk/test/mochitests/test_1331680_iframe.html @@ -0,0 +1,68 @@ + + + + + Cookies set from iframe in content process + + + + +Mozilla Bug 1331680 +

+ +
+
+ + diff --git a/netwerk/test/mochitests/test_1331680_xhr.html b/netwerk/test/mochitests/test_1331680_xhr.html new file mode 100644 index 0000000000..0649d33ff4 --- /dev/null +++ b/netwerk/test/mochitests/test_1331680_xhr.html @@ -0,0 +1,90 @@ + + + + + Cookie changes from XHR requests are observed in content processes. + + + + + + +

+ +
+
+ + diff --git a/netwerk/test/mochitests/test_1396395.html b/netwerk/test/mochitests/test_1396395.html new file mode 100644 index 0000000000..dcfb952b3a --- /dev/null +++ b/netwerk/test/mochitests/test_1396395.html @@ -0,0 +1,48 @@ + + + + + + + + + + + + diff --git a/netwerk/test/mochitests/test_1421324.html b/netwerk/test/mochitests/test_1421324.html new file mode 100644 index 0000000000..627a339e0a --- /dev/null +++ b/netwerk/test/mochitests/test_1421324.html @@ -0,0 +1,88 @@ + + + + + Cookie changes from XHR requests are observed in content processes. + + + + + + +

+ +
+
+ + diff --git a/netwerk/test/mochitests/test_1425031.html b/netwerk/test/mochitests/test_1425031.html new file mode 100644 index 0000000000..25fbfc827c --- /dev/null +++ b/netwerk/test/mochitests/test_1425031.html @@ -0,0 +1,73 @@ + + + + + Cookies set in content processes update immediately. + + + + +Mozilla Bug 1425031 +

+ +
+
+ + diff --git a/netwerk/test/mochitests/test_1502055.html b/netwerk/test/mochitests/test_1502055.html new file mode 100644 index 0000000000..472ee204e6 --- /dev/null +++ b/netwerk/test/mochitests/test_1502055.html @@ -0,0 +1,49 @@ + + + + Clear-Site-Data + 304 header. + + + + + + + + diff --git a/netwerk/test/mochitests/test_1503201.html b/netwerk/test/mochitests/test_1503201.html new file mode 100644 index 0000000000..2e724f33ce --- /dev/null +++ b/netwerk/test/mochitests/test_1503201.html @@ -0,0 +1,28 @@ + + + + + A WWW-Authenticate response header with an invalid realm doesn't crash the browser + + + + +Mozilla Bug 1503201 +

+ +
+
+ + diff --git a/netwerk/test/mochitests/test_accept_header.html b/netwerk/test/mochitests/test_accept_header.html new file mode 100644 index 0000000000..0acae2a825 --- /dev/null +++ b/netwerk/test/mochitests/test_accept_header.html @@ -0,0 +1,87 @@ + + + + Accept header + + + + + + + diff --git a/netwerk/test/mochitests/test_accept_header.sjs b/netwerk/test/mochitests/test_accept_header.sjs new file mode 100644 index 0000000000..6e73acd293 --- /dev/null +++ b/netwerk/test/mochitests/test_accept_header.sjs @@ -0,0 +1,62 @@ +function handleRequest(request, response) { + response.setStatusLine(request.httpVersion, "200", "OK"); + dump(`test_accept_header ${request.path}?${request.queryString}\n`); + + if (request.queryString == "worker") { + response.setHeader("Content-Type", "text/javascript", false); + response.write("postMessage(42)"); + + setState( + "data", + JSON.stringify({ type: "worker", accept: request.getHeader("Accept") }) + ); + return; + } + + if (request.queryString == "image") { + // A 1x1 PNG image. + // Source: https://commons.wikimedia.org/wiki/File:1x1.png (Public Domain) + const IMAGE = atob( + "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAA" + + "ACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=" + ); + + response.setHeader("Content-Type", "image/png", false); + response.write(IMAGE); + + setState( + "data", + JSON.stringify({ type: "image", accept: request.getHeader("Accept") }) + ); + return; + } + + if (request.queryString == "style") { + response.setHeader("Content-Type", "text/css", false); + response.write(""); + + setState( + "data", + JSON.stringify({ type: "style", accept: request.getHeader("Accept") }) + ); + return; + } + + if (request.queryString == "iframe") { + response.setHeader("Content-Type", "text/html", false); + response.write("

Hello world!

"); + + setState( + "data", + JSON.stringify({ type: "iframe", accept: request.getHeader("Accept") }) + ); + return; + } + + if (request.queryString == "get") { + response.setHeader("Content-Type", "application/json", false); + response.write(getState("data")); + + setState("data", ""); + } +} diff --git a/netwerk/test/mochitests/test_arraybufferinputstream.html b/netwerk/test/mochitests/test_arraybufferinputstream.html new file mode 100644 index 0000000000..5e3c5faa3e --- /dev/null +++ b/netwerk/test/mochitests/test_arraybufferinputstream.html @@ -0,0 +1,89 @@ + + + + + ArrayBuffer stream test + + + + + + +

+ +
+
+ + diff --git a/netwerk/test/mochitests/test_arraybufferinputstream_large.html b/netwerk/test/mochitests/test_arraybufferinputstream_large.html new file mode 100644 index 0000000000..33922d6e37 --- /dev/null +++ b/netwerk/test/mochitests/test_arraybufferinputstream_large.html @@ -0,0 +1,45 @@ + + + + + ArrayBuffer stream with large ArrayBuffer test + + + + + + + + + diff --git a/netwerk/test/mochitests/test_different_domain_in_hierarchy.html b/netwerk/test/mochitests/test_different_domain_in_hierarchy.html new file mode 100644 index 0000000000..0ec6d35d4d --- /dev/null +++ b/netwerk/test/mochitests/test_different_domain_in_hierarchy.html @@ -0,0 +1,15 @@ + + + + Test cookie requests from within a window hierarchy of different base domains + + + + +

+
+
+
+ + diff --git a/netwerk/test/mochitests/test_differentdomain.html b/netwerk/test/mochitests/test_differentdomain.html new file mode 100644 index 0000000000..75cc903758 --- /dev/null +++ b/netwerk/test/mochitests/test_differentdomain.html @@ -0,0 +1,15 @@ + + + + Test for Cross domain access to properties + + + + +

+
+
+
+ + diff --git a/netwerk/test/mochitests/test_documentcookies_maxage.html b/netwerk/test/mochitests/test_documentcookies_maxage.html new file mode 100644 index 0000000000..eb130b2fed --- /dev/null +++ b/netwerk/test/mochitests/test_documentcookies_maxage.html @@ -0,0 +1,149 @@ + + + + + Test for document.cookie max-age pref + + + + + + +

+ +
+
+ + diff --git a/netwerk/test/mochitests/test_fetch_lnk.html b/netwerk/test/mochitests/test_fetch_lnk.html new file mode 100644 index 0000000000..e1154a5951 --- /dev/null +++ b/netwerk/test/mochitests/test_fetch_lnk.html @@ -0,0 +1,17 @@ + + +Downloading .lnk through HTTP should always download the file without parsing it + + + diff --git a/netwerk/test/mochitests/test_idn_redirect.html b/netwerk/test/mochitests/test_idn_redirect.html new file mode 100644 index 0000000000..cc920665b3 --- /dev/null +++ b/netwerk/test/mochitests/test_idn_redirect.html @@ -0,0 +1,35 @@ + + + + + Test for URI Manipulation + + + + + +
+
+
+
+
diff --git a/netwerk/test/mochitests/test_image.html b/netwerk/test/mochitests/test_image.html
new file mode 100644
index 0000000000..db75cdbca5
--- /dev/null
+++ b/netwerk/test/mochitests/test_image.html
@@ -0,0 +1,14 @@
+
+
+
+  Test for Cross domain access to properties
+  
+  
+
+
+

+
+
+
+ + diff --git a/netwerk/test/mochitests/test_loadflags.html b/netwerk/test/mochitests/test_loadflags.html new file mode 100644 index 0000000000..fba93102ea --- /dev/null +++ b/netwerk/test/mochitests/test_loadflags.html @@ -0,0 +1,21 @@ + + + + Test for Cross domain access to properties + + + + + + +

+
+
+
+ + diff --git a/netwerk/test/mochitests/test_loadinfo_redirectchain.html b/netwerk/test/mochitests/test_loadinfo_redirectchain.html new file mode 100644 index 0000000000..a657ce678c --- /dev/null +++ b/netwerk/test/mochitests/test_loadinfo_redirectchain.html @@ -0,0 +1,269 @@ + + + + Bug 1194052 - Append Principal to RedirectChain within LoadInfo before the channel is succesfully openend + + + + + + + + + + diff --git a/netwerk/test/mochitests/test_origin_header.html b/netwerk/test/mochitests/test_origin_header.html new file mode 100644 index 0000000000..f90887ddf0 --- /dev/null +++ b/netwerk/test/mochitests/test_origin_header.html @@ -0,0 +1,398 @@ + + + + + Bug 446344 - Test Origin Header + + + + + +

Mozilla Bug 446344

+ +

+
+
+
+ + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
Non-sandboxed iframe
+
+ +
Non-sandboxed cross-origin iframe
+
+ +
Sandboxed iframe
+
+ +
Srcdoc iframe
+
+ +
Srcdoc cross-origin iframe
+
+ +
data: URI iframe
+
+ + + diff --git a/netwerk/test/mochitests/test_partially_cached_content.html b/netwerk/test/mochitests/test_partially_cached_content.html new file mode 100644 index 0000000000..8b6df555f8 --- /dev/null +++ b/netwerk/test/mochitests/test_partially_cached_content.html @@ -0,0 +1,95 @@ + + + + + + Test for Bug 497003: support sending OnDataAvailable() to other threads + + + + +

Mozilla Bug 497003: support sending OnDataAvailable() to other threads

+

+ +
+
+
+ + diff --git a/netwerk/test/mochitests/test_redirect_ref.html b/netwerk/test/mochitests/test_redirect_ref.html new file mode 100644 index 0000000000..0b234695d4 --- /dev/null +++ b/netwerk/test/mochitests/test_redirect_ref.html @@ -0,0 +1,29 @@ + + + + Bug 1234575 - Test redirect ref + + + + + +
+
+
+
+
diff --git a/netwerk/test/mochitests/test_rel_preconnect.html b/netwerk/test/mochitests/test_rel_preconnect.html
new file mode 100644
index 0000000000..c7e0bada07
--- /dev/null
+++ b/netwerk/test/mochitests/test_rel_preconnect.html
@@ -0,0 +1,61 @@
+
+
+
+
+  Test for link rel=preconnect
+  
+  
+
+
+
+
+

+ +
+
+ + diff --git a/netwerk/test/mochitests/test_same_base_domain.html b/netwerk/test/mochitests/test_same_base_domain.html new file mode 100644 index 0000000000..bcf069e8be --- /dev/null +++ b/netwerk/test/mochitests/test_same_base_domain.html @@ -0,0 +1,15 @@ + + + + Test for Cross domain access to properties + + + + +

+
+
+
+ + diff --git a/netwerk/test/mochitests/test_same_base_domain_2.html b/netwerk/test/mochitests/test_same_base_domain_2.html new file mode 100644 index 0000000000..5647831c29 --- /dev/null +++ b/netwerk/test/mochitests/test_same_base_domain_2.html @@ -0,0 +1,15 @@ + + + + Test for Cross domain access to properties + + + + +

+
+
+
+ + diff --git a/netwerk/test/mochitests/test_same_base_domain_3.html b/netwerk/test/mochitests/test_same_base_domain_3.html new file mode 100644 index 0000000000..62a4cfba95 --- /dev/null +++ b/netwerk/test/mochitests/test_same_base_domain_3.html @@ -0,0 +1,15 @@ + + + + Test for Cross domain access to properties + + + + +

+
+
+
+ + diff --git a/netwerk/test/mochitests/test_same_base_domain_4.html b/netwerk/test/mochitests/test_same_base_domain_4.html new file mode 100644 index 0000000000..87fbb1c720 --- /dev/null +++ b/netwerk/test/mochitests/test_same_base_domain_4.html @@ -0,0 +1,15 @@ + + + + Test for Cross domain access to properties + + + + +

+
+
+
+ + diff --git a/netwerk/test/mochitests/test_same_base_domain_5.html b/netwerk/test/mochitests/test_same_base_domain_5.html new file mode 100644 index 0000000000..7e4d2e3b1f --- /dev/null +++ b/netwerk/test/mochitests/test_same_base_domain_5.html @@ -0,0 +1,15 @@ + + + + Test for Cross domain access to properties + + + + +

+
+
+
+ + diff --git a/netwerk/test/mochitests/test_same_base_domain_6.html b/netwerk/test/mochitests/test_same_base_domain_6.html new file mode 100644 index 0000000000..195c38657b --- /dev/null +++ b/netwerk/test/mochitests/test_same_base_domain_6.html @@ -0,0 +1,26 @@ + + + + Test for Cross domain access to properties + + + + +

+
+  
+
+
+ + diff --git a/netwerk/test/mochitests/test_samedomain.html b/netwerk/test/mochitests/test_samedomain.html new file mode 100644 index 0000000000..82aace8bab --- /dev/null +++ b/netwerk/test/mochitests/test_samedomain.html @@ -0,0 +1,15 @@ + + + + Test for Cross domain access to properties + + + + +

+
+
+
+ + diff --git a/netwerk/test/mochitests/test_uri_scheme.html b/netwerk/test/mochitests/test_uri_scheme.html new file mode 100644 index 0000000000..b0c247f336 --- /dev/null +++ b/netwerk/test/mochitests/test_uri_scheme.html @@ -0,0 +1,50 @@ + + + + + Test for URI Manipulation + + + + + + +

+ +
+
+ + diff --git a/netwerk/test/mochitests/test_viewsource_unlinkable.html b/netwerk/test/mochitests/test_viewsource_unlinkable.html new file mode 100644 index 0000000000..f4c4064183 --- /dev/null +++ b/netwerk/test/mochitests/test_viewsource_unlinkable.html @@ -0,0 +1,25 @@ + + + + + Test for view-source linkability + + + + + + +

+ +
+
+ + diff --git a/netwerk/test/mochitests/test_xhr_method_case.html b/netwerk/test/mochitests/test_xhr_method_case.html new file mode 100644 index 0000000000..ddb830328c --- /dev/null +++ b/netwerk/test/mochitests/test_xhr_method_case.html @@ -0,0 +1,65 @@ + + + + + Test for XHR Method casing + + + + + + +

+ +
+
+ + diff --git a/netwerk/test/mochitests/web_packaged_app.sjs b/netwerk/test/mochitests/web_packaged_app.sjs new file mode 100644 index 0000000000..772b8a0835 --- /dev/null +++ b/netwerk/test/mochitests/web_packaged_app.sjs @@ -0,0 +1,47 @@ +function handleRequest(request, response) { + response.setHeader("Content-Type", "application/package", false); + response.write(octetStreamData.getData()); +} + +// The package content +// getData formats it as described at http://www.w3.org/TR/web-packaging/#streamable-package-format +var octetStreamData = { + content: [ + { + headers: ["Content-Location: /index.html", "Content-Type: text/html"], + data: "\r\n \r\n \r\n\r\n Web Packaged App Index\r\n\r\n", + type: "text/html", + }, + { + headers: [ + "Content-Location: /scripts/app.js", + "Content-Type: text/javascript", + ], + data: "module Math from '/scripts/helpers/math.js';\r\n...\r\n", + type: "text/javascript", + }, + { + headers: [ + "Content-Location: /scripts/helpers/math.js", + "Content-Type: text/javascript", + ], + data: "export function sum(nums) { ... }\r\n...\r\n", + type: "text/javascript", + }, + ], + token: "gc0pJq0M:08jU534c0p", + getData() { + var str = ""; + for (var i in this.content) { + str += "--" + this.token + "\r\n"; + for (var j in this.content[i].headers) { + str += this.content[i].headers[j] + "\r\n"; + } + str += "\r\n"; + str += this.content[i].data + "\r\n"; + } + + str += "--" + this.token + "--"; + return str; + }, +}; -- cgit v1.2.3