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
Delegate trust check to action handler #21553
Delegate trust check to action handler #21553
Conversation
702acf1
to
52f7ba4
Compare
@@ -775,7 +779,7 @@ export class ActionService { | |||
* @return {boolean} | |||
* @private |
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.
Curious, why this change? Is a trailing underscore no longer going to be used to identify @private
? You're consistent as you introduced isAmpTagName
which follows the same naming scheme and is private.
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 think it's more important for class functions than module-level functions. I.e. it's possible to accidentally invoke a private class function but not a module-level function that's not exported.
// Dequeue the current queue. | ||
if (isArray(currentQueue)) { | ||
const queuedInvocations = target[ACTION_QUEUE_]; | ||
if (isArray(queuedInvocations)) { |
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.
nit. not related to your change but is the isArray
check for queuedInvocations
is not necessary here. It is either null or an Array based on the type annotation associated with it and if so then checking for its presence would suffice. Just if(queuedInvocations)
vs if (isArray(queuedInvocations))
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.
My guess is it's a safety measure in case some other code accidentally sets the same property on the element.
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.
Thanks for the review.
@@ -775,7 +779,7 @@ export class ActionService { | |||
* @return {boolean} | |||
* @private |
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 think it's more important for class functions than module-level functions. I.e. it's possible to accidentally invoke a private class function but not a module-level function that's not exported.
// Dequeue the current queue. | ||
if (isArray(currentQueue)) { | ||
const queuedInvocations = target[ACTION_QUEUE_]; | ||
if (isArray(queuedInvocations)) { |
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.
My guess is it's a safety measure in case some other code accidentally sets the same property on the element.
This reverts commit 391a431.
)" (ampproject#21563)" This reverts commit d96498b.
Prerequisite for #21322.
For action handlers of non-AMP elements, remove the
ActionTrust
check from registration time and allow the handler itself to do the check instead.This is a simple solution to support both HIGH and LOW trust actions in a single handler.
/to @alabiaga