Skip to content

Commit ab228da

Browse files
Merge pull request #20931 from Snuffleupagus/rm-factory-name-validation
Remove explicit `name`/`filename` validation in the `BaseCMapReaderFactory`, `BaseStandardFontDataFactory`, and `BaseWasmFactory` classes
2 parents 0dd1556 + 5299eb2 commit ab228da

4 files changed

Lines changed: 2 additions & 13 deletions

File tree

src/display/cmap_reader_factory.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,12 @@ class BaseCMapReaderFactory {
3434
"Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided."
3535
);
3636
}
37-
if (!name) {
38-
throw new Error("CMap name must be specified.");
39-
}
4037
const url = this.baseUrl + name + (this.isCompressed ? ".bcmap" : "");
4138

4239
return this._fetch(url)
4340
.then(cMapData => ({ cMapData, isCompressed: this.isCompressed }))
4441
.catch(reason => {
45-
throw new Error(
46-
`Unable to load ${this.isCompressed ? "binary " : ""}CMap at: ${url}`
47-
);
42+
throw new Error(`Unable to load CMap data at: ${url}`);
4843
});
4944
}
5045

src/display/standard_fontdata_factory.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ class BaseStandardFontDataFactory {
3333
"Ensure that the `standardFontDataUrl` API parameter is provided."
3434
);
3535
}
36-
if (!filename) {
37-
throw new Error("Font filename must be specified.");
38-
}
3936
const url = `${this.baseUrl}${filename}`;
4037

4138
return this._fetch(url).catch(reason => {

src/display/wasm_factory.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ class BaseWasmFactory {
3131
if (!this.baseUrl) {
3232
throw new Error("Ensure that the `wasmUrl` API parameter is provided.");
3333
}
34-
if (!filename) {
35-
throw new Error("Wasm filename must be specified.");
36-
}
3734
const url = `${this.baseUrl}${filename}`;
3835

3936
return this._fetch(url).catch(reason => {

test/unit/cmap_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ describe("cmap", function () {
247247
} catch (reason) {
248248
expect(reason).toBeInstanceOf(Error);
249249
const message = reason.message;
250-
expect(message.startsWith("Unable to load CMap at: ")).toEqual(true);
250+
expect(message.startsWith("Unable to load CMap data at: ")).toEqual(true);
251251
expect(message.endsWith("/external/bcmaps/Adobe-Japan1-1")).toEqual(true);
252252
}
253253
});

0 commit comments

Comments
 (0)