Merge pull request #13157 from Snuffleupagus/webViewerOpenFileViaURL-cleanup
Remove the `file://`-URL special-case from `webViewerOpenFileViaURL`
This commit is contained in:
commit
70915d34ed
30
web/app.js
30
web/app.js
@ -2274,39 +2274,19 @@ function webViewerInitialized() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let webViewerOpenFileViaURL;
|
function webViewerOpenFileViaURL(file) {
|
||||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||||
webViewerOpenFileViaURL = function (file) {
|
|
||||||
if (file && file.lastIndexOf("file:", 0) === 0) {
|
|
||||||
// file:-scheme. Load the contents in the main thread because QtWebKit
|
|
||||||
// cannot load file:-URLs in a Web Worker. file:-URLs are usually loaded
|
|
||||||
// very quickly, so there is no need to set up progress event listeners.
|
|
||||||
PDFViewerApplication.setTitleUsingUrl(file);
|
|
||||||
const xhr = new XMLHttpRequest();
|
|
||||||
xhr.onload = function () {
|
|
||||||
PDFViewerApplication.open(new Uint8Array(xhr.response));
|
|
||||||
};
|
|
||||||
xhr.open("GET", file);
|
|
||||||
xhr.responseType = "arraybuffer";
|
|
||||||
xhr.send();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
PDFViewerApplication.open(file);
|
PDFViewerApplication.open(file);
|
||||||
}
|
}
|
||||||
};
|
} else if (PDFJSDev.test("MOZCENTRAL || CHROME")) {
|
||||||
} else if (PDFJSDev.test("MOZCENTRAL || CHROME")) {
|
|
||||||
webViewerOpenFileViaURL = function (file) {
|
|
||||||
PDFViewerApplication.setTitleUsingUrl(file);
|
PDFViewerApplication.setTitleUsingUrl(file);
|
||||||
PDFViewerApplication.initPassiveLoading();
|
PDFViewerApplication.initPassiveLoading();
|
||||||
};
|
} else {
|
||||||
} else {
|
|
||||||
webViewerOpenFileViaURL = function (file) {
|
|
||||||
if (file) {
|
if (file) {
|
||||||
throw new Error("Not implemented: webViewerOpenFileViaURL");
|
throw new Error("Not implemented: webViewerOpenFileViaURL");
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function webViewerResetPermissions() {
|
function webViewerResetPermissions() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user