Repository navigation
Media: Send the isolation header through core when available - #86542
Conversation
WordPress 7.2 only loads the media frame upload pipeline on screens that wp_send_document_isolation_policy_header() isolated, so it can tell its own isolation apart from a plugin that sends the header for reasons of its own. Sending the header directly would leave the media modal on classic uploads in the block editor. Gutenberg keeps deciding which screens to isolate and the gutenberg_use_document_isolation_policy filter still applies. Older WordPress versions without core's function keep the direct header call. See https://core.trac.wordpress.org/ticket/66490. Claude-Session: https://claude.ai/code/session_018vwYjVChF8EN33VU3DGbni
🤖 PR meta 🤖🎉 PropsIf 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the ⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Actions are reachable via RIGHT/LEFT arrow keys in
|
Thanks @andrewserong. This tested well for me when I manually tested so I am going to merge it. |
Fix an issue where a plugin screen that sends its own `Document-Isolation-Policy` header, such as the Elementor editor, got the client-side upload pipeline in every media frame without asking for it. `wp_is_cross_origin_isolated_request()` treated any queued `Document-Isolation-Policy` header as a sign the screen was set up for the pipeline, so it could not tell core's isolation apart from a plugin's. The function now returns true only when `wp_send_document_isolation_policy_header()` has sent the header. Media frames on a screen a plugin isolates itself upload through plupload again, as they did in 7.1. To opt a screen into the pipeline, call `wp_send_document_isolation_policy_header()` before `wp_enqueue_media()` runs. The Gutenberg plugin sends the header itself on the editor screens, so its media modal uses classic uploads until a site updates to a release that includes WordPress/gutenberg#86542. Uploads made in the block editor itself are unaffected. Follow-up to [64588]. Props andrewserong. Fixes #66490. git-svn-id: https://develop.svn.wordpress.org/trunk@65532 602fd350-edb4-49c9-b593-d223f7449a82
Fix an issue where a plugin screen that sends its own `Document-Isolation-Policy` header, such as the Elementor editor, got the client-side upload pipeline in every media frame without asking for it. `wp_is_cross_origin_isolated_request()` treated any queued `Document-Isolation-Policy` header as a sign the screen was set up for the pipeline, so it could not tell core's isolation apart from a plugin's. The function now returns true only when `wp_send_document_isolation_policy_header()` has sent the header. Media frames on a screen a plugin isolates itself upload through plupload again, as they did in 7.1. To opt a screen into the pipeline, call `wp_send_document_isolation_policy_header()` before `wp_enqueue_media()` runs. The Gutenberg plugin sends the header itself on the editor screens, so its media modal uses classic uploads until a site updates to a release that includes WordPress/gutenberg#86542. Uploads made in the block editor itself are unaffected. Follow-up to [64588]. Props andrewserong. Fixes #66490. Built from https://develop.svn.wordpress.org/trunk@65532 git-svn-id: http://core.svn.wordpress.org/trunk@64605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fix an issue where a plugin screen that sends its own `Document-Isolation-Policy` header, such as the Elementor editor, got the client-side upload pipeline in every media frame without asking for it. `wp_is_cross_origin_isolated_request()` treated any queued `Document-Isolation-Policy` header as a sign the screen was set up for the pipeline, so it could not tell core's isolation apart from a plugin's. The function now returns true only when `wp_send_document_isolation_policy_header()` has sent the header. Media frames on a screen a plugin isolates itself upload through plupload again, as they did in 7.1. To opt a screen into the pipeline, call `wp_send_document_isolation_policy_header()` before `wp_enqueue_media()` runs. The Gutenberg plugin sends the header itself on the editor screens, so its media modal uses classic uploads until a site updates to a release that includes WordPress/gutenberg#86542. Uploads made in the block editor itself are unaffected. Follow-up to [64588]. Props andrewserong. Fixes #66490. git-svn-id: https://develop.svn.wordpress.org/trunk@65532 602fd350-edb4-49c9-b593-d223f7449a82
What?
See https://core.trac.wordpress.org/ticket/66490 (item 1) and the core PR WordPress/wordpress-develop#15855
Send the Document-Isolation-Policy header through core's
wp_send_document_isolation_policy_header()when it exists, so core knows Gutenberg isolated the editor screens.Why?
Claude worked through the core side, short version below:
How?
Testing Instructions
async-upload.php. With it: it goes through/wp/v2/media,/sideloadand/finalize.Use of AI Tools
Code and description written with 🤖 Claude Code. I will review and test.
🤖 Generated with Claude Code
https://claude.ai/code/session_018vwYjVChF8EN33VU3DGbni