tor-browser

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

otpcredential-iframe.https.html (1925B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="/common/get-host-info.sub.js"></script>
      5 <div id=log>
      6 <script>
      7 'use strict';
      8 
      9 const host = get_host_info();
     10 const remoteBaseURL =
     11    host.HTTPS_REMOTE_ORIGIN +
     12    window.location.pathname.replace(/\/[^\/]*$/, '/');
     13 const localBaseURL =
     14    host.HTTPS_ORIGIN +
     15    window.location.pathname.replace(/\/[^\/]*$/, '/');
     16 
     17 promise_test(async t => {
     18  const messageWatcher = new EventWatcher(t, window, "message");
     19  var iframe = document.createElement("iframe");
     20  iframe.src = localBaseURL + "support/otpcredential-iframe.html";
     21 
     22  document.body.appendChild(iframe);
     23 
     24  const message = await messageWatcher.wait_for("message");
     25  assert_equals(message.data.result, "Pass");
     26  assert_equals(message.data.code, "ABC123");
     27 
     28 }, "Test OTPCredential enabled in same origin iframes");
     29 
     30 promise_test(async t => {
     31  const messageWatcher = new EventWatcher(t, window, "message");
     32  var iframe = document.createElement("iframe");
     33  iframe.src = remoteBaseURL + "support/otpcredential-iframe.html"
     34  iframe.allow = "otp-credentials";
     35  document.body.appendChild(iframe);
     36 
     37  const message = await messageWatcher.wait_for("message");
     38  assert_equals(message.data.result, "Pass");
     39  assert_equals(message.data.code, "ABC123");
     40 
     41 }, "OTPCredential enabled in cross origin iframes with permissions policy");
     42 
     43 promise_test(async t => {
     44  const messageWatcher = new EventWatcher(t, window, "message");
     45  var iframe = document.createElement("iframe");
     46  iframe.src = remoteBaseURL + "support/otpcredential-iframe.html"
     47  document.body.appendChild(iframe);
     48 
     49  const message = await messageWatcher.wait_for("message");
     50  assert_equals(message.data.result, "Fail");
     51  assert_equals(message.data.errorType, "NotAllowedError");
     52 
     53 }, "OTPCredential disabled in cross origin iframes without permissions policy");
     54 </script>