tor-browser

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

show-picker-child-iframe.html (694B)


      1 <!DOCTYPE html>
      2 <title>Test showPicker() in an iframe</title>
      3 <script type=module>
      4 import inputTypes from "./../input-types.js";
      5 
      6 const urlParams = new URLSearchParams(location.search);
      7 const documentDomain = urlParams.get('documentDomain');
      8 if (documentDomain) {
      9  document.domain = documentDomain;
     10 }
     11 
     12 let securityErrors = [];
     13 for (const inputType of inputTypes) {
     14  const input = document.createElement("input");
     15  input.setAttribute("type", inputType);
     16 
     17  try {
     18    input.showPicker();
     19  } catch (error) {
     20    if (error instanceof DOMException && error.name == 'SecurityError') {
     21      securityErrors.push(inputType);
     22    }
     23  }
     24 }
     25 parent.postMessage(securityErrors.join(','), "*");
     26 </script>