From 8bc1ef4c9cbd01b4db9b7af37b945ba9dc80f02b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Sanz=20Garc=C3=ADa?= Date: Tue, 2 Nov 2021 11:30:43 +0100 Subject: [PATCH] Avoid crashes if postMessage data is `null` axe-core crashes if another process sends a `window.postMessage` with data equals to `null`. In the previous version, because `null` has a type of `'object'`, it crashed when trying to access the `channelId` on `null`. --- lib/core/utils/frame-messenger/message-parser.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/core/utils/frame-messenger/message-parser.js b/lib/core/utils/frame-messenger/message-parser.js index 65aea70f41..c7154f8e38 100644 --- a/lib/core/utils/frame-messenger/message-parser.js +++ b/lib/core/utils/frame-messenger/message-parser.js @@ -67,6 +67,7 @@ export function parseMessage(dataString) { */ function isRespondableMessage(postedMessage) { return ( + postedMessage !== null && typeof postedMessage === 'object' && typeof postedMessage.channelId === 'string' && postedMessage.source === getSource()