NDEFReader-make-read-only-document-hidden-manual.https.html (844B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <meta name="timeout" content="long"> 4 <title>NDEFReader.makeReadOnly 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> 9 10 promise_test(async t => { 11 const ndef = new NDEFReader(); 12 const p1 = ndef.makeReadOnly(); 13 14 return await new Promise((resolve, reject) => { 15 p1.then(() => { 16 assert_false(document.hidden); 17 resolve(); 18 }).catch(e => { 19 reject(); 20 }); 21 }); 22 }, "Test NDEFReader.makeReadOnly operation should be suspended when document is not visible"); 23 24 </script> 25 26 <p>Step1: switch the page to the background, then tap an NFC tag.</p> 27 <p>Step2: switch back to the page, then tap the tag again.</p>