fix: verify run path with 50ms screenshots
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { createLinuxCncInterpreterRuntime } from "./linuxcnc-interpreter-runtime.js";
|
||||
|
||||
installTextDecoderResizableArrayBufferCompat();
|
||||
|
||||
let runtime = null;
|
||||
|
||||
self.addEventListener("message", async (event) => {
|
||||
@@ -47,3 +49,28 @@ self.addEventListener("message", async (event) => {
|
||||
function postSuccess(id, value) {
|
||||
self.postMessage({ id, ok: true, value });
|
||||
}
|
||||
|
||||
function installTextDecoderResizableArrayBufferCompat() {
|
||||
const decoderPrototype = globalThis.TextDecoder?.prototype;
|
||||
if (!decoderPrototype || decoderPrototype.__webRtcpResizableArrayBufferCompat) return;
|
||||
const nativeDecode = decoderPrototype.decode;
|
||||
Object.defineProperty(decoderPrototype, "__webRtcpResizableArrayBufferCompat", {
|
||||
value: true,
|
||||
configurable: false,
|
||||
});
|
||||
decoderPrototype.decode = function decodeResizableArrayBufferCompat(input, options) {
|
||||
try {
|
||||
return nativeDecode.call(this, input, options);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
if (!message.includes("resizable")) throw error;
|
||||
if (input?.buffer) {
|
||||
return nativeDecode.call(this, Uint8Array.from(input), options);
|
||||
}
|
||||
if (input instanceof ArrayBuffer) {
|
||||
return nativeDecode.call(this, Uint8Array.from(new Uint8Array(input)), options);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { createLinuxCncKinematicsRuntime } from "./linuxcnc-kinematics-runtime.js";
|
||||
|
||||
installTextDecoderResizableArrayBufferCompat();
|
||||
|
||||
let runtime = null;
|
||||
|
||||
self.addEventListener("message", async (event) => {
|
||||
@@ -64,3 +66,28 @@ self.addEventListener("message", async (event) => {
|
||||
function postSuccess(id, value) {
|
||||
self.postMessage({ id, ok: true, value });
|
||||
}
|
||||
|
||||
function installTextDecoderResizableArrayBufferCompat() {
|
||||
const decoderPrototype = globalThis.TextDecoder?.prototype;
|
||||
if (!decoderPrototype || decoderPrototype.__webRtcpResizableArrayBufferCompat) return;
|
||||
const nativeDecode = decoderPrototype.decode;
|
||||
Object.defineProperty(decoderPrototype, "__webRtcpResizableArrayBufferCompat", {
|
||||
value: true,
|
||||
configurable: false,
|
||||
});
|
||||
decoderPrototype.decode = function decodeResizableArrayBufferCompat(input, options) {
|
||||
try {
|
||||
return nativeDecode.call(this, input, options);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
if (!message.includes("resizable")) throw error;
|
||||
if (input?.buffer) {
|
||||
return nativeDecode.call(this, Uint8Array.from(input), options);
|
||||
}
|
||||
if (input instanceof ArrayBuffer) {
|
||||
return nativeDecode.call(this, Uint8Array.from(new Uint8Array(input)), options);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { createLinuxCncTaskHalRuntime } from "./linuxcnc-task-hal-runtime.js";
|
||||
|
||||
installTextDecoderResizableArrayBufferCompat();
|
||||
|
||||
let runtime = null;
|
||||
|
||||
self.addEventListener("message", async (event) => {
|
||||
@@ -61,3 +63,28 @@ function assertRuntime() {
|
||||
throw new Error("LinuxCNC task/HAL worker runtime is not initialized");
|
||||
}
|
||||
}
|
||||
|
||||
function installTextDecoderResizableArrayBufferCompat() {
|
||||
const decoderPrototype = globalThis.TextDecoder?.prototype;
|
||||
if (!decoderPrototype || decoderPrototype.__webRtcpResizableArrayBufferCompat) return;
|
||||
const nativeDecode = decoderPrototype.decode;
|
||||
Object.defineProperty(decoderPrototype, "__webRtcpResizableArrayBufferCompat", {
|
||||
value: true,
|
||||
configurable: false,
|
||||
});
|
||||
decoderPrototype.decode = function decodeResizableArrayBufferCompat(input, options) {
|
||||
try {
|
||||
return nativeDecode.call(this, input, options);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
if (!message.includes("resizable")) throw error;
|
||||
if (input?.buffer) {
|
||||
return nativeDecode.call(this, Uint8Array.from(input), options);
|
||||
}
|
||||
if (input instanceof ArrayBuffer) {
|
||||
return nativeDecode.call(this, Uint8Array.from(new Uint8Array(input)), options);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user