Merge pull request #20931 from Snuffleupagus/rm-factory-name-validation

Remove explicit `name`/`filename` validation in the `BaseCMapReaderFactory`, `BaseStandardFontDataFactory`, and `BaseWasmFactory` classes
This commit is contained in:
Tim van der Meij 2026-03-20 20:15:23 +01:00 committed by GitHub
commit ab228da9ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 2 additions and 13 deletions

View File

@ -34,17 +34,12 @@ class BaseCMapReaderFactory {
"Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided."
);
}
if (!name) {
throw new Error("CMap name must be specified.");
}
const url = this.baseUrl + name + (this.isCompressed ? ".bcmap" : "");
return this._fetch(url)
.then(cMapData => ({ cMapData, isCompressed: this.isCompressed }))
.catch(reason => {
throw new Error(
`Unable to load ${this.isCompressed ? "binary " : ""}CMap at: ${url}`
);
throw new Error(`Unable to load CMap data at: ${url}`);
});
}

View File

@ -33,9 +33,6 @@ class BaseStandardFontDataFactory {
"Ensure that the `standardFontDataUrl` API parameter is provided."
);
}
if (!filename) {
throw new Error("Font filename must be specified.");
}
const url = `${this.baseUrl}${filename}`;
return this._fetch(url).catch(reason => {

View File

@ -31,9 +31,6 @@ class BaseWasmFactory {
if (!this.baseUrl) {
throw new Error("Ensure that the `wasmUrl` API parameter is provided.");
}
if (!filename) {
throw new Error("Wasm filename must be specified.");
}
const url = `${this.baseUrl}${filename}`;
return this._fetch(url).catch(reason => {

View File

@ -247,7 +247,7 @@ describe("cmap", function () {
} catch (reason) {
expect(reason).toBeInstanceOf(Error);
const message = reason.message;
expect(message.startsWith("Unable to load CMap at: ")).toEqual(true);
expect(message.startsWith("Unable to load CMap data at: ")).toEqual(true);
expect(message.endsWith("/external/bcmaps/Adobe-Japan1-1")).toEqual(true);
}
});