Skip to content

Commit

Permalink
Fix local amp-ad tests that fail due to timing. (#3710)
Browse files Browse the repository at this point in the history
Related to #3709
  • Loading branch information
cramforce authored Jun 22, 2016
1 parent d150193 commit e5b0f33
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion extensions/amp-ad/0.1/amp-ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,21 @@ class AmpAd extends AMP.BaseElement {
* anyway.
*/
isPositionFixed() {
const win = this.getWin();
// TODO(@cramforce): Figure out why test comes here with the window
// removed. This is somehow related to the resource framework running
// on a timer that is not bound to the lifetime of the iframe.
// See https://github.com/ampproject/amphtml/issues/3709
if (!win) {
return false;
}
let el = this.element;
let hasFixedAncestor = false;
do {
if (POSITION_FIXED_TAG_WHITELIST[el.tagName]) {
return false;
}
if (this.getWin()/*because only called from onLayoutMeasure */
if (win/*because only called from onLayoutMeasure */
./*OK*/getComputedStyle(el).position == 'fixed') {
// Because certain blessed elements may contain a position fixed
// container (which contain an ad), we continue to search the
Expand Down

0 comments on commit e5b0f33

Please sign in to comment.