Skip to content
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

Merged

Conversation

keithwrightbos
Copy link
Contributor

Causes breakage when AMP page is not at window.top (e.g. when within the viewer). Fix is to reference src/service#getTopWindow

@@ -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));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@codecov-io
Copy link

codecov-io commented Jul 6, 2018

Codecov Report

Merging #16587 into master will increase coverage by 0.01%.
The diff coverage is 100%.

@@            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
Flag Coverage Δ
#integration_tests 35.16% <ø> (ø) ⬆️
#unit_tests 77.15% <100%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bf20b85...4415836. Read the comment docs.


it('getAmpAdResourceId_ should reference AMP top window', () => {
const frame = win.document.createElement('iframe');
win.document.body. appendChild(frame);
Copy link
Contributor

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

@keithwrightbos keithwrightbos merged commit 92d3b25 into ampproject:master Jul 6, 2018
@keithwrightbos keithwrightbos deleted the 3p_frame_amp_analytics_fix branch July 6, 2018 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants