[Pkg-javascript-commits] [pdf.js] 91/141: Work-around for filesystem:-URL bug (#4592).

David Prévot taffit at moszumanska.debian.org
Sat Apr 19 22:40:33 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit b64c06f68dbad004c4be55fefed77da2f853e101
Author: Rob Wu <gwnRob at gmail.com>
Date:   Fri Apr 11 15:33:34 2014 +0200

    Work-around for filesystem:-URL bug (#4592).
    
    Visit https://robwu.nl/pdfjs/filesystem-worker-bug.htm and follow the
    steps to verify that the extension works as intended with this patch.
---
 web/viewer.js | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/web/viewer.js b/web/viewer.js
index 7003d9c..2355c40 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -1941,6 +1941,28 @@ function webViewerInitialized() {
 //      return;
 //    }
 //  }
+//  if (/^filesystem:/.test(file) && !PDFJS.disableWorker) {
+//    // The security origin of filesystem:-URLs are not preserved when the URL
+//    // is passed to a Web worker, (http://crbug.com/362061), so we have to
+//    // create an intermediate blob:-URL as a work-around.
+//    var resolveLocalFileSystemURL = window.resolveLocalFileSystemURL ||
+//                                    window.webkitResolveLocalFileSystemURL;
+//    resolveLocalFileSystemURL(file, function onFileSystemSuccess(fileEntry) {
+//      fileEntry.file(function(fileObject) {
+//        var blobUrl = URL.createObjectURL(fileObject);
+//        PDFView.open(blobUrl, 0, undefined, undefined, {
+//          length: fileObject.size
+//        });
+//      });
+//    }, function onFileSystemError(error) {
+//      // This should not happen. When it happens, just fall back to the normal
+//      // way of getting the File's data (via the Web worker).
+//      console.warn('Cannot resolve file ' + file + ', ' + error.name + ' ' +
+//                   error.message);
+//      PDFView.open(file, 0);
+//    });
+//    return;
+//  }
 //  PDFView.open(file, 0);
 //});
 //#endif

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list