Bug 894150 - Test.
[gecko.git] / docshell / test / chrome / test_bug846906.xul
blob955e58b29c96a30ad56f94f99e28d234c69893aa
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 <title>Test for Bug 846906</title>
11 <script type="application/javascript"
12 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
14 <!-- test code goes here -->
15 <script type="application/javascript">
16 <![CDATA[
18 /** Test for Bug 846906 **/
19 SimpleTest.waitForExplicitFinish();
21 var appShellService = Components.classes["@mozilla.org/appshell/appShellService;1"]
22 .getService(Components.interfaces.nsIAppShellService);
23 ok(appShellService, "Should be able to get app shell service");
25 var webNavigation = appShellService.createWindowlessBrowser();
26 ok(webNavigation, "Should be able to create windowless browser");
28 var interfaceRequestor = webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
29 ok(interfaceRequestor, "Should be able to query interface requestor interface");
31 var docShell = interfaceRequestor.getInterface(Components.interfaces.nsIDocShell);
32 ok(docShell, "Should be able to get doc shell interface");
34 var document = webNavigation.document;
35 ok(document, "Should be able to get document");
37 var iframe = document.createElement("iframe");
38 ok(iframe, "Should be able to create iframe");
40 iframe.onload = function () {
41 ok(true, "Should receive initial onload event");
43 iframe.onload = function () {
44 ok(true, "Should receive onload event");
46 var contentDocument = iframe.contentDocument;
47 ok(contentDocument, "Should be able to get content document");
49 var div = contentDocument.getElementById("div1");
50 ok(div, "Should be able to get element by id");
52 var rect = div.getBoundingClientRect();
53 ok(rect, "Should be able to get bounding client rect");
55 // xxx: can we do better than hardcoding these values here?
56 is(rect.width, 1024);
57 is(rect.height, 768);
59 SimpleTest.finish();
61 iframe.setAttribute("src", "http://mochi.test:8888/chrome/docshell/test/chrome/bug846906.html");
63 document.documentElement.appendChild(iframe);
65 ]]>
66 </script>
68 <!-- test results are displayed in the html:body -->
69 <body xmlns="http://www.w3.org/1999/xhtml">
70 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=846906"
71 target="_blank">Mozilla Bug 846906</a>
72 </body>
73 </window>