Skip to content

Introduce ampdoc on a FIE level#22493

Closed
dvoytenko wants to merge 3 commits intoampproject:masterfrom
dvoytenko:ampdoc-fie1
Closed

Introduce ampdoc on a FIE level#22493
dvoytenko wants to merge 3 commits intoampproject:masterfrom
dvoytenko:ampdoc-fie1

Conversation

@dvoytenko
Copy link
Copy Markdown
Contributor

@dvoytenko dvoytenko commented May 24, 2019

Superceded by #22734.

First I wanted to note - this is a fairly drastic PR. I'm not planning to merge it as is, but instead do these migrations in phases. Sometimes even guarded by an experiment.

The key changes here:

  1. Every "root" in AMP will have an ampdoc associated with it.
  2. There are no longer "embed" services and thus no service adoption. All services are installed directly into the relevant ampdoc. I.e. FIE, single doc and shadow doc are all work the same way. There are still minor adjustments to FIE, mostly to install polyfills and builtins. These will eventually disappear as well.
  3. To clarify, few remnants of adoption are still in the code here, but overtime I hope to have none.
  4. I want to eventually remove most of extensions of AmpDoc and have a single AmpDoc with few customizations. Basically everyone to go into reducing differences between ampdocs.
  5. Now there's only a single style installer. Finally!
  6. Dual implementation of services with different roots are all gone. I didn't update them in this PR to avoid overloading the key pieces.

Copy link
Copy Markdown

@dreamofabear dreamofabear left a comment

Choose a reason for hiding this comment

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

Also would be great to remove all of the "EmbedScope" service getters in service.js and element-service.js.

// Order is important!

// QQQQQQ: all service passthrough to embed are bad here. some are near-critical.
// remove them asap.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Isn't status quo that all services pass-through/inherit except the following?

url, actions, standard-actions, navigation, timer, bind

Seems like we should keep that behavior at least for MVP migration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's actually not, no. You're right that we may hit some compatibility blocks and for that reason I will have passthrough under experiment. But the final state: no passthrough. In very rare cases where passthrough is needed we just need to do it explicitly.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

"No pass-through" sounds kind of heavy. Are you thinking this is better for security?

Also, does it prevent lightweight, "root" use cases?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we definitely need "open" and "close" modes. And I'm pretty sure they will be easier to accomplish for us. But I want to focus on "close" first since that covers our most current cases. "Open" roots would take some more discussion to figure out.

getAmpdocServiceHolder(ampdoc.getEmbedder()), id);
registerServiceInternal(
getAmpdocServiceHolder(ampdoc), ampdoc, id, () => service);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I want to eventually remove most of extensions of AmpDoc and have a single AmpDoc with few customizations. Basically everyone to go into reducing differences between ampdocs.

Can we get rid of this if we allow configuration of AmpDoc for FIE such that it inherits all services except for the ~5-6 that matter?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's definitely the "final state" plan for this migration. You can see in the prototype that there's only a single "install root" method and everything else is essentially the same with vary small customizations.

@dvoytenko dvoytenko mentioned this pull request Jul 20, 2020
8 tasks
@dvoytenko
Copy link
Copy Markdown
Contributor Author

All of this code, except for cleanup, has been merged in a series of many pull requests. See #22734 for more info.

@dvoytenko dvoytenko closed this Jul 20, 2020
@dvoytenko dvoytenko deleted the ampdoc-fie1 branch July 20, 2020 23:06
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.

3 participants