tor-browser

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

dictionary-decompression.tentative.https.html (2373B)


      1 <!DOCTYPE html>
      2 <head>
      3 <meta charset="utf-8">
      4 <meta name="timeout" content="long"/>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/common/get-host-info.sub.js"></script>
      8 <script src="./resources/compression-dictionary-util.sub.js"></script>
      9 </head>
     10 <body>
     11 <script>
     12 
     13 compression_dictionary_promise_test(async (t) => {
     14  const dict = await (await fetch(kRegisterDictionaryPath)).text();
     15  assert_equals(dict, kDefaultDictionaryContent);
     16  // Wait until `available-dictionary` header is available.
     17  assert_equals(
     18      await waitUntilAvailableDictionaryHeader(t, {}),
     19      kDefaultDictionaryHashBase64);
     20 
     21  // Check if the data compressed using Brotli with the dictionary can be
     22  // decompressed.
     23  const data_url = `${kCompressedDataPath}?content_encoding=dcb`;
     24  assert_equals(await (await fetch(data_url)).text(), kExpectedCompressedData);
     25 }, 'Decompresion using Brotli with the dictionary works as expected');
     26 
     27 compression_dictionary_promise_test(async (t) => {
     28  const dict = await (await fetch(kRegisterDictionaryPath)).text();
     29  assert_equals(dict, kDefaultDictionaryContent);
     30  // Wait until `available-dictionary` header is available.
     31  assert_equals(
     32      await waitUntilAvailableDictionaryHeader(t, {}),
     33      kDefaultDictionaryHashBase64);
     34 
     35  // Check if the data compressed using Zstandard with the dictionary can be
     36  // decompressed.
     37  const data_url = `${kCompressedDataPath}?content_encoding=dcz`;
     38  assert_equals(await (await fetch(data_url)).text(), kExpectedCompressedData);
     39 }, 'Decompresion using Zstandard with the dictionary works as expected');
     40 
     41 compression_dictionary_promise_test(async (t) => {
     42  const dict =
     43      await (await fetch(getRemoteHostUrl(kRegisterDictionaryPath))).text();
     44  assert_equals(dict, kDefaultDictionaryContent);
     45  // Wait until `available-dictionary` header is available.
     46  assert_equals(
     47      await waitUntilAvailableDictionaryHeader(t, {check_remote: true}),
     48      kDefaultDictionaryHashBase64);
     49 
     50  // Check if the data compressed using Brotli with the dictionary can be
     51  // decompressed.
     52  const data_url =
     53      getRemoteHostUrl(`${kCompressedDataPath}?content_encoding=dcb`);
     54  assert_equals(await (await fetch(data_url)).text(), kExpectedCompressedData);
     55 }, 'Decompresion of a cross origin resource works as expected');
     56 
     57 </script>
     58 </body>