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

Function generateSentinel

src/3p-frame.js:408–414  ·  view source on GitHub ↗
(parentWindow)

Source from the content-addressed store, hash-verified

406 * @visibleForTesting
407 */
408export function generateSentinel(parentWindow) {
409 let windowDepth = 0;
410 for (let win = parentWindow; win && win != win.parent; win = win.parent) {
411 windowDepth++;
412 }
413 return String(windowDepth) + '-' + getRandom(parentWindow);
414}
415
416/**
417 * Resets the count of each 3p frame type

Callers 4

ProxyIframeEmbedWithRefFunction · 0.90
constructorMethod · 0.90
getFrameAttributesFunction · 0.85

Calls 2

getRandomFunction · 0.70
StringFunction · 0.50

Tested by

no test coverage detected