tor-browser

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

NDEFReader-read-document-hidden-manual.https.html (968B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <meta name="timeout" content="long">
      4 <title>NDEFReader.onreading respect page visibility changes</title>
      5 <link rel="help" href="https://w3c.github.io/web-nfc/#visible-document">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <script src="resources/nfc-helpers.js"></script>
      9 <script>
     10 
     11 nfc_test(async (t, mockNFC) => {
     12  const ndef = new NDEFReader();
     13  const ndefWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]);
     14  const promise = new Promise((resolve, reject) => {
     15    ndefWatcher.wait_for("reading").then(event => {
     16      if (document.hidden) reject();
     17      else resolve();
     18    });
     19  });
     20  await ndef.scan();
     21  await promise;
     22 }, "Test NDEFReader.onreading is not fired when document is hidden");
     23 
     24 </script>
     25 
     26 <p>Step1: switch the page to the background, then tap a formatted NFC tag.</p>
     27 <p>Step2: switch back to the page, then tap the tag again.</p>