tor-browser

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

resource-ignore-data-url.html (1618B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta charset="utf-8" />
      5 <title>Resource Timing ignores resources with data: URIs</title>
      6 <link rel="author" title="Google" href="http://www.google.com/" />
      7 <link rel="help" href="https://www.w3.org/TR/resource-timing-2/#resources-included-in-the-performanceresourcetiming-interface"/>
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <script src="resources/resource-loaders.js"></script>
     11 </head>
     12 <body>
     13 <img src="data:image/gif;base64,R0lGODlhAQABAIAAAOTm7AAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="></img>
     14 <script>
     15  promise_test(async t => {
     16    const promise = new Promise(resolve => {
     17      new PerformanceObserver(t.step_func(list => {
     18        const entries = list.getEntries();
     19        const dataEntries = entries.filter(e => e.name.includes('data:'));
     20        assert_equals(dataEntries.length, 0, 'There must be no entry for `data: URL`.');
     21        const blueEntries = entries.filter(e => e.name.includes('blue.png'));
     22        if (blueEntries.length) {
     23          // We can finish the test once we see the entry with blue.png.
     24          resolve();
     25        }
     26      })).observe({entryTypes: ['resource']});
     27    });
     28    // Wait until the document is loaded.
     29    await new Promise(resolve => {
     30      window.addEventListener('load', resolve);
     31    });
     32    // Add the blue.png image after document is loaded to ensure we've received
     33    // all of the previous Resource Timing entries.
     34    load.image('blue.png');
     35    return promise;
     36  }, 'Resources with data: URIs must not be surfaced in Resource Timing');
     37 </script>
     38 </body>
     39 </html>