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

Disable remote HTML usage for AdSense Delayed Fetch #10180

Merged
merged 9 commits into from Jun 29, 2017
Merged

Disable remote HTML usage for AdSense Delayed Fetch #10180

merged 9 commits into from Jun 29, 2017

Conversation

keithwrightbos
Copy link
Contributor

Allow for configuring if network supports remote HTML usage via remoteHTMLDisabled option and enable for AdSense. Also ensure that Fast Fetch is allowed for such networks even if remote HTML is specified.

Copy link
Contributor

@bradfrizzell bradfrizzell left a comment

Choose a reason for hiding this comment

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

minor changes, otherwise lgtm

const meta = parentWindow.document
.querySelector('meta[name="amp-3p-iframe-src"]');
if (!meta) {
return null;
}
if (opt_disallowCustom) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should move this check above the previous one, so we don't do an unnecessary querySelector()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't because I want to warn if remote HTML is specified so either way I need the query selector

Copy link
Contributor

Choose a reason for hiding this comment

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

ah I see ok

@@ -229,7 +231,8 @@ export class AmpAd3PImpl extends AMP.BaseElement {
// incrementLoadingAds().
this.emitLifecycleEvent('adRequestStart');
const iframe = getIframe(this.element.ownerDocument.defaultView,
this.element, undefined, opt_context);
this.element, this.element.getAttribute('type'), opt_context,
Copy link
Contributor

Choose a reason for hiding this comment

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

this.element.getAttribute('type') gets called three times in this class. Can we store the type as an attribute directly on the class instead?

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

const meta = parentWindow.document
.querySelector('meta[name="amp-3p-iframe-src"]');
if (!meta) {
return null;
}
if (opt_disallowCustom) {
Copy link
Contributor

Choose a reason for hiding this comment

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

ah I see ok

@keithwrightbos keithwrightbos merged commit 443b0f3 into ampproject:master Jun 29, 2017
@keithwrightbos keithwrightbos deleted the adsense_remove_remote_html branch June 29, 2017 17:10
mrjoro pushed a commit to mrjoro/amphtml that referenced this pull request Jun 30, 2017
* Disable remote HTML usage for AdSense Delayed Fetch

* lint fixes

* lint fixes

* test fixes, PR feedback

* fix test failures

* test fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants