From 0eda7fa899e9405eec46fa55cf8ea986d1b14484 Mon Sep 17 00:00:00 2001 From: Quentin Jaccarino Date: Wed, 6 Dec 2023 15:51:21 +0100 Subject: [PATCH] fix: WindowMessageTransport accepts same origin messages (#273) In order to support browserViews in electron --- .changeset/tidy-berries-wave.md | 7 +++++++ packages/core/src/transports/WindowMessageTransport.ts | 6 +----- 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 .changeset/tidy-berries-wave.md diff --git a/.changeset/tidy-berries-wave.md b/.changeset/tidy-berries-wave.md new file mode 100644 index 00000000..2d87a248 --- /dev/null +++ b/.changeset/tidy-berries-wave.md @@ -0,0 +1,7 @@ +--- +"@ledgerhq/wallet-api-core": patch +--- + +fix: WindowMessageTransport accepts same origin messages + +In order to support browserViews in electron diff --git a/packages/core/src/transports/WindowMessageTransport.ts b/packages/core/src/transports/WindowMessageTransport.ts index 561f5eec..acac186b 100644 --- a/packages/core/src/transports/WindowMessageTransport.ts +++ b/packages/core/src/transports/WindowMessageTransport.ts @@ -40,11 +40,7 @@ export default class WindowMessageTransport implements Transport { _onMessageEvent = (event: MessageEvent): void => { if (this._onMessage) { this.logger.debug("received message event", event); - if ( - event.origin !== this.target.location.origin && - event.data && - typeof event.data === "string" - ) { + if (event.data && typeof event.data === "string") { try { const message = event.data;