tor-browser

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

browser_103_error.js (3365B)


      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 } = ChromeUtils.importESModule(
     10  "resource://testing-common/early_hint_preload_test_helper.sys.mjs"
     11 );
     12 
     13 // 400 Bad Request
     14 add_task(async function test_103_error_400() {
     15  await test_hint_preload(
     16    "test_103_error_400",
     17    "https://example.com",
     18    "https://example.com/browser/netwerk/test/browser/early_hint_error.sjs?400",
     19    { hinted: 1, normal: 0 }
     20  );
     21 });
     22 
     23 // 401 Unauthorized
     24 add_task(async function test_103_error_401() {
     25  await test_hint_preload(
     26    "test_103_error_401",
     27    "https://example.com",
     28    "https://example.com/browser/netwerk/test/browser/early_hint_error.sjs?401",
     29    { hinted: 1, normal: 0 }
     30  );
     31 });
     32 
     33 // 403 Forbidden
     34 add_task(async function test_103_error_403() {
     35  await test_hint_preload(
     36    "test_103_error_403",
     37    "https://example.com",
     38    "https://example.com/browser/netwerk/test/browser/early_hint_error.sjs?403",
     39    { hinted: 1, normal: 0 }
     40  );
     41 });
     42 
     43 // 404 Not Found
     44 add_task(async function test_103_error_404() {
     45  await test_hint_preload(
     46    "test_103_error_404",
     47    "https://example.com",
     48    "https://example.com/browser/netwerk/test/browser/early_hint_error.sjs?404",
     49    { hinted: 1, normal: 0 }
     50  );
     51 });
     52 
     53 // 408 Request Timeout
     54 add_task(async function test_103_error_408() {
     55  await test_hint_preload(
     56    "test_103_error_408",
     57    "https://example.com",
     58    "https://example.com/browser/netwerk/test/browser/early_hint_error.sjs?408",
     59    { hinted: 1, normal: 0 }
     60  );
     61 });
     62 
     63 // 410 Gone
     64 add_task(async function test_103_error_410() {
     65  await test_hint_preload(
     66    "test_103_error_410",
     67    "https://example.com",
     68    "https://example.com/browser/netwerk/test/browser/early_hint_error.sjs?410",
     69    { hinted: 1, normal: 0 }
     70  );
     71 });
     72 
     73 // 429 Too Many Requests
     74 add_task(async function test_103_error_429() {
     75  await test_hint_preload(
     76    "test_103_error_429",
     77    "https://example.com",
     78    "https://example.com/browser/netwerk/test/browser/early_hint_error.sjs?429",
     79    { hinted: 1, normal: 0 }
     80  );
     81 });
     82 
     83 // 500 Internal Server Error
     84 add_task(async function test_103_error_500() {
     85  await test_hint_preload(
     86    "test_103_error_500",
     87    "https://example.com",
     88    "https://example.com/browser/netwerk/test/browser/early_hint_error.sjs?500",
     89    { hinted: 1, normal: 0 }
     90  );
     91 });
     92 
     93 // 502 Bad Gateway
     94 add_task(async function test_103_error_502() {
     95  await test_hint_preload(
     96    "test_103_error_502",
     97    "https://example.com",
     98    "https://example.com/browser/netwerk/test/browser/early_hint_error.sjs?502",
     99    { hinted: 1, normal: 0 }
    100  );
    101 });
    102 
    103 // 503 Service Unavailable
    104 add_task(async function test_103_error_503() {
    105  await test_hint_preload(
    106    "test_103_error_503",
    107    "https://example.com",
    108    "https://example.com/browser/netwerk/test/browser/early_hint_error.sjs?503",
    109    { hinted: 1, normal: 0 }
    110  );
    111 });
    112 
    113 // 504 Gateway Timeout
    114 add_task(async function test_103_error_504() {
    115  await test_hint_preload(
    116    "test_103_error_504",
    117    "https://example.com",
    118    "https://example.com/browser/netwerk/test/browser/early_hint_error.sjs?504",
    119    { hinted: 1, normal: 0 }
    120  );
    121 });