WIP: Disable client-side media processing for non-Chromium browsers#76227
WIP: Disable client-side media processing for non-Chromium browsers#76227adamsilverstein wants to merge 3 commits intotrunkfrom
Conversation
Safari and Firefox lack support for Document-Isolation-Policy, which is required for cross-origin isolation (SharedArrayBuffer). Add a PHP-level filter on `wp_client_side_media_processing_enabled` that returns false for non-Chromium User-Agents, preventing the entire feature stack from loading. CLI/cron contexts (no UA) are left ungated. Move `gutenberg_get_chromium_major_version()` from `lib/media/load.php` to `lib/compat/wordpress-7.0/media.php` so it loads before the early- return gate in `lib/media/load.php`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Safari warns about this invalid flag when rendering oEmbed iframes (e.g. YouTube embeds). The flag was removed from the HTML spec and is no longer recognized by Safari.
This reverts commit 978b1f6.
|
Size Change: -8 B (0%) Total Size: 6.87 MB
ℹ️ View Unchanged
|
|
I'm not sure this is needed. I didn't notice much difference. youtube videos load in the editor in firefox after a bunch of console warnings, even in 6.9 with no plugins active. They refuse to load in safari at all before or after this change (and in 6.9). without this change, i see client side media disabled with a message:
|
|
Flaky tests detected in 4ecbd1e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/22748652863
|
Summary
wp_client_side_media_processing_enabledfiltergutenberg_get_chromium_major_version()fromlib/media/load.phptolib/compat/wordpress-7.0/media.phpso it loads before the early-return gateSafari and Firefox lack support for Document-Isolation-Policy, which is required for cross-origin isolation (SharedArrayBuffer). While the JS feature detection already catches this, this adds an explicit PHP-level disable so non-Chromium browsers never receive the JS flag, REST extensions, DIP headers, or MutationObserver setup.
Test plan
npm run test:unit:php -- phpunit/media/media-processing-test.phpwindow.__clientSideMediaProcessingistrue, DIP header presentwindow.__clientSideMediaProcessingisundefined, no DIP headerwp media regenerate) still work🤖 Generated with Claude Code