Add sourceURL comments for directly constructed inline scripts in wp-includes#9955
Add sourceURL comments for directly constructed inline scripts in wp-includes#9955westonruter wants to merge 6 commits intoWordPress:trunkfrom
Conversation
| } | ||
| dropdown.onchange = onCatChange; | ||
| })(); | ||
| //# sourceURL=<?php echo __FUNCTION__; ?> |
There was a problem hiding this comment.
I realize this change will need to be done upstream in Gutenberg.
There was a problem hiding this comment.
sirreal
left a comment
There was a problem hiding this comment.
Let's pass all of these through rawurlencode() rather than any string replacement or otherwise relying on the strings to be safe.
That's how it's implemented in script loader:
The spec says this:
And rawurlencode() is just the thing:
Encodes the given string according to » RFC 3986.
…into add/includes-inline-script-source-urls
…into add/includes-inline-script-source-urls
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
sirreal
left a comment
There was a problem hiding this comment.
I've tested several but not all of these cases. I have reviewed all the changes and they appear correct.
It's a very nice improvement when errors or logs come from these scripts 👍
|
Have you or are you planning to create a PR for the case that comes from Gutenberg? |
@sirreal Thanks for the reminder: WordPress/gutenberg#72118 |
…lly constructed in `wp-includes`. This applies to tags constructed without `wp_get_inline_script_tag()`/`wp_print_inline_script_tag()`. Developed in #9955. Props westonruter, jonsurrell. See #63887. git-svn-id: https://develop.svn.wordpress.org/trunk@60909 602fd350-edb4-49c9-b593-d223f7449a82
…lly constructed in `wp-includes`. This applies to tags constructed without `wp_get_inline_script_tag()`/`wp_print_inline_script_tag()`. Developed in WordPress/wordpress-develop#9955. Props westonruter, jonsurrell. See #63887. Built from https://develop.svn.wordpress.org/trunk@60909 git-svn-id: http://core.svn.wordpress.org/trunk@60245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…lly constructed in `wp-includes`. This applies to tags constructed without `wp_get_inline_script_tag()`/`wp_print_inline_script_tag()`. Developed in WordPress/wordpress-develop#9955. Props westonruter, jonsurrell. See #63887. Built from https://develop.svn.wordpress.org/trunk@60909 git-svn-id: https://core.svn.wordpress.org/trunk@60245 1a063a9b-81f0-0310-95a4-ce76da25c4cd

I realized in https://github.com/WordPress/wordpress-develop/pull/9531/files#r2361414013 that that the emoji loader script wasn't geting the
sourceURLcomment. I then realized that there were more than a dozen other such instances of scripts constructed viawp_get_inline_script_tag()andwp_print_inline_script_tag()inwp-includeswhich lacked these comments.Note that there are quite a few scripts constructed in
wp-adminwhich are not yet usingwp_get_inline_script_tag()andwp_print_inline_script_tag(). See Core-59446.There are also instances of inline scripts being printed in themes which this PR does not address. I've suggested that these be handled as part of Core-63806.
Trac ticket: https://core.trac.wordpress.org/ticket/63887
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.