xpfe/browser/resources/content/browser.js,1.1 | . | Disk File |
Skipping to line 36 | . | |
* the terms of any one of the NPL, the GPL or the LGPL. |
. |
* the terms of any one of the NPL, the GPL or the LGPL. |
* |
. |
* |
* ***** END LICENSE BLOCK ***** */ |
. |
* ***** END LICENSE BLOCK ***** */ |
|
. |
|
const nsIWebNavigation = Components.interfaces.nsIWebNavigation; |
. |
const nsIWebNavigation = Components.interfaces.nsIWebNavigation; |
  |
. |
var gPrintSettings = null; |
|
. |
|
function getWebNavigation() |
. |
function getWebNavigation() |
{ |
. |
{ |
try { |
. |
try { |
return getBrowser().webNavigation; |
. |
return getBrowser().webNavigation; |
Skipping to line 71 | . | |
} |
. |
} |
} |
. |
} |
|
. |
|
function BrowserPrintPreview() |
. |
function BrowserPrintPreview() |
{ |
. |
{ |
// using _content.print() until printing becomes scriptable on docShell
|
. |
var printOptionsService = Components.classes["@mozilla.org/gfx/printoptions;
1"] |
 
|
. |
.getService(Components.interfaces.nsI
PrintOptions); |
  |
. |
if (gPrintSettings == null) { |
  |
. |
gPrintSettings = printOptionsService.CreatePrintSettings(); |
  |
. |
} |
 
|
. |
// using _content.printPreview() until printing becomes scriptable on docShe
ll |
try { |
. |
try { |
_content.printPreview(); |
. |
_content.printPreview(gPrintSettings, false); |
  |
. |
|
} catch (e) { |
. |
} catch (e) { |
// Pressing cancel is expressed as an NS_ERROR_FAILURE return value, |
. |
// Pressing cancel is expressed as an NS_ERROR_FAILURE return value, |
// causing an exception to be thrown which we catch here. |
. |
// causing an exception to be thrown which we catch here. |
// Unfortunately this will also consume helpful failures, so add a |
. |
// Unfortunately this will also consume helpful failures, so add a |
// dump(e); // if you need to debug |
. |
// dump(e); // if you need to debug |
Skipping to line 91 | . | |
} |
. |
} |
|
. |
|
  |
. |
|
function BrowserPrintSetup() |
. |
function BrowserPrintSetup() |
{ |
. |
{ |
goPageSetup(); // from utilityOverlay.js |
. |
try { |
 
|
. |
var printOptionsService = Components.classes["@mozilla.org/gfx/printoption
s;1"] |
 
|
. |
.getService(Components.interfaces.n
sIPrintOptions); |
  |
. |
|
  |
. |
// create our own local copy of the print settings |
  |
. |
if (gPrintSettings == null) { |
  |
. |
gPrintSettings = printOptionsService.CreatePrintSettings(); |
  |
. |
} |
  |
. |
goPageSetup(gPrintSettings); // from utilityOverlay.js |
  |
. |
} catch (e) { |
  |
. |
alert("BrowserPrintSetup "+e); |
  |
. |
} |
} |
. |
} |
|
. |
|
function BrowserPrint() |
. |
function BrowserPrint() |
{ |
. |
{ |
// using _content.print() until printing becomes scriptable on docShell
|
. |
var printOptionsService = Components.classes["@mozilla.org/gfx/printoptions;
1"] |
 
|
. |
.getService(Components.interfaces.n
sIPrintOptions); |
  |
. |
if (gPrintSettings == null) { |
  |
. |
gPrintSettings = printOptionsService.CreatePrintSettings(); |
  |
. |
} |
  |
. |
|
try { |
. |
try { |
_content.print(); |
. |
// using _content.print() until printing becomes scriptable on docShell |
  |
. |
_content.print(gPrintSettings, false); |
  |
. |
|
} catch (e) { |
. |
} catch (e) { |
// Pressing cancel is expressed as an NS_ERROR_FAILURE return value, |
. |
// Pressing cancel is expressed as an NS_ERROR_ABORT return value, |
// causing an exception to be thrown which we catch here. |
. |
// causing an exception to be thrown which we catch here. |
// Unfortunately this will also consume helpful failures, so add a |
. |
// Unfortunately this will also consume helpful failures, so add a |
// dump(e); // if you need to debug |
. |
// dump(e); // if you need to debug |
} |
. |
} |
} |
. |
} |