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

Inabox: remove unnecessary dependency on storage services. #22888

Merged
merged 4 commits into from
Jun 27, 2019

Conversation

lannka
Copy link
Contributor

@lannka lannka commented Jun 18, 2019

This reduces the size of amp4ads-v0.js from 273.5KB to 271KB
for #22867

@lannka lannka requested a review from zhouyx June 18, 2019 03:55
installCidService(ampdoc);
if (!opt_inabox) {
// For security, storage service is not supported in inabox.
installCidService(ampdoc);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the installation order matter? Can we combine the opt_inabox check to one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to the comment above, the order matters.

@@ -79,7 +79,10 @@ export function installRuntimeServices(global) {
export function installAmpdocServices(ampdoc, opt_initParams, opt_inabox) {
// Order is important!
installUrlForDoc(ampdoc);
installCidService(ampdoc);
if (!opt_inabox) {
// For security, storage service is not supported in inabox.
Copy link
Contributor

Choose a reason for hiding this comment

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

comment code doesn't match : )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

woops

// For security, storage and CLIENT_ID are not supported in inabox.
// Fail early with console errors for any attempt of access.
unsupportedService(ampdoc, 'storage');
unsupportedService(ampdoc, 'cid');
Copy link
Contributor

Choose a reason for hiding this comment

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

if (getMode().runtime == 'inabox') {
return /** @type {!Promise<ResolverReturnDef>} */ (Promise.resolve(
null
));
}

I'm hoping that we can remove this. Instead of make cid service unsupported, can we create a fake cid service and return null for get() method 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.

I like that. Removed CID related change from this PR. Will address that separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed here: #23018

@lannka lannka changed the title Inabox: remove unnecessary dependencies cid & storage services. Inabox: remove unnecessary dependencies storage services. Jun 25, 2019
@lannka lannka changed the title Inabox: remove unnecessary dependencies storage services. Inabox: remove unnecessary dependency on storage services. Jun 25, 2019
@lannka lannka merged commit 816dd70 into ampproject:master Jun 27, 2019
@lannka lannka deleted the inabox-lite-cid-storage branch June 27, 2019 00:35
thekorn pushed a commit to edelight/amphtml that referenced this pull request Sep 11, 2019
…t#22888)

* Inabox: remove unnecessary dependencies cid & storage services.

* Undo CID

* Undo CID
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