From aac5e12d177291d112f45b41e2b4c86080b22c10 Mon Sep 17 00:00:00 2001 From: DecentM Date: Wed, 14 Feb 2018 11:04:19 +0100 Subject: [PATCH] fix: validate event origin from allowedOrigins in loop --- content/install-hook-openusercss.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/content/install-hook-openusercss.js b/content/install-hook-openusercss.js index 70e74a19..e9699073 100644 --- a/content/install-hook-openusercss.js +++ b/content/install-hook-openusercss.js @@ -8,11 +8,9 @@ ]; const sendPostMessage = message => { - allowedOrigins.forEach(origin => { - if (origin === location.origin) { - window.postMessage(message, origin); - } - }); + if (allowedOrigins.includes(location.origin)) { + window.postMessage(message, location.origin); + } }; const askHandshake = () => {