tor-browser

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

show-consume-activation.https.html (1554B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <meta charset="utf-8" />
      5    <title>show() consumes user activation</title>
      6    <link rel="help" href="https://w3c.github.io/payment-request/#show-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      const defaultMethods = [
     15        { supportedMethods: "basic-card" },
     16        {
     17          supportedMethods: "https://apple.com/apple-pay",
     18          data: {
     19            version: 3,
     20            merchantIdentifier: "merchant.com.example",
     21            countryCode: "US",
     22            merchantCapabilities: ["supports3DS"],
     23            supportedNetworks: ["visa"],
     24          },
     25        },
     26      ];
     27 
     28      const defaultDetails = {
     29        total: {
     30          label: "Total",
     31          amount: {
     32            currency: "USD",
     33            value: "1.00",
     34          },
     35        },
     36      };
     37      promise_test(async t => {
     38        const pr = new PaymentRequest(defaultMethods, defaultDetails);
     39 
     40        await test_driver.bless("Calls show() method");
     41        const showPromise = pr.show();
     42 
     43        // The activation has been consumed.
     44        assert_false(navigator.userActivation.isActive);
     45 
     46        // Abort the payment request
     47        pr.abort()
     48        await promise_rejects_dom(t, "AbortError", showPromise);
     49      }, "Calling show consumes user activation, if present");
     50    </script>
     51  </body>
     52 </html>