diff --git a/extensions/amp-iframe/1.0/component.js b/extensions/amp-iframe/1.0/component.js index a1a6e2561ebc1..c5c567cb1bee7 100644 --- a/extensions/amp-iframe/1.0/component.js +++ b/extensions/amp-iframe/1.0/component.js @@ -72,7 +72,9 @@ export function BentoIframe({ useEffect(() => { const iframe = iframeRef.current; - if (!iframe) { + // TODO(36239): Ensure that effects are properly isolated between test runs. + // Guarding for iframe truthiness should be enough. + if (!iframe?.ownerDocument.defaultView) { return; } const win = toWin(iframe.ownerDocument.defaultView);