Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Xavier Fung 2012-07-14 22:08:55 +08:00
commit 8be359f360
4 changed files with 13 additions and 12 deletions

View File

@ -132,16 +132,13 @@ ChromeActions.prototype = {
var originalUrl = data.originalUrl; var originalUrl = data.originalUrl;
// The data may not be downloaded so we need just retry getting the pdf with // The data may not be downloaded so we need just retry getting the pdf with
// the original url. // the original url.
var blobUrl = data.blobUrl || originalUrl; var originalUri = NetUtil.newURI(data.originalUrl);
var originalUri = NetUtil.newURI(originalUrl); var blobUri = data.blobUrl ? NetUtil.newURI(data.blobUrl) : originalUri;
var blobUri = NetUtil.newURI(blobUrl);
var extHelperAppSvc = var extHelperAppSvc =
Cc['@mozilla.org/uriloader/external-helper-app-service;1']. Cc['@mozilla.org/uriloader/external-helper-app-service;1'].
getService(Ci.nsIExternalHelperAppService); getService(Ci.nsIExternalHelperAppService);
var frontWindow = Cc['@mozilla.org/embedcomp/window-watcher;1']. var frontWindow = Cc['@mozilla.org/embedcomp/window-watcher;1'].
getService(Ci.nsIWindowWatcher).activeWindow; getService(Ci.nsIWindowWatcher).activeWindow;
var ioService = Services.io;
var channel = ioService.newChannel(originalUrl, null, null);
NetUtil.asyncFetch(blobUri, function(aInputStream, aResult) { NetUtil.asyncFetch(blobUri, function(aInputStream, aResult) {
if (!Components.isSuccessCode(aResult)) { if (!Components.isSuccessCode(aResult)) {

View File

@ -1,3 +1,4 @@
# Chrome notification bar messages and buttons # Chrome notification bar messages and buttons
unsupported_feature=This PDF document might not be displayed correctly. unsupported_feature=This PDF document might not be displayed correctly.
open_with_different_viewer=Open With Different Viewer open_with_different_viewer=Open With Different Viewer
open_with_different_viewer.accessKey=o

View File

@ -399,9 +399,14 @@ var PDFDocument = (function PDFDocumentClosure() {
var length = this.stream.length; var length = this.stream.length;
var linearization = false; var linearization = false;
if (length) { if (length) {
linearization = new Linearization(this.stream); try {
if (linearization.length != length) linearization = new Linearization(this.stream);
linearization = false; 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 // shadow the prototype getter with a data property
return shadow(this, 'linearization', linearization); return shadow(this, 'linearization', linearization);

View File

@ -9,13 +9,11 @@ VPATH = @srcdir@
relativesrcdir = browser/extensions/pdfjs/test relativesrcdir = browser/extensions/pdfjs/test
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_BROWSER_TEST_FILES = \ MOCHITEST_BROWSER_FILES = \
browser_pdfjs_main.js \ browser_pdfjs_main.js \
browser_pdfjs_savedialog.js \ browser_pdfjs_savedialog.js \
file_pdfjs_test.pdf \ file_pdfjs_test.pdf \
$(NULL) $(NULL)
libs:: $(_BROWSER_TEST_FILES) include $(topsrcdir)/config/rules.mk
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)