From 673582984f6eb72f86da9161659b9da65d36528d Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Fri, 5 Oct 2012 15:07:51 -0500 Subject: [PATCH] Bug 792582 - Explicitly set privacy status of channels created by pdf.js --- .../firefox/components/PdfStreamConverter.js | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/extensions/firefox/components/PdfStreamConverter.js b/extensions/firefox/components/PdfStreamConverter.js index 32143a1e5..7b3f75cc2 100644 --- a/extensions/firefox/components/PdfStreamConverter.js +++ b/extensions/firefox/components/PdfStreamConverter.js @@ -213,7 +213,22 @@ ChromeActions.prototype = { var frontWindow = Cc['@mozilla.org/embedcomp/window-watcher;1']. getService(Ci.nsIWindowWatcher).activeWindow; - NetUtil.asyncFetch(blobUri, function(aInputStream, aResult) { + let docIsPrivate = false; + try { + docIsPrivate = this.domWindow + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsILoadContext) + .usePrivateBrowsing; + } catch (x) { + } + + let netChannel = NetUtil.newChannel(blobUri); + if ('nsIPrivateBrowsingChannel' in Ci && + netChannel instanceof Ci.nsIPrivateBrowsingChannel) { + netChannel.setPrivate(docIsPrivate); + } + NetUtil.asyncFetch(netChannel, function(aInputStream, aResult) { if (!Components.isSuccessCode(aResult)) { if (sendResponse) sendResponse(true); @@ -226,6 +241,10 @@ ChromeActions.prototype = { channel.setURI(originalUri); channel.contentStream = aInputStream; channel.QueryInterface(Ci.nsIChannel); + if ('nsIPrivateBrowsingChannel' in Ci && + channel instanceof Ci.nsIPrivateBrowsingChannel) { + channel.setPrivate(docIsPrivate); + } var listener = { extListener: null,