-
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
Add PWA scripts sanitizer #7141
Conversation
@westonruter I have created XPath based on the offline script id attribute, which was added in PR - GoogleChromeLabs/pwa-wp#793 One more thing to notice is that if the PWA plugin is not available in the testing environment, the test for this sanitizer will fail due to the unavailability of if (
! ( function_exists( 'is_offline' ) && is_offline() ) &&
! ( function_exists( 'is_500' ) && is_500() )
) {
return;
} |
…P_Script_Sanitizer
Plugin builds for 8dc21de are ready 🛎️!
|
Tests are failing on WP Trunk after adding |
As we discussed, to fix this lets just do the following in the various tests before we do any comparison with the $actual = str_replace( ' decoding="async"', '', $actual ); |
@westonruter I was exploring this scenario and found out that something like this was also added for the amp-wp/tests/php/test-amp-gallery-embed-handler.php Lines 73 to 87 in 67cf385
Should I try something similar? $decoding_attribute = version_compare( get_bloginfo( 'version' ), '6.0', '>' ) ? 'decoding="async"' : ''; I believe the |
That would be better, yes. |
Co-authored-by: Weston Ruter <westonruter@google.com>
Co-authored-by: Weston Ruter <westonruter@google.com>
e554d82
to
7420960
Compare
7420960
to
60aad5e
Compare
@westonruter Now the static analysis is failing. I think this can be because of the new PHPStan release. |
Here's how I've been forcing to update my local PHPStan: rm vendor/bin/phpstan
composer install --no-cache |
Thanks for the info on this step 🙇🏼♂️ |
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.
Good work. Thank you.
Summary
Add PWA scripts sanitizer which adds data-px-verified-tag to the offline/500 pages scripts.
Fixes #7122
Screenshots
Storing offline/500 templates in cache as AMP page with offline page reload scripts.
Checklist