tor-browser

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

payment-request.https.html (1047B)


      1 <!DOCTYPE html>
      2 <title>Test Payment Rrequest API</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/resources/testdriver.js"></script>
      6 <script src="/resources/testdriver-vendor.js"></script>
      7 <script src="/common/utils.js"></script>
      8 <script src="/common/dispatcher/dispatcher.js"></script>
      9 <script src="resources/utils.js"></script>
     10 
     11 <body>
     12 <script>
     13 promise_test(async () => {
     14  const frame = attachFencedFrameContext();
     15  const error_name = await frame.execute(() => {
     16    const methods = [{supportedMethods: ['foo']}];
     17    const details = {
     18      total: {
     19        label: 'label',
     20        amount: {
     21          currency: 'USD',
     22          value: '5.00'
     23        }
     24      }
     25    };
     26 
     27    try {
     28      new PaymentRequest(methods, details);
     29    } catch (e) {
     30      return e.name
     31    }
     32  });
     33  assert_equals(error_name, "SecurityError",
     34                "PaymentRequest is not allowed in fenced frames");
     35 }, 'new PaymentRequest should fail inside a fenced frame');
     36 </script>
     37 </body>