Remove logging of origin mismatch
This commit is contained in:
parent
d57a0dec64
commit
60adbdc2eb
1 changed files with 4 additions and 6 deletions
|
@ -557,20 +557,18 @@ const onMessage = function(event) {
|
||||||
try {
|
try {
|
||||||
eventOriginUrl = new URL(event.origin);
|
eventOriginUrl = new URL(event.origin);
|
||||||
} catch (e) {
|
} 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;
|
return;
|
||||||
}
|
}
|
||||||
// TODO -- Scalar postMessage API should be namespaced with event.data.api field
|
// TODO -- Scalar postMessage API should be namespaced with event.data.api field
|
||||||
// Fix following "if" statement to respond only to specific API messages.
|
// Fix following "if" statement to respond only to specific API messages.
|
||||||
if (
|
if (
|
||||||
|
configUrl.origin !== eventOriginUrl.origin ||
|
||||||
!event.data.action ||
|
!event.data.action ||
|
||||||
event.data.api // Ignore messages with specific API set
|
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") {
|
if (event.data.action === "close_scalar") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue