Source code
Revision control
Copy as Markdown
Other Tools
<script>
  'use strict';
  window.onload = function() {
    // When the trust-token-redemption feature policy is enabled, redemption
    // and signing ("send-redemption-record") should both be available; when it's disabled,
    // they should both be unavailable. Send the number of available operations
    // upstream in order to enforce this in assertions.
    let num_enabled = 4;
    try {
        trustToken: {
          type: "token-redemption"
        }
      });
    } catch (e) {
      num_enabled--;
    }
    try {
        trustToken: {
          type: "send-redemption-record",
        }
      });
    } catch (e) {
      num_enabled--;
    }
    try {
      const xhr = new XMLHttpRequest();
      xhr.setTrustToken({
        type: "token-redemption"
      });
    } catch (e) {
      num_enabled--;
    }
    try {
      const xhr = new XMLHttpRequest();
      xhr.setTrustToken({
        type: "send-redemption-record",
      });
    } catch (e) {
      num_enabled--;
    }
    parent.postMessage({
      num_operations_enabled: num_enabled
    }, '*');
  }
</script>