diff --git a/src/lib/sandbox/read-main-platform.ts b/src/lib/sandbox/read-main-platform.ts index bc4c85f1..3e6d3a36 100644 --- a/src/lib/sandbox/read-main-platform.ts +++ b/src/lib/sandbox/read-main-platform.ts @@ -93,11 +93,11 @@ const readImplementations = (impls: any[], interfaces: InterfaceInfo[]) => { const impl = implData[0]; const interfaceType: InterfaceType = implData[1] as any; const cstrName = getConstructorName(impl); - const CstrPrototype = (mainWindow as any)[cstrName].prototype; + const CstrPrototype = cstrName === 'History' ? History.prototype : (mainWindow as any)[cstrName].prototype; return [cstrName, CstrPrototype, impl, interfaceType]; - }); - - cstrImpls.map(([cstrName, CstrPrototype, impl, intefaceType]) => + }); + + cstrImpls.filter(([cstrName, CstrPrototype, impl, intefaceType])=> !!CstrPrototype).map(([cstrName, CstrPrototype, impl, intefaceType]) => readOwnImplementation(cstrs, interfaces, cstrName, CstrPrototype, impl, intefaceType) ); @@ -121,7 +121,7 @@ const readOwnImplementation = ( impl: any, interfaceType: InterfaceType ) => { - if (!cstrs.has(cstrName)) { + if (!cstrs.has(cstrName) && CstrPrototype) { cstrs.add(cstrName); const SuperCstr = Object.getPrototypeOf(CstrPrototype); const superCstrName = getConstructorName(SuperCstr); diff --git a/src/lib/web-worker/worker-forwarded-trigger.ts b/src/lib/web-worker/worker-forwarded-trigger.ts index 86d89e3f..58330d9e 100644 --- a/src/lib/web-worker/worker-forwarded-trigger.ts +++ b/src/lib/web-worker/worker-forwarded-trigger.ts @@ -18,7 +18,7 @@ export const workerForwardedTriggerHandle = ({ if (i + 1 < l) { target = target[$forward$[i]]; } else { - target[$forward$[i]].apply(target, deserializeFromMain(null, $winId$, [], $args$)); + target[$forward$[i]]?.apply(target, deserializeFromMain(null, $winId$, [], $args$)); } } } catch (e) {