-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Conversation
src/service/core-services.js
Outdated
installCidService(ampdoc); | ||
if (!opt_inabox) { | ||
// For security, storage service is not supported in inabox. | ||
installCidService(ampdoc); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
src/service/core-services.js
Outdated
@@ -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. |
There was a problem hiding this comment.
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 : )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woops
src/inabox/amp-inabox.js
Outdated
// 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'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amphtml/src/service/url-replacements-impl.js
Lines 290 to 294 in d7a0dde
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed here: #23018
…t#22888) * Inabox: remove unnecessary dependencies cid & storage services. * Undo CID * Undo CID
This reduces the size of amp4ads-v0.js from 273.5KB to 271KB
for #22867