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.
This commit is contained in:
Rob Wu 2014-04-11 15:33:34 +02:00
parent 206db6f715
commit b64c06f68d

View File

@ -1941,6 +1941,28 @@ function webViewerInitialized() {
// return; // 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); // PDFView.open(file, 0);
//}); //});
//#endif //#endif