New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amp-ad-exit / amp-analytics transport frame integration improperly referencing win.top #16587
Amp-ad-exit / amp-analytics transport frame integration improperly referencing win.top #16587
Conversation
…ferencing win.top
@@ -314,7 +315,7 @@ export class AmpAdExit extends AMP.BaseElement { | |||
* @private | |||
*/ | |||
getAmpAdResourceId_() { | |||
return getAmpAdResourceId(this.element, this.win.top); | |||
return getAmpAdResourceId(this.element, getTopWindow(this.win)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Codecov Report
@@ Coverage Diff @@
## master #16587 +/- ##
==========================================
+ Coverage 78.06% 78.07% +0.01%
==========================================
Files 551 551
Lines 40318 40318
==========================================
+ Hits 31474 31480 +6
+ Misses 8844 8838 -6
Continue to review full report at Codecov.
|
|
||
it('getAmpAdResourceId_ should reference AMP top window', () => { | ||
const frame = win.document.createElement('iframe'); | ||
win.document.body. appendChild(frame); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove space in between body.
and appendChild
Causes breakage when AMP page is not at window.top (e.g. when within the viewer). Fix is to reference src/service#getTopWindow