diff --git a/extensions/firefox/components/PdfStreamConverter.js b/extensions/firefox/components/PdfStreamConverter.js index a0057ebb6..d371e50cd 100644 --- a/extensions/firefox/components/PdfStreamConverter.js +++ b/extensions/firefox/components/PdfStreamConverter.js @@ -132,16 +132,13 @@ ChromeActions.prototype = { var originalUrl = data.originalUrl; // The data may not be downloaded so we need just retry getting the pdf with // the original url. - var blobUrl = data.blobUrl || originalUrl; - var originalUri = NetUtil.newURI(originalUrl); - var blobUri = NetUtil.newURI(blobUrl); + var originalUri = NetUtil.newURI(data.originalUrl); + var blobUri = data.blobUrl ? NetUtil.newURI(data.blobUrl) : originalUri; var extHelperAppSvc = Cc['@mozilla.org/uriloader/external-helper-app-service;1']. getService(Ci.nsIExternalHelperAppService); var frontWindow = Cc['@mozilla.org/embedcomp/window-watcher;1']. getService(Ci.nsIWindowWatcher).activeWindow; - var ioService = Services.io; - var channel = ioService.newChannel(originalUrl, null, null); NetUtil.asyncFetch(blobUri, function(aInputStream, aResult) { if (!Components.isSuccessCode(aResult)) { diff --git a/l10n/en-US/chrome.properties b/l10n/en-US/chrome.properties index 1885e6036..2b3dce42f 100644 --- a/l10n/en-US/chrome.properties +++ b/l10n/en-US/chrome.properties @@ -1,3 +1,4 @@ # Chrome notification bar messages and buttons unsupported_feature=This PDF document might not be displayed correctly. open_with_different_viewer=Open With Different Viewer +open_with_different_viewer.accessKey=o diff --git a/src/core.js b/src/core.js index 8e07078ef..409ae060d 100644 --- a/src/core.js +++ b/src/core.js @@ -399,9 +399,14 @@ var PDFDocument = (function PDFDocumentClosure() { var length = this.stream.length; var linearization = false; if (length) { - linearization = new Linearization(this.stream); - if (linearization.length != length) - linearization = false; + try { + linearization = new Linearization(this.stream); + if (linearization.length != length) + linearization = false; + } catch (err) { + warn('The linearization data is not available ' + + 'or unreadable pdf data is found'); + } } // shadow the prototype getter with a data property return shadow(this, 'linearization', linearization); diff --git a/test/mozcentral/Makefile.in b/test/mozcentral/Makefile.in index 93ec187e2..ca686d1b4 100644 --- a/test/mozcentral/Makefile.in +++ b/test/mozcentral/Makefile.in @@ -9,13 +9,11 @@ VPATH = @srcdir@ relativesrcdir = browser/extensions/pdfjs/test include $(DEPTH)/config/autoconf.mk -include $(topsrcdir)/config/rules.mk -_BROWSER_TEST_FILES = \ +MOCHITEST_BROWSER_FILES = \ browser_pdfjs_main.js \ browser_pdfjs_savedialog.js \ file_pdfjs_test.pdf \ $(NULL) -libs:: $(_BROWSER_TEST_FILES) - $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir) +include $(topsrcdir)/config/rules.mk