tor-browser

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

test_worker_observer.html (1130B)


      1 <!--
      2  Any copyright is dedicated to the Public Domain.
      3  http://creativecommons.org/publicdomain/zero/1.0/
      4 -->
      5 <!DOCTYPE html>
      6 <html>
      7 <head>
      8 <meta charset=utf-8>
      9 <title>Test for performance observer in worker</title>
     10 <script src="/resources/testharness.js"></script>
     11 <script src="/resources/testharnessreport.js"></script>
     12 </head>
     13 <body>
     14 <div id="log"></div>
     15 <script>
     16 const worker = new Worker("worker_performance_observer.js");
     17 
     18 promise_test(t => {
     19  let found = false;
     20  return new Promise(resolve => {
     21    SpecialPowers.registerConsoleListener(msg => {
     22      if (msg.errorMessage === "Ignoring unsupported entryTypes: invalid.") {
     23        found = true;
     24        resolve();
     25      }
     26    });
     27    worker.addEventListener("error", resolve);
     28    worker.addEventListener("message", function(event) {
     29      if (event.data.type === "complete") {
     30        resolve();
     31      }
     32    });
     33  }).then(() => {
     34    SpecialPowers.postConsoleSentinel();
     35    assert_true(found, "got the expected console warning");
     36  });
     37 }, "Console warnings about invalid types should be logged during the tests");
     38 
     39 fetch_tests_from_worker(worker);
     40 </script>
     41 </body>