-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Core: Preserve CSP nonce on scripts with src attribute (#4323) #4328
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
Conversation
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 had a few simple remarks, I've just pushed fixes for them to your branch.
This is really good! Usually we have to guide contributors to our process and you figured out most of it by yourself. :)
This currently adds 30 bytes to the minified gzipped size. I'll see if we can limit that somehow.
I pushed another update, it's at +20 bytes now. @buddh4 For the future's sake, it's a good idea to keep |
@@ -199,7 +199,9 @@ function domManip( collection, args, callback, ignored ) { | |||
|
|||
// Optional AJAX dependency, but won't run scripts if not present | |||
if ( jQuery._evalUrl && !node.noModule ) { | |||
jQuery._evalUrl( node.src ); | |||
jQuery._evalUrl( node.src, { | |||
nonce: node.nonce || node.getAttribute( "nonce" ) |
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 hoped this would be compressable with the other similar logic in DOMEval.js
but there we iterate over more properties so it cannot be generalized so easily.
We'll be able to simplify it when Firefox & Safari implement the nonce
property.
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.
cc @gibson042 for compressibility efforts
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.
LGTM
Summary
Fixes #4323
Checklist