From 60adbdc2eb37cd592ec756268bfbb43766257442 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Wed, 17 Jul 2019 09:42:04 +0100 Subject: [PATCH] Remove logging of origin mismatch --- src/ScalarMessaging.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ScalarMessaging.js b/src/ScalarMessaging.js index 5cc187268a..8b87650929 100644 --- a/src/ScalarMessaging.js +++ b/src/ScalarMessaging.js @@ -557,20 +557,18 @@ const onMessage = function(event) { try { eventOriginUrl = new URL(event.origin); } catch (e) { - console.warn(`Message from IM with unparsable origin ${event.origin} ignored`); - return; - } - if (configUrl.origin !== eventOriginUrl.origin) { - console.warn(`Message from IM with invalid origin ${event.origin} ignored`); return; } // TODO -- Scalar postMessage API should be namespaced with event.data.api field // Fix following "if" statement to respond only to specific API messages. if ( + configUrl.origin !== eventOriginUrl.origin || !event.data.action || event.data.api // Ignore messages with specific API set ) { - return; // don't log this - debugging APIs like to spam postMessage which floods the log otherwise + // don't log this - debugging APIs and browser add-ons like to spam + // postMessage which floods the log otherwise + return; } if (event.data.action === "close_scalar") {