MCPcopy Create free account
hub / github.com/ampproject/amphtml / validateMessage

Function validateMessage

ads/inabox/inabox-host.js:95–105  ·  view source on GitHub ↗

* Validates a message event and print errors if it does not contain expected * fields. * * @param {!Event} message * @return {boolean} if the message is valid or not

(message)

Source from the content-addressed store, hash-verified

93 * @return {boolean} if the message is valid or not
94 */
95function validateMessage(message) {
96 const valid = !!(message.source && message.source.postMessage);
97 if (!valid) {
98 user().warn(
99 TAG,
100 'Ignoring an inabox message. Likely the requester iframe has been removed. message.data=' +
101 JSON.stringify(getData(message))
102 );
103 }
104 return valid;
105}
106
107new InaboxHost(self);

Callers 1

constructorMethod · 0.85

Calls 4

userFunction · 0.90
getDataFunction · 0.90
warnMethod · 0.80
stringifyMethod · 0.80

Tested by

no test coverage detected