Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DOMFilterFactory.#createUrl in MOZCENTRAL builds (18417 PR follow-up) #18430

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions src/display/display_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,20 @@ class DOMFilterFactory extends BaseFilterFactory {
}

#createUrl(id) {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
if (this.#baseUrl === undefined) {
const url = this.#document.URL;
if (url === this.#document.baseURI) {
// No `<base>`-element present, hence a relative URL should work.
this.#baseUrl = "";
} else if (isDataScheme(url)) {
if (this.#baseUrl === undefined) {
// Unless a `<base>`-element is present a relative URL should work.
this.#baseUrl = "";

const url = this.#document.URL;
if (url !== this.#document.baseURI) {
if (isDataScheme(url)) {
warn('#createUrl: ignore "data:"-URL for performance reasons.');
this.#baseUrl = "";
} else {
this.#baseUrl = url.split("#", 1)[0];
}
}
return `url(${this.#baseUrl}#${id})`;
}
return `url(${id})`;
return `url(${this.#baseUrl}#${id})`;
}

addFilter(maps) {
Expand Down