This repository has been archived by the owner on Aug 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 846906 - Implement nsAppShellService::CreateWindowlessBrowser; r=…
…bz; sr=benjamin
- Loading branch information
Showing
5 changed files
with
243 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?xml version="1.0"?> | ||
<?xml-stylesheet type="text/css" href="chrome://global/skin"?> | ||
<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?> | ||
<!-- | ||
https://bugzilla.mozilla.org/show_bug.cgi?id=846906 | ||
--> | ||
<window title="Mozilla Bug 846906" | ||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> | ||
|
||
<title>Test for Bug 846906</title> | ||
<script type="application/javascript" | ||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> | ||
|
||
<!-- test code goes here --> | ||
<script type="application/javascript"> | ||
<![CDATA[ | ||
/** Test for Bug 846906 **/ | ||
SimpleTest.waitForExplicitFinish(); | ||
var appShellService = Components.classes["@mozilla.org/appshell/appShellService;1"] | ||
.getService(Components.interfaces.nsIAppShellService); | ||
ok(appShellService, "Should be able to get app shell service"); | ||
var webNavigation = appShellService.createWindowlessBrowser(); | ||
ok(webNavigation, "Should be able to create windowless browser"); | ||
var interfaceRequestor = webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor); | ||
ok(interfaceRequestor, "Should be able to query interface requestor interface"); | ||
var docShell = interfaceRequestor.getInterface(Components.interfaces.nsIDocShell); | ||
ok(docShell, "Should be able to get doc shell interface"); | ||
var webNavigation = docShell.QueryInterface(Components.interfaces.nsIWebNavigation); | ||
ok(webNavigation, "Should be able to query web navigation interface"); | ||
var document = webNavigation.document; | ||
ok(document, "Should be able to get document"); | ||
var iframe = document.createElement("iframe"); | ||
ok(iframe, "Should be able to create iframe"); | ||
iframe.onload = function () { | ||
ok(true, "Should receive initial onload event"); | ||
iframe.onload = function () { | ||
ok(true, "Should receive onload event"); | ||
var contentDocument = iframe.contentDocument; | ||
ok(contentDocument, "Should be able to get content document"); | ||
var div = contentDocument.getElementById("div1"); | ||
ok(div, "Should be able to get element by id"); | ||
var rect = div.getBoundingClientRect(); | ||
ok(rect, "Should be able to get bounding client rect"); | ||
// xxx: can we do better than hardcoding these values here? | ||
ok(rect.left == 8); | ||
ok(rect.right == 477); | ||
ok(rect.top == 8); | ||
ok(rect.bottom == 1010); | ||
SimpleTest.finish(); | ||
}; | ||
iframe.setAttribute("src", "http://mochi.test:8888/chrome/docshell/test/chrome/generic.html"); | ||
}; | ||
document.documentElement.appendChild(iframe); | ||
]]> | ||
</script> | ||
|
||
<!-- test results are displayed in the html:body --> | ||
<body xmlns="http://www.w3.org/1999/xhtml"> | ||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=846906" | ||
target="_blank">Mozilla Bug 846906</a> | ||
</body> | ||
</window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters