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

Function originMatches

src/iframe-video.js:30–38  ·  view source on GitHub ↗
(event, iframe, host)

Source from the content-addressed store, hash-verified

28 * @return {boolean}
29 */
30export function originMatches(event, iframe, host) {
31 if (!iframe || event.source != iframe.contentWindow) {
32 return false;
33 }
34 if (typeof host === 'string') {
35 return host == event.origin;
36 }
37 return host.test(event.origin);
38}
39
40/**
41 * Re-dispatches an event received from postMessage as an event in the host

Callers 9

onMessage_Method · 0.90
handleMowMessage_Method · 0.90
handleEvents_Method · 0.90
handleDelightMessage_Method · 0.90
handleYoutubeMessage_Method · 0.90
handleWistiaMessage_Method · 0.90
originMatches_Method · 0.90
handleBridMessage_Method · 0.90

Calls 1

testMethod · 0.45

Tested by

no test coverage detected