From 2f5564d29252d3dff491c18d443c5ef85e902c3e Mon Sep 17 00:00:00 2001 From: Mike Conley Date: Fri, 3 Jul 2015 18:20:07 -0400 Subject: [PATCH] Bug 1181160 - Make print preview work in view source window when viewing source from a remote browser. r=jryans We weren't making the print preview browser remote for the view source window if the view source browser was remote, causing us to fail to show the preview. --HG-- extra : commitid : Im9lcqBfT1f extra : rebase_source : ed98f41d50085cabd4b966aff959c852972823c1 extra : amend_source : d042e90a701ee0e51a9eb5b267f483ec2f556145 --- .../viewsource/content/viewSource.js | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/toolkit/components/viewsource/content/viewSource.js b/toolkit/components/viewsource/content/viewSource.js index c3bd11aed9b1..eee5178287d7 100644 --- a/toolkit/components/viewsource/content/viewSource.js +++ b/toolkit/components/viewsource/content/viewSource.js @@ -699,20 +699,26 @@ let viewSourceChrome = new ViewSourceChrome(); * PrintUtils uses this to make Print Preview work. */ let PrintPreviewListener = { - getPrintPreviewBrowser() { - let browser = document.getElementById("ppBrowser"); - if (!browser) { - browser = document.createElement("browser"); - browser.setAttribute("id", "ppBrowser"); - browser.setAttribute("flex", "1"); - browser.setAttribute("type", "content"); + _ppBrowser: null, - let findBar = document.getElementById("FindToolbar"); - document.getElementById("appcontent") - .insertBefore(browser, findBar); + getPrintPreviewBrowser() { + if (!this._ppBrowser) { + this._ppBrowser = document.createElement("browser"); + this._ppBrowser.setAttribute("flex", "1"); + this._ppBrowser.setAttribute("type", "content"); } - return browser; + if (gBrowser.isRemoteBrowser) { + this._ppBrowser.setAttribute("remote", "true"); + } else { + this._ppBrowser.removeAttribute("remote"); + } + + let findBar = document.getElementById("FindToolbar"); + document.getElementById("appcontent") + .insertBefore(this._ppBrowser, findBar); + + return this._ppBrowser; }, getSourceBrowser() { @@ -730,7 +736,7 @@ let PrintPreviewListener = { }, onExit() { - document.getElementById("ppBrowser").collapsed = true; + this._ppBrowser.remove(); gBrowser.collapsed = false; document.getElementById("viewSource-toolbox").hidden = false; },