Merge pull request #16232 from Snuffleupagus/firefox-rm-linkService-baseUrl
[Firefox] Stop using a `baseUrl` in the `PDFLinkService` (PR 16153 follow-up)
This commit is contained in:
commit
b384d3bc24
19
web/app.js
19
web/app.js
@ -1174,20 +1174,17 @@ const PDFViewerApplication = {
|
|||||||
this.toolbar?.setPagesCount(pdfDocument.numPages, false);
|
this.toolbar?.setPagesCount(pdfDocument.numPages, false);
|
||||||
this.secondaryToolbar?.setPagesCount(pdfDocument.numPages);
|
this.secondaryToolbar?.setPagesCount(pdfDocument.numPages);
|
||||||
|
|
||||||
let baseDocumentUrl;
|
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("CHROME")) {
|
||||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
const baseUrl = location.href.split("#")[0];
|
||||||
baseDocumentUrl = null;
|
|
||||||
} else if (PDFJSDev.test("MOZCENTRAL")) {
|
|
||||||
baseDocumentUrl = this.baseUrl;
|
|
||||||
} else if (PDFJSDev.test("CHROME")) {
|
|
||||||
baseDocumentUrl = location.href.split("#")[0];
|
|
||||||
}
|
|
||||||
if (baseDocumentUrl && isDataScheme(baseDocumentUrl)) {
|
|
||||||
// Ignore "data:"-URLs for performance reasons, even though it may cause
|
// Ignore "data:"-URLs for performance reasons, even though it may cause
|
||||||
// internal links to not work perfectly in all cases (see bug 1803050).
|
// internal links to not work perfectly in all cases (see bug 1803050).
|
||||||
baseDocumentUrl = null;
|
this.pdfLinkService.setDocument(
|
||||||
|
pdfDocument,
|
||||||
|
isDataScheme(baseUrl) ? null : baseUrl
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.pdfLinkService.setDocument(pdfDocument);
|
||||||
}
|
}
|
||||||
this.pdfLinkService.setDocument(pdfDocument, baseDocumentUrl);
|
|
||||||
this.pdfDocumentProperties?.setDocument(pdfDocument);
|
this.pdfDocumentProperties?.setDocument(pdfDocument);
|
||||||
|
|
||||||
const pdfViewer = this.pdfViewer;
|
const pdfViewer = this.pdfViewer;
|
||||||
|
@ -336,7 +336,7 @@ class PDFLinkService {
|
|||||||
* @returns {string} The hyperlink to the PDF object.
|
* @returns {string} The hyperlink to the PDF object.
|
||||||
*/
|
*/
|
||||||
getAnchorUrl(anchor) {
|
getAnchorUrl(anchor) {
|
||||||
return (this.baseUrl || "") + anchor;
|
return this.baseUrl ? this.baseUrl + anchor : anchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user