mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-22 16:05:56 +02:00
Don't duplicate the Jbig2Error exception
Let `src/core/jbig2_ccittFax_wasm.js` import the existing exception, rather than duplicate its code.
This commit is contained in:
parent
29362e6afb
commit
efa13c5e2a
@ -13,15 +13,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { BaseException, warn } from "../shared/util.js";
|
|
||||||
import { fetchBinaryData } from "./core_utils.js";
|
import { fetchBinaryData } from "./core_utils.js";
|
||||||
import JBig2 from "../../external/jbig2/jbig2.js";
|
import JBig2 from "../../external/jbig2/jbig2.js";
|
||||||
|
import { Jbig2Error } from "./jbig2.js";
|
||||||
class JBig2Error extends BaseException {
|
import { warn } from "../shared/util.js";
|
||||||
constructor(msg) {
|
|
||||||
super(msg, "Jbig2Error");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class JBig2CCITTFaxWasmImage {
|
class JBig2CCITTFaxWasmImage {
|
||||||
static #buffer = null;
|
static #buffer = null;
|
||||||
@ -87,7 +82,7 @@ class JBig2CCITTFaxWasmImage {
|
|||||||
}
|
}
|
||||||
const module = await this.#modulePromise;
|
const module = await this.#modulePromise;
|
||||||
if (!module) {
|
if (!module) {
|
||||||
throw new JBig2Error("JBig2 failed to initialize");
|
throw new Jbig2Error("JBig2 failed to initialize");
|
||||||
}
|
}
|
||||||
let ptr, globalsPtr;
|
let ptr, globalsPtr;
|
||||||
|
|
||||||
@ -118,7 +113,7 @@ class JBig2CCITTFaxWasmImage {
|
|||||||
module._jbig2_decode(ptr, size, width, height, globalsPtr, globalsSize);
|
module._jbig2_decode(ptr, size, width, height, globalsPtr, globalsSize);
|
||||||
}
|
}
|
||||||
if (!module.imageData) {
|
if (!module.imageData) {
|
||||||
throw new JBig2Error("Unknown error");
|
throw new Jbig2Error("Unknown error");
|
||||||
}
|
}
|
||||||
const { imageData } = module;
|
const { imageData } = module;
|
||||||
module.imageData = null;
|
module.imageData = null;
|
||||||
@ -139,4 +134,4 @@ class JBig2CCITTFaxWasmImage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { JBig2CCITTFaxWasmImage, JBig2Error };
|
export { JBig2CCITTFaxWasmImage };
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user