Bug 1885489 - Part 5: Add SnapshotIterator::readInt32(). r=iain
[gecko.git] / docshell / test / chrome / test_bug846906.xhtml
blob74bfdf70367e2c987e03e845e77e66500f514c70
1 <?xml version="1.0"?>
2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/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 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
12 <!-- test code goes here -->
13 <script type="application/javascript">
14 <![CDATA[
16 /** Test for Bug 846906 */
17 SimpleTest.waitForExplicitFinish();
19 var appShellService = SpecialPowers.Services.appShell;
20 ok(appShellService, "Should be able to get app shell service");
22 var windowlessBrowser = appShellService.createWindowlessBrowser();
23 ok(windowlessBrowser, "Should be able to create windowless browser");
25 ok(windowlessBrowser instanceof Ci.nsIWindowlessBrowser,
26 "Windowless browser should implement nsIWindowlessBrowser");
28 var webNavigation = windowlessBrowser.QueryInterface(Ci.nsIWebNavigation);
29 ok(webNavigation, "Windowless browser should implement nsIWebNavigation");
31 var interfaceRequestor = windowlessBrowser.QueryInterface(Ci.nsIInterfaceRequestor);
32 ok(interfaceRequestor, "Should be able to query interface requestor interface");
34 var docShell = windowlessBrowser.docShell;
35 ok(docShell, "Should be able to get doc shell interface");
37 var document = webNavigation.document;
38 ok(document, "Should be able to get document");
40 var iframe = document.createXULElement("iframe");
41 ok(iframe, "Should be able to create iframe");
43 iframe.onload = function () {
44 ok(true, "Should receive initial onload event");
46 iframe.onload = function () {
47 ok(true, "Should receive onload event");
49 var contentDocument = iframe.contentDocument;
50 ok(contentDocument, "Should be able to get content document");
52 var div = contentDocument.getElementById("div1");
53 ok(div, "Should be able to get element by id");
55 var rect = div.getBoundingClientRect();
56 ok(rect, "Should be able to get bounding client rect");
58 // xxx: can we do better than hardcoding these values here?
59 is(rect.width, 1024);
60 is(rect.height, 768);
62 windowlessBrowser.close();
64 // Once the browser is closed, nsIWebNavigation and
65 // nsIInterfaceRequestor methods should no longer be accessible.
66 try {
67 windowlessBrowser.getInterface(Ci.nsIDocShell);
68 ok(false);
69 } catch (e) {
70 is(e.result, Cr.NS_ERROR_NULL_POINTER);
73 try {
74 windowlessBrowser.document;
75 ok(false);
76 } catch (e) {
77 is(e.result, Cr.NS_ERROR_NULL_POINTER);
80 SimpleTest.finish();
82 iframe.setAttribute("src", "http://mochi.test:8888/chrome/docshell/test/chrome/bug846906.html");
84 document.documentElement.appendChild(iframe);
86 ]]>
87 </script>
89 <!-- test results are displayed in the html:body -->
90 <body xmlns="http://www.w3.org/1999/xhtml">
91 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=846906"
92 target="_blank">Mozilla Bug 846906</a>
93 </body>
94 </window>