tor-browser

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

queue-entry-regardless-buffer-size.html (1351B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4 <meta charset="utf-8">
      5 <link rel="help" href="https://w3c.github.io/resource-timing/#dfn-mark-resource-timing">
      6 <title>This test validates that resource timing entires should always be queued regardless the size of the buffer.</title>
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 <script src="resources/resource-loaders.js"></script>
     10 <script src="resources/buffer-full-utilities.js"></script>
     11 </head>
     12 <body>
     13 <script>
     14 promise_test(async t => {
     15    clearBufferAndSetSize(1);
     16    let count = 0;
     17    const allEntriesReceived =  new Promise(resolve => {
     18      new PerformanceObserver(t.step_func((list) => {
     19        for (const entry of list.getEntries()) {
     20          if (entry.name.includes(scriptResources[0])) {
     21            count += 1;
     22          } else if (entry.name.includes(scriptResources[1])) {
     23            count += 1;
     24          }
     25        }
     26        if (count == 2) {
     27          resolve();
     28        }
     29      })).observe({type: 'resource'});
     30    });
     31    load.script(scriptResources[0]);
     32    load.script(scriptResources[1]);
     33 
     34    // Two resource timing entries should be observed regardless the
     35    // fact that we've set the buffer size to 1.
     36    await allEntriesReceived;
     37 }, "Test that buffer size has no impact to whether an entry is queued or not");
     38 </script>