docshell/test/chrome/test_bug846906.xul

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <?xml version="1.0"?>
     2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
     3 <?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
     4 <!--
     5 https://bugzilla.mozilla.org/show_bug.cgi?id=846906
     6 -->
     7 <window title="Mozilla Bug 846906"
     8         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    10   <script type="application/javascript"
    11           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    13   <!-- test code goes here -->
    14   <script type="application/javascript">
    15   <![CDATA[
    17   /** Test for Bug 846906 **/
    18   SimpleTest.waitForExplicitFinish();
    20   var appShellService = Components.classes["@mozilla.org/appshell/appShellService;1"]
    21                                   .getService(Components.interfaces.nsIAppShellService);
    22   ok(appShellService, "Should be able to get app shell service");
    24   var webNavigation = appShellService.createWindowlessBrowser();
    25   ok(webNavigation, "Should be able to create windowless browser");
    27   var interfaceRequestor = webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
    28   ok(interfaceRequestor, "Should be able to query interface requestor interface");
    30   var docShell = interfaceRequestor.getInterface(Components.interfaces.nsIDocShell);
    31   ok(docShell, "Should be able to get doc shell interface");
    33   var document = webNavigation.document;
    34   ok(document, "Should be able to get document");
    36   var iframe = document.createElement("iframe");
    37   ok(iframe, "Should be able to create iframe");
    39   iframe.onload = function () {
    40     ok(true, "Should receive initial onload event");
    42     iframe.onload = function () {
    43         ok(true, "Should receive onload event");
    45         var contentDocument = iframe.contentDocument;
    46         ok(contentDocument, "Should be able to get content document");
    48         var div = contentDocument.getElementById("div1");
    49         ok(div, "Should be able to get element by id");
    51         var rect = div.getBoundingClientRect();
    52         ok(rect, "Should be able to get bounding client rect");
    54         // xxx: can we do better than hardcoding these values here?
    55         is(rect.width, 1024);
    56         is(rect.height, 768);
    58         SimpleTest.finish();
    59     };
    60     iframe.setAttribute("src", "http://mochi.test:8888/chrome/docshell/test/chrome/bug846906.html");
    61   };
    62   document.documentElement.appendChild(iframe);
    64   ]]>
    65   </script>
    67   <!-- test results are displayed in the html:body -->
    68   <body xmlns="http://www.w3.org/1999/xhtml">
    69   <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=846906"
    70      target="_blank">Mozilla Bug 846906</a>
    71   </body>
    72 </window>

mercurial