Loading
Issue #3533113 Drop webp check.
Closes #3533113
What the change does
Drupal.drimage_improved.webp was written by the probe and never read: the format comes from the formatter settings (core_webp / imageapi_optimize_webp) and the browser picks the WebP <source> by itself. The probe only cost every page an extra data URI decode, which is what @andreasderijcke reported. Removed from both scripts, the module's and Drimage S3fs's.
WebP is now also only requested when it can actually be delivered: the formatter checks that the image toolkit lists webp among its supported extensions, and that imageapi_optimize_webp is installed, instead of trusting the stored setting alone. A site that loses that support stops emitting WebP URLs.
Testing
- Kernel:
DrimageFormatterTest::testWebpOnlyWhenSupportedasserts the data follows real support and that notype="image/webp"source is rendered when it is off. Full suite 33 tests / 192 assertions, phpcs and cspell clean. - Real browser on Varbase 10.1.x (Drupal 11.4.5) and on plain Drupal 11.4.5:
checkWebpis gone, 6/6 images decode, 6 WebP sources present, 8.webpderivatives served, 0 data URI probe requests.
Thanks @andreasderijcke for spotting it.
AI-Generated: Yes
Checkpoints:
- File an issue
- Addition/Change/Update/Fix
- Testing to ensure no regression
- Automated unit testing coverage
- Automated functional testing coverage
- UX/UI designer responsibilities
- Readability
- Accessibility
- Performance
- Security
- Developer Documentation
- User Guide Documentation
- Reviewed by human
- Code review by maintainers
- Full testing and approval
- Credit contributors
- Review with the product owner
- Release notes snippet
- Release
Edited by Rajab Natshah