tor-browser

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

javascript-url-load-as-html.xhtml (1286B)


      1 <?xml version="1.0" encoding="windows-1250"?>
      2 <html xmlns="http://www.w3.org/1999/xhtml">
      3 <head>
      4  <script src="/resources/testharness.js"></script>
      5  <script src="/resources/testharnessreport.js"></script>
      6  <script src="../resources/helpers.js"></script>
      7  <meta charset="windows-1250"/>
      8  <title>javascript: URL navigation to a string must create a HTML document using the correct properties</title>
      9 </head>
     10 <body>
     11  <!--
     12    This document is XHTML and windows-1250 so that we can test the resulting javascript: URL document is not.
     13    The same for the window we open.
     14  -->
     15  <script><![CDATA[
     16  promise_test(async (t) => {
     17    const w = await openWindow("resources/xhtml-and-non-utf-8.xhtml", t);
     18 
     19    w.location.href = `javascript:'a string<script>
     20      opener.postMessage({
     21        compatMode: document.compatMode,
     22        contentType: document.contentType,
     23        characterSet: document.characterSet,
     24        doctypeIsNull: document.doctype === null
     25      }, "*");
     26    <` + `/script>'`;
     27 
     28    const results = await waitForMessage(w);
     29 
     30    assert_equals(results.compatMode, "BackCompat");
     31    assert_equals(results.contentType, "text/html");
     32    assert_equals(results.characterSet, "UTF-8");
     33    assert_equals(results.doctypeIsNull, true);
     34  });
     35  ]]></script>
     36 </body>
     37 </html>