tor-browser

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

battery-allowed-in-same-origin-iframe.https.html (901B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Battery Test: navigator.getBattery() is allowed in same origin iframe</title>
      4 <link rel="author" title="Intel" href="http://www.intel.com">
      5 <link rel="help" href="https://www.w3.org/TR/battery-status/">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <div id="log"></div>
      9 <iframe id="blank" src="about:blank" style="display: none"></iframe>
     10 <script>
     11 
     12 function load_iframe(iframe, src) {
     13  return new Promise((resolve, reject) => {
     14    iframe.onload = () => resolve(iframe);
     15    iframe.src = src;
     16  });
     17 }
     18 
     19 promise_test(async t => {
     20  let iframe = document.getElementById('blank');
     21  const src = 'resources/support-iframe.html';
     22  iframe = await load_iframe(iframe, src);
     23  await iframe.contentWindow.navigator.getBattery();
     24 }, "navigator.getBattery() is allowed in same origin iframe");
     25 
     26 </script>