mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 20a6d6e9c31a (bug 1088070) for bc1 test failures on a CLOSED TREE
This commit is contained in:
parent
872e72c5b1
commit
a05e43a9d3
@ -166,6 +166,8 @@ var PrintUtils = {
|
||||
"to a browser.");
|
||||
}
|
||||
|
||||
let printSettings = this.getPrintSettings();
|
||||
|
||||
let mm = aBrowser.messageManager;
|
||||
|
||||
mm.addMessageListener("Printing:Print:Done", function onPrintingDone(msg) {
|
||||
@ -191,6 +193,7 @@ var PrintUtils = {
|
||||
});
|
||||
|
||||
mm.sendAsyncMessage("Printing:Print", null, {
|
||||
printSettings: printSettings,
|
||||
contentWindow: aWindow,
|
||||
});
|
||||
},
|
||||
@ -458,7 +461,9 @@ var PrintUtils = {
|
||||
// listener.
|
||||
let ppBrowser = this._listener.getPrintPreviewBrowser();
|
||||
let mm = ppBrowser.messageManager;
|
||||
let printSettings = this.getPrintSettings();
|
||||
mm.sendAsyncMessage("Printing:Preview:Enter", null, {
|
||||
printSettings: printSettings,
|
||||
contentWindow: this._sourceBrowser.contentWindowAsCPOW,
|
||||
});
|
||||
|
||||
|
@ -383,7 +383,7 @@ let Printing = {
|
||||
let data = message.data;
|
||||
switch(message.name) {
|
||||
case "Printing:Preview:Enter": {
|
||||
this.enterPrintPreview(objects.contentWindow);
|
||||
this.enterPrintPreview(objects.printSettings, objects.contentWindow);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -403,31 +403,19 @@ let Printing = {
|
||||
}
|
||||
|
||||
case "Printing:Print": {
|
||||
this.print(objects.contentWindow);
|
||||
this.print(objects.printSettings, objects.contentWindow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getPrintSettings() {
|
||||
let PSSVC = Cc["@mozilla.org/gfx/printsettings-service;1"]
|
||||
.getService(Ci.nsIPrintSettingsService);
|
||||
|
||||
let printSettings = PSSVC.globalPrintSettings;
|
||||
if (!printSettings.printerName) {
|
||||
printSettings.printerName = PSSVC.defaultPrinterName;
|
||||
enterPrintPreview(printSettings, contentWindow) {
|
||||
// Bug 1088070 - we should instantiate nsIPrintSettings here in the
|
||||
// content script instead of passing it down as a CPOW.
|
||||
if (Cu.isCrossProcessWrapper(printSettings)) {
|
||||
printSettings = null;
|
||||
}
|
||||
// First get any defaults from the printer
|
||||
PSSVC.initPrintSettingsFromPrinter(printSettings.printerName,
|
||||
printSettings);
|
||||
// now augment them with any values from last time
|
||||
PSSVC.initPrintSettingsFromPrefs(printSettings, true,
|
||||
printSettings.kInitSaveAll);
|
||||
|
||||
return printSettings;
|
||||
},
|
||||
|
||||
enterPrintPreview(contentWindow) {
|
||||
// We'll call this whenever we've finished reflowing the document, or if
|
||||
// we errored out while attempting to print preview (in which case, we'll
|
||||
// notify the parent that we've failed).
|
||||
@ -450,7 +438,6 @@ let Printing = {
|
||||
addEventListener("printPreviewUpdate", onPrintPreviewReady);
|
||||
|
||||
try {
|
||||
let printSettings = this.getPrintSettings();
|
||||
docShell.printPreview.printPreview(printSettings, contentWindow, this);
|
||||
} catch(error) {
|
||||
// This might fail if we, for example, attempt to print a XUL document.
|
||||
@ -464,8 +451,13 @@ let Printing = {
|
||||
docShell.printPreview.exitPrintPreview();
|
||||
},
|
||||
|
||||
print(contentWindow) {
|
||||
let printSettings = this.getPrintSettings();
|
||||
print(printSettings, contentWindow) {
|
||||
// Bug 1088070 - we should instantiate nsIPrintSettings here in the
|
||||
// content script instead of passing it down as a CPOW.
|
||||
if (Cu.isCrossProcessWrapper(printSettings)) {
|
||||
printSettings = null;
|
||||
}
|
||||
|
||||
let rv = Cr.NS_OK;
|
||||
try {
|
||||
let print = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
|
Loading…
Reference in New Issue
Block a user