tor-browser

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

file_bug1209621.xhtml (3843B)


      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 https://bugzilla.mozilla.org/show_bug.cgi?id=1209621
      7 -->
      8 <window title="Mozilla Bug 1209621"
      9  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     10  onload="run()">
     11  <label value="Mozilla Bug 1209621"/>
     12  <!-- test code goes here -->
     13  <script type="application/javascript"><![CDATA[
     14  function ok(cond, msg) {
     15    window.arguments[0].ok(cond, msg);
     16  }
     17 
     18  function is(actual, expected, msg) {
     19    window.arguments[0].is(actual, expected, msg);
     20  }
     21 
     22  function run() {
     23    var docshell = window.docShell;
     24    ok(docshell, "Active window should have a DocShell");
     25    var treeOwner = docshell.treeOwner;
     26    ok(treeOwner, "Active docshell should have a TreeOwner!");
     27 
     28    is(treeOwner.primaryContentShell, null,
     29       "There shouldn't be primaryContentShell because no browser has primary=true.");
     30    is(treeOwner.primaryRemoteTab, null,
     31       "There shouldn't be primaryRemoteTab because no remote browser has primary=true.");
     32    is(treeOwner.primaryContentBrowsingContext, null,
     33       "There shouldn't be primaryContentBrowsingContext because no browser has primary=true.");
     34 
     35    var ip = document.getElementById("inprocess");
     36    var remote = document.getElementById("remote");
     37    var remote2 = document.getElementById("remote2");
     38 
     39    ip.setAttribute("primary", "true");
     40    ok(ip.docShell, "non-remote browser should have a DocShell.");
     41    is(treeOwner.primaryContentShell, ip.docShell,
     42       "primary browser should be the primaryContentShell.");
     43    is(treeOwner.primaryRemoteTab, null,
     44       "There shouldn't be primaryRemoteTab because no remote browser has primary=true.");
     45    is(treeOwner.primaryContentBrowsingContext, ip.browsingContext,
     46       "primary browsing context should be the primaryContentBrowsingContext.");
     47 
     48    ip.removeAttribute("primary");
     49    remote.setAttribute("primary", "true");
     50    is(treeOwner.primaryContentShell, null,
     51       "There shouldn't be primaryContentShell because no browser has primary=true.");
     52    var tp = remote.frameLoader.remoteTab;
     53    ok(tp, "Remote browsers should have a remoteTab.");
     54    is(treeOwner.primaryRemoteTab, tp,
     55       "primary remote browser should be the primaryRemoteTab.");
     56    is(treeOwner.primaryContentBrowsingContext, remote.browsingContext,
     57       "primary remote browser should be the primaryContentBrowsingContext.");
     58 
     59    remote.removeAttribute("primary");
     60    is(treeOwner.primaryContentShell, null,
     61       "There shouldn't be primaryContentShell because no browser has primary=true.");
     62    is(treeOwner.primaryRemoteTab, null,
     63       "There shouldn't be primaryRemoteTab because no remote browser has primary=true.");
     64    is(treeOwner.primaryContentBrowsingContext, null,
     65       "There shouldn't be primaryContentBrowsingContext because no browser has primary=true.");
     66 
     67    remote2.setAttribute("primary", "true");
     68    var tp2 = remote2.frameLoader.remoteTab;
     69    ok(tp2, "Remote browsers should have a remoteTab.");
     70    is(treeOwner.primaryRemoteTab, tp2,
     71       "primary remote browser should be the primaryRemoteTab.");
     72    is(treeOwner.primaryContentShell, null,
     73       "There shouldn't be primaryContentShell because no browser has primary=true.");
     74    is(treeOwner.primaryContentBrowsingContext, remote2.browsingContext,
     75       "primary remote browser should be the primaryContentBrowsingContext.");
     76 
     77    window.arguments[0].setTimeout(function() { this.done(); }, 0);
     78    window.close();
     79  }
     80 
     81  ]]></script>
     82  <browser type="content" src="about:blank" id="inprocess"/>
     83  <browser type="content" remote="true" src="about:blank" id="remote"/>
     84  <browser type="content" remote="true" src="about:blank" id="remote2"/>
     85 </window>