commit 6803874c258b03f3fdd8cef519b6ef88185c54fa Author: Kathy Brade brade@pearlcrescent.com Date: Tue Aug 18 11:27:22 2015 -0400
fixup! Bug #15502: Isolate blob, mediasource & mediastream URLs to first party
Resurrect a workaround that allows pdf.js to save files. Fixes #16781. --- browser/extensions/pdfjs/content/PdfStreamConverter.jsm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/browser/extensions/pdfjs/content/PdfStreamConverter.jsm b/browser/extensions/pdfjs/content/PdfStreamConverter.jsm index f2ac778..24c2de1 100644 --- a/browser/extensions/pdfjs/content/PdfStreamConverter.jsm +++ b/browser/extensions/pdfjs/content/PdfStreamConverter.jsm @@ -250,6 +250,12 @@ ChromeActions.prototype = { filename = 'document.pdf'; } var blobUri = data.blobUrl ? NetUtil.newURI(data.blobUrl) : originalUri; + var netChannel; + try { + netChannel = NetUtil.newChannel(blobUri); + } catch (e) { + netChannel = NetUtil.newChannel(originalUri); + } var extHelperAppSvc = Cc['@mozilla.org/uriloader/external-helper-app-service;1']. getService(Ci.nsIExternalHelperAppService); @@ -257,7 +263,6 @@ ChromeActions.prototype = { getService(Ci.nsIWindowWatcher).activeWindow;
var docIsPrivate = this.isInPrivateBrowsing(); - var netChannel = NetUtil.newChannel(blobUri); if ('nsIPrivateBrowsingChannel' in Ci && netChannel instanceof Ci.nsIPrivateBrowsingChannel) { netChannel.setPrivate(docIsPrivate);