tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

printpreview_bug482976_helper.xhtml (1693B)


      1 <?xml version="1.0"?>
      2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
      3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
      4                 type="text/css"?>
      5 <!--
      6 https://bugzilla.mozilla.org/show_bug.cgi?id=482976
      7 -->
      8 <window title="Mozilla Bug 482976" onload="run1()"
      9        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     10 <iframe src="about:blank" type="content"></iframe>
     11 <iframe src="about:blank" type="content"></iframe>
     12 <script type="application/javascript">
     13 <![CDATA[
     14 // Note: We can't use window.frames directly here because the type="content"
     15 // attributes isolate the frames into their own BrowsingContext hierarchies.
     16 let frameElts = document.getElementsByTagName("iframe");
     17 
     18 var is = window.arguments[0].is;
     19 var ok = window.arguments[0].ok;
     20 var todo = window.arguments[0].todo;
     21 var SimpleTest = window.arguments[0].SimpleTest;
     22 var gWbp;
     23 var gPrintPreviewWin;
     24 function printpreview() {
     25  let settings = Cc["@mozilla.org/gfx/printsettings-service;1"]
     26                       .getService(Ci.nsIPrintSettingsService).createNewPrintSettings();
     27  gPrintPreviewWin = frameElts[0].contentWindow.printPreview(settings);
     28  gWbp = gPrintPreviewWin.docShell.docViewer;
     29  gWbp.QueryInterface(Ci.nsIWebBrowserPrint);
     30 }
     31 
     32 function exitprintpreview() {
     33  gPrintPreviewWin.docShell.exitPrintPreview();
     34  gPrintPreviewWin.close();
     35 }
     36 
     37 function finish() {
     38  SimpleTest.finish();
     39  window.close();
     40 }
     41 
     42 async function run1() {
     43  printpreview();
     44  ok(gWbp.doingPrintPreview, "Should be doing print preview");
     45  exitprintpreview();
     46  ok(!gWbp.doingPrintPreview, "Should not be doing print preview anymore");
     47  finish();
     48 }
     49 ]]></script>
     50 </window>