tor-browser

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

test_title.html (2322B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 
      4 <head>
      5  <title>Test for titles</title>
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      8  <style type="text/css">
      9  </style>
     10 </head>
     11 
     12 <body onload="runTests()">
     13 
     14 <p id="display"></p>
     15 <div style="display:none;">
     16  <iframe id="html1" src="data:text/html,<html><head><title id='t'>Test</title></head></html>"></iframe>
     17  <iframe id="html2" src="data:text/html,<html><head><title id='t'>Test</title><title>Foo</title></head></html>"></iframe>
     18  <iframe id="html3" src="data:text/html,<html></html>"></iframe>
     19  <iframe id="xhtml1" src="data:text/xml,<html xmlns='http://www.w3.org/1999/xhtml'><body><title id='t'>Test</title></body></html>"></iframe>
     20  <iframe id="xhtml2" src="data:text/xml,<title xmlns='http://www.w3.org/1999/xhtml'>Test</title>"></iframe>
     21  <iframe id="xhtml3" src="data:text/xml,<title xmlns='http://www.w3.org/1999/xhtml'>Te<div>bogus</div>st</title>"></iframe>
     22  <iframe id="xhtml4" src="data:text/xml,<html xmlns='http://www.w3.org/1999/xhtml'/>"></iframe>
     23  <iframe id="xhtml5" src="data:text/xml,<html xmlns='http://www.w3.org/1999/xhtml'><head/></html>"></iframe>
     24  <iframe id="xhtml6" src="data:text/xml,<html xmlns='http://www.w3.org/1999/xhtml'><head><style/></head></html>"></iframe>
     25  <iframe id="svg1" src="data:text/xml,<svg xmlns='http://www.w3.org/2000/svg'><title id='t'>Test</title></svg>"></iframe>
     26  <iframe id="svg2" src="data:text/xml,<svg xmlns='http://www.w3.org/2000/svg'><title id='t'>Test</title></svg>"></iframe>
     27 </div>
     28 <pre id="test">
     29 <script>
     30 SimpleTest.waitForExplicitFinish();
     31 
     32 function runTests() {
     33  function testStatic(id, expect, description) {
     34    var myFrame = document.getElementById(id);
     35    var wrappedDoc = SpecialPowers.wrap(myFrame).contentDocument;
     36    is(wrappedDoc.title, expect, description);
     37  }
     38 
     39  testStatic("html1", "Test", "HTML <title>");
     40  testStatic("html2", "Test", "choose the first HTML <title>");
     41  testStatic("html3", "", "No title");
     42  testStatic("xhtml1", "Test", "XHTML <title> in body");
     43  testStatic("xhtml2", "Test", "XHTML <title> as root element");
     44  testStatic("xhtml3", "Test", "XHTML <title> containing an element");
     45  testStatic("svg1", "Test", "SVG <title>");
     46 
     47  SimpleTest.finish();
     48 }
     49 </script>
     50 </pre>
     51 </body>
     52 </html>