tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_103_redirect.js (2168B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 Services.prefs.setBoolPref("network.early-hints.enabled", true);
      8 
      9 const { test_hint_preload, request_count_checking } =
     10  ChromeUtils.importESModule(
     11    "resource://testing-common/early_hint_preload_test_helper.sys.mjs"
     12  );
     13 
     14 // Early hint to redirect to same origin in secure context
     15 add_task(async function test_103_redirect_same_origin() {
     16  await test_hint_preload(
     17    "test_103_redirect_same_origin",
     18    "https://example.com",
     19    "https://example.com/browser/netwerk/test/browser/early_hint_redirect.sjs?https://example.com/browser/netwerk/test/browser/early_hint_pixel.sjs",
     20    { hinted: 2, normal: 0 } // successful preload of redirect and resulting image
     21  );
     22 });
     23 
     24 // Early hint to redirect to cross origin in secure context
     25 add_task(async function test_103_redirect_cross_origin() {
     26  await test_hint_preload(
     27    "test_103_redirect_cross_origin",
     28    "https://example.com",
     29    "https://example.com/browser/netwerk/test/browser/early_hint_redirect.sjs?https://example.net/browser/netwerk/test/browser/early_hint_pixel.sjs",
     30    { hinted: 2, normal: 0 }
     31  );
     32 });
     33 
     34 // Early hint to redirect to cross origin in insecure context
     35 add_task(async function test_103_redirect_insecure_cross_origin() {
     36  await test_hint_preload(
     37    "test_103_redirect_insecure_cross_origin",
     38    "https://example.com",
     39    "https://example.com/browser/netwerk/test/browser/early_hint_redirect.sjs?http://mochi.test:8888/browser/netwerk/test/browser/early_hint_pixel.sjs",
     40    { hinted: 2, normal: 0 }
     41  );
     42 });
     43 
     44 // Cross origin preload from secure context to redirected insecure context on same domain
     45 add_task(async function test_103_preload_redirect_mixed_content() {
     46  await test_hint_preload(
     47    "test_103_preload_redirect_mixed_content",
     48    "https://example.org",
     49    "https://example.org/browser/netwerk/test/browser/early_hint_redirect.sjs?http://example.org/browser/netwerk/test/browser/early_hint_pixel.sjs",
     50    { hinted: 2, normal: 0 }
     51  );
     52 });