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

🐛 Properly indicate when FIE is done for no-signing #31530

Merged
merged 6 commits into from
Dec 11, 2020
Merged

🐛 Properly indicate when FIE is done for no-signing #31530

merged 6 commits into from
Dec 11, 2020

Conversation

calebcordry
Copy link
Member

Tell FIE ampdoc that it is complete only after all elements have been transferred. Tested manually and if I am in no-signing + fie-resources this will solve the malformed json errors. This will probably cost us a bit of speed, but will iterate on fie-resource building logic in follow up.

Partial #27189

Copy link
Contributor

@dvoytenko dvoytenko left a comment

Choose a reason for hiding this comment

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

Looks great.

/** @private @const {!Promise} */
this.winLoadedPromise_ = Promise.all([loadedPromise, this.whenReady()]);
if (this.ampdoc) {
this.whenReady().then(() => this.ampdoc.setReady());
// TODO(ccordry): wait for renderComplete after no signing launch.
const readyPromise = this.spec.skipHtmlMerge
Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably best to just use one promise here: whenRenderComplete(), but resolve renderComplete_ promise at the same time as readyPromise when this.spec.skipHtmlMerge. That way this new promise will always be "correct" from API point of view. Otherwise, right now, it could end up unresolved in some cases.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

// TODO(ccordry): wait for renderComplete after no signing launch.
const readyPromise = this.spec.skipHtmlMerge
? this.whenRenderComplete()
: this.whenReady();
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's rename this function to avoid confusion. This should be whenRenderStarted().

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@@ -465,6 +489,13 @@ export class FriendlyIframeEmbed {
} else {
this.signals_.signal(CommonSignals.RENDER_START);
}

// TODO(ccordry): remove when no-signing launched.
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI: this class and this mode are used by most of our unit tests. So we'd need to switch them to streaming as well.

src/friendly-iframe-embed.js Show resolved Hide resolved
@calebcordry calebcordry merged commit fdac718 into ampproject:master Dec 11, 2020
@calebcordry calebcordry deleted the signing-end branch December 11, 2020 17:11
Enriqe pushed a commit to Enriqe/amphtml that referenced this pull request Dec 15, 2020
* signal end of transfer

* tests

* use one promise

* fix tests

* renaming

* fix animation
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.

4 participants