Skip to content

Commit

Permalink
🐛 Don't assume window is always available for inabox. It can be alrea…
Browse files Browse the repository at this point in the history
…dy destroyed (#26265)

* Don't assume window is always available for inabox. It can be already destroyed.

* address comments
  • Loading branch information
lannka authored Jan 9, 2020
1 parent 689a9c7 commit 5bfb0e5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ads/inabox/position-observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ export class PositionObserver {
const parentWin = element.ownerDocument.defaultView;
for (
let j = 0, tempWin = parentWin;
j < 10 && tempWin != this.win_ && tempWin != this.win_.top;
j < 10 &&
// win can be null if the ad iframe is already destroyed
tempWin &&
tempWin != this.win_ &&
tempWin != this.win_.top;
j++, tempWin = tempWin.parent
) {
const parentFrameRect = layoutRectFromDomRect(
Expand Down

0 comments on commit 5bfb0e5

Please sign in to comment.