summaryrefslogtreecommitdiffstats
path: root/layout/base/tests/chrome/printpreview_bug482976_helper.xhtml
diff options
context:
space:
mode:
Diffstat (limited to 'layout/base/tests/chrome/printpreview_bug482976_helper.xhtml')
-rw-r--r--layout/base/tests/chrome/printpreview_bug482976_helper.xhtml50
1 files changed, 50 insertions, 0 deletions
diff --git a/layout/base/tests/chrome/printpreview_bug482976_helper.xhtml b/layout/base/tests/chrome/printpreview_bug482976_helper.xhtml
new file mode 100644
index 0000000000..81c29e1588
--- /dev/null
+++ b/layout/base/tests/chrome/printpreview_bug482976_helper.xhtml
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
+ type="text/css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=482976
+-->
+<window title="Mozilla Bug 482976" onload="run1()"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<iframe src="about:blank" type="content"></iframe>
+<iframe src="about:blank" type="content"></iframe>
+<script type="application/javascript">
+<![CDATA[
+// Note: We can't use window.frames directly here because the type="content"
+// attributes isolate the frames into their own BrowsingContext hierarchies.
+let frameElts = document.getElementsByTagName("iframe");
+
+var is = window.arguments[0].is;
+var ok = window.arguments[0].ok;
+var todo = window.arguments[0].todo;
+var SimpleTest = window.arguments[0].SimpleTest;
+var gWbp;
+var gPrintPreviewWin;
+function printpreview() {
+ let settings = Cc["@mozilla.org/gfx/printsettings-service;1"]
+ .getService(Ci.nsIPrintSettingsService).createNewPrintSettings();
+ gPrintPreviewWin = frameElts[0].contentWindow.printPreview(settings);
+ gWbp = gPrintPreviewWin.docShell.docViewer;
+ gWbp.QueryInterface(Ci.nsIWebBrowserPrint);
+}
+
+function exitprintpreview() {
+ gPrintPreviewWin.docShell.exitPrintPreview();
+ gPrintPreviewWin.close();
+}
+
+function finish() {
+ SimpleTest.finish();
+ window.close();
+}
+
+async function run1() {
+ printpreview();
+ ok(gWbp.doingPrintPreview, "Should be doing print preview");
+ exitprintpreview();
+ ok(!gWbp.doingPrintPreview, "Should not be doing print preview anymore");
+ finish();
+}
+]]></script>
+</window>