tor-browser

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

share-empty.https.html (1934B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <meta charset="utf-8" />
      5    <title>WebShare Test: Share no known fields</title>
      6    <link rel="help" href="https://w3c.github.io/web-share/#share-method">
      7    <script src="/resources/testharness.js"></script>
      8    <script src="/resources/testharnessreport.js"></script>
      9    <script src="/resources/testdriver.js"></script>
     10    <script src="/resources/testdriver-vendor.js"></script>
     11  </head>
     12  <body>
     13    <script>
     14      promise_test(async t => {
     15        await test_driver.bless("web share", () => {
     16          return promise_rejects_js(t, TypeError, navigator.share());
     17        });
     18      }, "share with no arguments (same as empty dictionary)");
     19 
     20      promise_test(async t => {
     21        await test_driver.bless("web share", () => {
     22          return promise_rejects_js(t, TypeError, navigator.share({}));
     23        });
     24      }, "share with an empty dictionary");
     25 
     26      promise_test(async t => {
     27        await test_driver.bless("web share", () => {
     28          return promise_rejects_js(t, TypeError, navigator.share(undefined));
     29        });
     30      }, "share with a undefined argument (same as empty dictionary)");
     31 
     32      promise_test(async t => {
     33        await test_driver.bless("web share", () => {
     34          return promise_rejects_js(t, TypeError, navigator.share(null));
     35        });
     36      }, "share with a null argument (same as empty dictionary)");
     37 
     38      promise_test(async t => {
     39        await test_driver.bless("web share", () => {
     40          return promise_rejects_js(
     41            t,
     42            TypeError,
     43            navigator.share({ unused: "unexpected field" })
     44          );
     45        });
     46      }, "share with a dictionary containing only surplus fields");
     47 
     48      promise_test(async t => {
     49        await test_driver.bless("web share");
     50        await promise_rejects_js(t, TypeError, navigator.share({ files: [] }));
     51      }, "share with an empty files member")
     52    </script>
     53  </body>
     54 </html>