Bug 1285544 - Make sure print jobs that go through simplification get the right document URL set. r=mconley.

This commit is contained in:
Matheus Longaray 2016-07-11 08:48:00 +02:00
Родитель dcb23a03bd
Коммит a5ed7d2abc
2 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -114,6 +114,7 @@ var PrintUtils = {
let mm = aBrowser.messageManager; let mm = aBrowser.messageManager;
mm.sendAsyncMessage("Printing:Print", { mm.sendAsyncMessage("Printing:Print", {
windowID: aWindowID, windowID: aWindowID,
simplifiedMode: this._shouldSimplify,
}); });
}, },

Просмотреть файл

@ -466,7 +466,7 @@ var Printing = {
} }
case "Printing:Print": { case "Printing:Print": {
this.print(Services.wm.getOuterWindowWithId(data.windowID)); this.print(Services.wm.getOuterWindowWithId(data.windowID), data.simplifiedMode);
break; break;
} }
} }
@ -631,9 +631,17 @@ var Printing = {
docShell.printPreview.exitPrintPreview(); docShell.printPreview.exitPrintPreview();
}, },
print(contentWindow) { print(contentWindow, simplifiedMode) {
let printSettings = this.getPrintSettings(); let printSettings = this.getPrintSettings();
let rv = Cr.NS_OK; let rv = Cr.NS_OK;
// If we happen to be on simplified mode, we need to set docURL in order
// to generate header/footer content correctly, since simplified tab has
// "about:blank" as its URI.
if (printSettings && simplifiedMode) {
printSettings.docURL = contentWindow.document.baseURI;
}
try { try {
let print = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor) let print = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebBrowserPrint); .getInterface(Ci.nsIWebBrowserPrint);