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
Introduce expandStringAsync and expandStringSync in url-replacement #6323
Conversation
@@ -390,6 +390,19 @@ var forbiddenTerms = { | |||
'src/service/url-replacements-impl.js', | |||
] | |||
}, | |||
'expandStringSync\\W': { |
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.
These should be in forbiddenTermsSrcInclusive
. Also: \\.expandStringSync\\(
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.
Will do, what is the difference between the forbiddenTermsSrcInclusive
and forbiddenTerms
?
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.
Done
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.
Test code is allowed to use it in forbiddenTermsSrcInclusive
.
return /** @type {string} */( | ||
this.expand_(url, opt_bindings, opt_collectVars, /* opt_sync */ true, | ||
opt_whiteList)); | ||
return /** @type {string} */ (this.expandUrlSync( |
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.
Useless typecast?
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.
Done
* @param {string} url | ||
* @param {!Object<string, *>=} opt_bindings | ||
* @return {!Promise<string>} | ||
*/ | ||
expandAsync(url, opt_bindings) { | ||
return /** @type {!Promise<string>} */(this.expand_(url, opt_bindings)); | ||
return /** @type {!Promise<string>} */ ( |
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.
Useless typecast?
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.
Done
* @return {string} | ||
*/ | ||
expandUrlSync(url, opt_bindings, opt_collectVars, opt_whiteList) { | ||
return /** @type {string} */ ( |
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.
Useless typecast?
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.
Done
* @return {string} | ||
*/ | ||
expandUrlSync(url, opt_bindings, opt_collectVars, opt_whiteList) { | ||
return this.ensureProtocolMatches_(url, /** @type {string} */ (this.expand_( |
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.
Do we need to do the same for the whole origin?
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.
Not sure what do you mean, /cc @jridgewell who worked on this.
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.
Oh I see what you mean, basically ensure that the origin hasn't changed. @jridgewell what was the reasoning behind protecting protocol changes and does it apply to origin changes?
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.
Also, if you guys don't mind I'll go ahead and merge this and I opened #6338 for continuing this discussion.
LGTM with one question |
Follow up to #6257
Related to: #6130 and #5654