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

Function canInspectWindow

src/iframe-helper.js:564–576  ·  view source on GitHub ↗
(win)

Source from the content-addressed store, hash-verified

562 * @return {boolean}
563 */
564export function canInspectWindow(win) {
565 // TODO: this is not reliable. The compiler assumes that property reads are
566 // side-effect free. The recommended fix is to use goog.reflect.sinkValue
567 // but since we're not using the closure library I'm not sure how to do this.
568 // See https://github.com/google/closure-compiler/issues/3156
569 try {
570 // win['test'] could be truthy but not true the compiler shouldn't be able
571 // to optimize this check away.
572 return !!win.location.href && (win['test'] || true);
573 } catch (unusedErr) {
574 return false;
575 }
576}
577
578/** @const {string} */
579export const FIE_EMBED_PROP = '__AMP_EMBED__';

Callers 4

constructorMethod · 0.90
constructorMethod · 0.90
getMeasureableFrameMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected