From 8bed073f209a178d73d0a04cc72df034993b0998 Mon Sep 17 00:00:00 2001 From: Noah I Date: Fri, 9 Nov 2018 23:14:32 +1100 Subject: [PATCH] 1102: Fix inpage listener syntax (#5708) (#5709) --- app/scripts/inpage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js index a7c0b0416..cfcf5e364 100644 --- a/app/scripts/inpage.js +++ b/app/scripts/inpage.js @@ -30,8 +30,8 @@ console.warn('ATTENTION: In an effort to improve user privacy, MetaMask ' + * @param {boolean} remove - removes this handler after being triggered */ function onMessage(messageType, handler, remove) { - window.addEventListener('message', function ({ data: { type } }) { - if (type !== messageType) { return } + window.addEventListener('message', function ({ data }) { + if (!data || data.type !== messageType) { return } remove && window.removeEventListener('message', handler) handler.apply(window, arguments) })