mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add check to verify data in IPC related tests
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
13ba8dea84
commit
09e76e2518
@ -7,6 +7,7 @@ import enlistMessageChannelListenerInjectableInRenderer from "../../renderer/uti
|
|||||||
import type { DiContainer } from "@ogre-tools/injectable";
|
import type { DiContainer } from "@ogre-tools/injectable";
|
||||||
import { getOrInsert, getOrInsertSet } from "../../common/utils";
|
import { getOrInsert, getOrInsertSet } from "../../common/utils";
|
||||||
import type { SendToViewArgs } from "../../main/start-main-application/lens-window/application-window/create-lens-window.injectable";
|
import type { SendToViewArgs } from "../../main/start-main-application/lens-window/application-window/create-lens-window.injectable";
|
||||||
|
import { deserialize, serialize } from "v8";
|
||||||
|
|
||||||
type ListenerSet = Set<MessageChannelListener<any>>;
|
type ListenerSet = Set<MessageChannelListener<any>>;
|
||||||
type WindowListenerMap = Map<string, ListenerSet>;
|
type WindowListenerMap = Map<string, ListenerSet>;
|
||||||
@ -50,6 +51,12 @@ export const overrideMessagingFromMainToWindow = (): OverriddenWindowMessaging =
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
sendToWindow: (windowId, { channel, data, frameInfo }) => {
|
sendToWindow: (windowId, { channel, data, frameInfo }) => {
|
||||||
|
try {
|
||||||
|
data = deserialize(serialize(data));
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error("Tried to send data that is not compatible with StructuredClone");
|
||||||
|
}
|
||||||
|
|
||||||
const windowListeners = getWindowListeners(channel, windowId);
|
const windowListeners = getWindowListeners(channel, windowId);
|
||||||
|
|
||||||
if (frameInfo) {
|
if (frameInfo) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user