-
Notifications
You must be signed in to change notification settings - Fork 384
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
Track assets those registered or enqueued in block's render callback. #6579
Conversation
Plugin builds for 9e3a620 are ready 🛎️!
|
…incorrect-error-source * 'develop' of github.com:ampproject/amp-wp: (613 commits) Bump svgo from 2.6.0 to 2.6.1 Advise to check loopback request test Simplify language for condition for what headers are looked for Bump eslint-plugin-jest from 24.4.0 to 24.4.2 Improve test coverage for get_persistent_object_cache_learn_more_action Remove absolete wp_doing_ajax filter Eliminate use of deprecated assertion Store results of page caching to reduce severity of missing a persistent object cache Explain how page cache detection is performed Improve tests for page caching fixup! Eliminate attempting to challenge page caching in favor of response header detection Revert "Increase timeout for selector" Eliminate attempting to challenge page caching in favor of response header detection Only verify save button is disabled after being clicked Require future expires header for client-side caching Require Cache-Control to have max-age to satisfy client-caching Add optional SSL-verification, Basic auth forwarding, and request failure handling Remove extra margin from top of Site Health tests Fix test failure in older versions of WP Refactor to improve test coverage ...
Just a note to self when testing: there are two scenarios in which a block may enqueue a script or a style.
It seems this PR addressing the first case, but we should make sure the second case is also addressed. |
When using the Bad Block Plugin, I'm seeing:
The only validation error that isn't properly attributed to Bad Block is this inline script: That's the inline script that is being returned in the |
The reason why the block is getting identified as coming from Gutenberg is due to this compat code in |
There is one area for future improvement and that is to try to link validation errors for scripts/styles in the head/footer to blocks that caused them to be added to the page. For example, with the Bad Block plugin, only the one validation error coming from the block content is getting reported as being from the block: When in reality, all 5 are being added to the page because that one block was added: But this can be done in a subsequent PR. |
@pierlon Please add your review when you get a chance. The changes here are key for Site Scanning to produce accurate results. |
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
Add wrapper callback to detect/track specific function which registered or enqueued asset in block's render callback. instead of showing
do_blocks()
as a source of an enqueueing asset.Fixes #5411
Fixes #6231
Checklist