Bug 1308621 - print preview shouldn't re-set the source browser, r=florian

Right now the "already in print preview" case in printPreview() collapses
the print preview browser - but also clobbers its _sourceBrowser property,
which shouldn't point to the print preview browser but to the 'normal'
browser whose print preview is in the print preview browser.

This patch fixes the clobbering, and updates later code to not call
getSourceBrowser() repeatedly, as doing so can in some race conditions end up
print previewing the wrong page.

MozReview-Commit-ID: FlMRrPEkAJQ

--HG--
extra : rebase_source : 47f0aa065c45fce7d7a868394332c5d6d0e067fb
This commit is contained in:
Gijs Kruitbosch 2016-10-06 12:58:37 +01:00
parent a73a2bb872
commit d0df002eda

View File

@ -205,8 +205,8 @@ var PrintUtils = {
// collapse the browser here -- it will be shown in
// enterPrintPreview; this forces a reflow which fixes display
// issues in bug 267422.
this._sourceBrowser = this._listener.getPrintPreviewBrowser();
this._sourceBrowser.collapsed = true;
let ppBrowser = this._listener.getPrintPreviewBrowser();
ppBrowser.collapsed = true;
}
this._webProgressPP = {};
@ -531,15 +531,15 @@ var PrintUtils = {
// the original page. After we have parsed it, content will tell parent
// that the document is ready for print previewing.
spMM.sendAsyncMessage("Printing:Preview:ParseDocument", {
URL: this._listener.getSourceBrowser().currentURI.spec,
windowID: this._listener.getSourceBrowser().outerWindowID,
URL: this._sourceBrowser.currentURI.spec,
windowID: this._sourceBrowser.outerWindowID,
});
// Here we log telemetry data for when the user enters simplify mode.
this.logTelemetry("PRINT_PREVIEW_SIMPLIFY_PAGE_OPENED_COUNT");
}
} else {
sendEnterPreviewMessage(this._listener.getSourceBrowser(), false);
sendEnterPreviewMessage(this._sourceBrowser, false);
}
if (this._webProgressPP.value) {