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

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

mercurial