tor-browser

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

mozFrameType_window.xhtml (1808B)


      1 <?xml version="1.0"?>
      2 <!-- Any copyright is dedicated to the Public Domain.
      3   - http://creativecommons.org/publicdomain/zero/1.0/ -->
      4 <window title="Test mozFrameType attribute"
      5  xmlns:html="http://www.w3.org/1999/xhtml"
      6  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
      7  onload="runTests();">
      8 
      9  <html:iframe id="normalFrame"/>
     10  <html:iframe id="typeContentFrame" mozframetype="content"/>
     11 
     12  <script type="application/javascript"><![CDATA[
     13    function runTests() {
     14      let opener = window.arguments[0];
     15      let SimpleTest = opener.SimpleTest;
     16 
     17      function getDocShellType(frame) {
     18        return frame.contentWindow.docShell.itemType;
     19      }
     20 
     21      var normalFrame = document.getElementById("normalFrame");
     22      var typeContentFrame = document.getElementById("typeContentFrame");
     23 
     24      SimpleTest.is(getDocShellType(normalFrame), Ci.nsIDocShellTreeItem.typeChrome,
     25                    "normal iframe in chrome document is typeChrome");
     26      SimpleTest.is(getDocShellType(typeContentFrame), Ci.nsIDocShellTreeItem.typeContent,
     27                    "iframe with mozFrameType='content' in chrome document is typeContent");
     28 
     29      SimpleTest.executeSoon(function () {
     30        // First focus the parent window and then close this one.
     31        SimpleTest.waitForFocus(function() {
     32          let ww = SpecialPowers.Services.ww;
     33          ww.registerNotification(function windowObs(subject, topic) {
     34            if (topic == "domwindowclosed") {
     35              ww.unregisterNotification(windowObs);
     36 
     37              // Don't start the next test synchronously!
     38              SimpleTest.executeSoon(function() {
     39                SimpleTest.finish();
     40              });
     41            }
     42          });
     43 
     44          window.close();
     45        }, opener);
     46      });
     47    }
     48  ]]></script>
     49 </window>