MCPcopy
hub / github.com/ampproject/amphtml / validateParentOrigin

Function validateParentOrigin

3p/integration-lib.js:205–219  ·  view source on GitHub ↗
(window, parentLocation)

Source from the content-addressed store, hash-verified

203 * @visibleForTesting
204 */
205export function validateParentOrigin(window, parentLocation) {
206 const ancestors = window.location.ancestorOrigins;
207 // Currently only webkit and blink based browsers support
208 // ancestorOrigins. In that case we proceed but mark the origin
209 // as non-validated.
210 if (!ancestors || !ancestors.length) {
211 return;
212 }
213 userAssert(
214 ancestors[0] == parentLocation.origin,
215 'Parent origin mismatch: %s, %s',
216 ancestors[0],
217 parentLocation.origin
218 );
219}
220
221/**
222 * Check that this iframe intended this particular ad type to run.

Callers 2

draw3pFunction · 0.85

Calls 1

userAssertFunction · 0.90

Tested by

no test coverage detected