tor-browser

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

test_embeds.xhtml (3660B)


      1 <?xml version="1.0"?>
      2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
      3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
      4                 type="text/css"?>
      5 
      6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
      7        title="Embeds relation tests">
      8 
      9  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
     10  <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
     11 
     12  <script type="application/javascript"
     13          src="../common.js"></script>
     14  <script type="application/javascript"
     15          src="../role.js"></script>
     16  <script type="application/javascript"
     17          src="../states.js"></script>
     18  <script type="application/javascript"
     19          src="../events.js"></script>
     20  <script type="application/javascript"
     21          src="../relations.js"></script>
     22  <script type="application/javascript"
     23          src="../browser.js"></script>
     24 
     25  <script type="application/javascript">
     26  <![CDATA[
     27    ////////////////////////////////////////////////////////////////////////////
     28    // Invokers
     29 
     30    function loadURI(aURI)
     31    {
     32      this.invoke = function loadURI_invoke()
     33      {
     34        tabBrowser().loadURI(Services.io.newURI(aURI), {
     35          triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
     36        });
     37      }
     38 
     39      this.eventSeq = [
     40        new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument)
     41      ];
     42 
     43      this.finalCheck = function loadURI_finalCheck()
     44      {
     45        testRelation(browserDocument(), RELATION_EMBEDS,
     46                     getAccessible(currentTabDocument()));
     47      }
     48 
     49      this.getID = function loadURI_getID()
     50      {
     51        return "load uri " + aURI;
     52      }
     53    }
     54 
     55    function addTab(aURI)
     56    {
     57      this.invoke = function addTab_invoke()
     58      {
     59        tabBrowser().addTab(aURI, {
     60          referrerURI: null,
     61          charset: null,
     62          postData: null,
     63          inBackground: false,
     64          triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
     65        });
     66      }
     67 
     68      this.eventSeq = [
     69        new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument)
     70      ];
     71 
     72      this.finalCheck = function loadURI_finalCheck()
     73      {
     74        testRelation(browserDocument(), RELATION_EMBEDS,
     75                     getAccessible(currentTabDocument()));
     76      }
     77 
     78      this.getID = function addTab_getID()
     79      {
     80        return "load uri '" + aURI + "' in new tab";
     81      }
     82    }
     83 
     84    ////////////////////////////////////////////////////////////////////////////
     85    // Testing
     86 
     87    //gA11yEventDumpToConsole = true; // debug
     88 
     89    var gQueue = null;
     90    function doTests()
     91    {
     92      testRelation(browserDocument(), RELATION_EMBEDS,
     93                   getAccessible(currentTabDocument()));
     94 
     95      enableLogging("docload");
     96      gQueue = new eventQueue();
     97 
     98      gQueue.push(new loadURI("about:robots"));
     99      gQueue.push(new addTab("about:mozilla"));
    100 
    101      gQueue.onFinish = function()
    102      {
    103        disableLogging();
    104        closeBrowserWindow();
    105      }
    106      gQueue.invoke();
    107    }
    108 
    109    SimpleTest.waitForExplicitFinish();
    110    openBrowserWindow(doTests, "about:license");
    111  ]]>
    112  </script>
    113 
    114  <vbox flex="1" style="overflow: auto;">
    115  <body xmlns="http://www.w3.org/1999/xhtml">
    116    <a target="_blank"
    117       href="https://bugzilla.mozilla.org/show_bug.cgi?id=707654"
    118       title="Embeds relation on root accessible can return not content document">
    119      Mozilla Bug 707654
    120    </a>
    121    <p id="display"></p>
    122    <div id="content" style="display: none">
    123    </div>
    124    <pre id="test">
    125    </pre>
    126  </body>
    127  </vbox>
    128 </window>