Use a limit when splitting URL-strings in web/app.js
This should be a *tiny* bit more efficient, since it avoids parsing substrings that we don't care about.
This commit is contained in:
parent
e20dabb65b
commit
84aaafcd3e
@ -870,10 +870,10 @@ const PDFViewerApplication = {
|
|||||||
|
|
||||||
setTitleUsingUrl(url = "", downloadUrl = null) {
|
setTitleUsingUrl(url = "", downloadUrl = null) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.baseUrl = url.split("#")[0];
|
this.baseUrl = url.split("#", 1)[0];
|
||||||
if (downloadUrl) {
|
if (downloadUrl) {
|
||||||
this._downloadUrl =
|
this._downloadUrl =
|
||||||
downloadUrl === url ? this.baseUrl : downloadUrl.split("#")[0];
|
downloadUrl === url ? this.baseUrl : downloadUrl.split("#", 1)[0];
|
||||||
}
|
}
|
||||||
if (isDataScheme(url)) {
|
if (isDataScheme(url)) {
|
||||||
this._hideViewBookmark();
|
this._hideViewBookmark();
|
||||||
@ -1023,7 +1023,7 @@ const PDFViewerApplication = {
|
|||||||
// Always set `docBaseUrl` in development mode, and in the (various)
|
// Always set `docBaseUrl` in development mode, and in the (various)
|
||||||
// extension builds.
|
// extension builds.
|
||||||
if (typeof PDFJSDev === "undefined") {
|
if (typeof PDFJSDev === "undefined") {
|
||||||
AppOptions.set("docBaseUrl", document.URL.split("#")[0]);
|
AppOptions.set("docBaseUrl", document.URL.split("#", 1)[0]);
|
||||||
} else if (PDFJSDev.test("MOZCENTRAL || CHROME")) {
|
} else if (PDFJSDev.test("MOZCENTRAL || CHROME")) {
|
||||||
AppOptions.set("docBaseUrl", this.baseUrl);
|
AppOptions.set("docBaseUrl", this.baseUrl);
|
||||||
}
|
}
|
||||||
@ -1252,7 +1252,7 @@ const PDFViewerApplication = {
|
|||||||
this.secondaryToolbar?.setPagesCount(pdfDocument.numPages);
|
this.secondaryToolbar?.setPagesCount(pdfDocument.numPages);
|
||||||
|
|
||||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("CHROME")) {
|
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("CHROME")) {
|
||||||
const baseUrl = location.href.split("#")[0];
|
const baseUrl = location.href.split("#", 1)[0];
|
||||||
// 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).
|
||||||
this.pdfLinkService.setDocument(
|
this.pdfLinkService.setDocument(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user