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

Fast Fetch, non-AMP creatives remove remove load promise requirement for removing loader #9056

Merged
merged 10 commits into from May 2, 2017
Merged

Fast Fetch, non-AMP creatives remove remove load promise requirement for removing loader #9056

merged 10 commits into from May 2, 2017

Conversation

keithwrightbos
Copy link
Contributor

Fast Fetch, non-AMP creatives require load before loading message is removed. This does not meet parity with delayed fetch that uses either bootstrap-loaded or render-start messages both of which serve to indicate ad tag has executed (and for render-start gotten an ad response). Given Fast Fetch does not write the xdomain frame until both of those have occurred, no need to wait.

cc/ @ampproject/a4a

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.

lgtm

this.baseInstance_.emitLifecycleEvent('adSlotUnhidden');
}
return Promise.resolve();
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to have this as an else block, as the if block returns.

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

@keithwrightbos keithwrightbos requested a review from zhouyx May 1, 2017 13:24
@keithwrightbos
Copy link
Contributor Author

@lannka or @zhouyx mind taking a look before I merge? Thanks

@@ -96,6 +96,8 @@ export class AmpAdXOriginIframeHandler {
this.element_.creativeId = info.data.id;
});

// TODO(keithwrightbos) - move to within not A4A else block to ensure this
Copy link
Contributor

Choose a reason for hiding this comment

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

this API should be available to both fast fetch and delayed fetch, right? why is the TODO?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO is because getHTML is arguably only for ad tags. For Fast fetch, no ad tag executes so no need to expose

// bootstrap-loaded to indicate ad request was sent, either way we know
// that occurred for Fast Fetch.
this.element_.appendChild(this.iframe);
return Promise.resolve();
Copy link
Contributor

Choose a reason for hiding this comment

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

I commented on the thread. This is not ideal. layoutCallback should return the promise most representative of loading time. To update rendering state we should simply call renderStart_. E.g.

this.element_.appendChild(this.iframe);   // THIS IS AN EXISTING LINE
if (opt_isA4A) {
  this.renderStart_(info);
  renderStartResolve();
}

The same can be arranged via micro-tasks if it's more desirable to keep all render-start code together up top.

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 @dvoytenko PTAL

// Set iframe initially hidden which will be removed on render-start or
// load, whichever is earlier.
setStyle(this.iframe, 'visibility', 'hidden');
this.baseInstance_.lifecycleReporter.addPingsForVisibility(this.element_);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we do this for the other case as well?

@keithwrightbos keithwrightbos merged commit 937b077 into ampproject:master May 2, 2017
@keithwrightbos keithwrightbos deleted the a4a_delayed_remove_load_delay branch May 2, 2017 16:41
KenneyE pushed a commit to spotxchange/amphtml that referenced this pull request May 3, 2017
…for removing loader (ampproject#9056)

* Remove load promise constraint for loader removal if Fast Fetch, non-AMP creative

* refactor

* review comments

* fix test failures

* fix test failure

* fix test failure

* fix test failure
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

5 participants