@@ -6391,24 +6391,7 @@ function wp_set_client_side_media_processing_flag(): void {
63916391 return ;
63926392 }
63936393
6394- $ chrome_version = wp_get_chrome_major_version ();
6395-
6396- /** This filter is documented in wp-includes/media.php */
6397- $ use_dip = apply_filters (
6398- 'wp_use_document_isolation_policy ' ,
6399- null !== $ chrome_version && $ chrome_version >= 137
6400- );
6401-
6402- // Client-side media processing requires cross-origin isolation via
6403- // Document-Isolation-Policy. Skip the feature entirely on browsers
6404- // that do not support DIP, since without isolation SharedArrayBuffer
6405- // (needed by wasm-vips) is unavailable.
6406- if ( ! $ use_dip ) {
6407- return ;
6408- }
6409-
64106394 wp_add_inline_script ( 'wp-block-editor ' , 'window.__clientSideMediaProcessing = true ' , 'before ' );
6411- wp_add_inline_script ( 'wp-block-editor ' , 'window.__documentIsolationPolicy = true ' , 'before ' );
64126395
64136396 /*
64146397 * Register the @wordpress/vips/worker script module as a dynamic dependency
@@ -6445,11 +6428,10 @@ function wp_get_chrome_major_version(): ?int {
64456428 * Enables cross-origin isolation in the block editor.
64466429 *
64476430 * Required for enabling SharedArrayBuffer for WebAssembly-based
6448- * media processing in the editor.
6431+ * media processing in the editor. Uses Document-Isolation-Policy
6432+ * on supported browsers (Chrome 137+).
64496433 *
64506434 * @since 7.0.0
6451- *
6452- * @link https://web.dev/coop-coep/
64536435 */
64546436function wp_set_up_cross_origin_isolation (): void {
64556437 if ( ! wp_is_client_side_media_processing_enabled () ) {
@@ -6466,8 +6448,8 @@ function wp_set_up_cross_origin_isolation(): void {
64666448 return ;
64676449 }
64686450
6469- // Skip when a third-party page builder (e.g. Elementor) overrides the
6470- // block editor. DIP isolates the document into its own agent cluster,
6451+ // Skip when a third-party page builder overrides the block editor.
6452+ // DIP isolates the document into its own agent cluster,
64716453 // which blocks same-origin iframe access that these editors rely on.
64726454 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
64736455 if ( isset ( $ _GET ['action ' ] ) && 'edit ' !== $ _GET ['action ' ] ) {
@@ -6483,26 +6465,21 @@ function wp_set_up_cross_origin_isolation(): void {
64836465}
64846466
64856467/**
6486- * Starts an output buffer to send cross-origin isolation headers .
6468+ * Sends the Document-Isolation-Policy header for cross-origin isolation.
64876469 *
6488- * Uses Document-Isolation-Policy on Chrome 137+ to provide per-document
6489- * cross-origin isolation without breaking third-party iframes. Non-DIP
6490- * browsers skip isolation entirely to avoid CORS failures from COEP/COOP.
6470+ * Uses an output buffer to add crossorigin="anonymous" where needed.
64916471 *
64926472 * @since 7.0.0
6493- *
6494- * @link https://web.dev/coop-coep/
6495- * @link https://github.com/nicolo-ribaudo/iframe-coi-dip-proposal
64966473 */
64976474function wp_start_cross_origin_isolation_output_buffer (): void {
64986475 $ chrome_version = wp_get_chrome_major_version ();
64996476
65006477 /**
6501- * Filters whether to use Document-Isolation-Policy instead of COEP/COOP .
6478+ * Filters whether to use Document-Isolation-Policy for cross-origin isolation .
65026479 *
65036480 * Document-Isolation-Policy provides per-document cross-origin isolation
65046481 * without affecting other iframes on the page, avoiding breakage of plugins
6505- * like Elementor whose iframes lose credentials/DOM access with COEP .
6482+ * whose iframes lose credentials/DOM access.
65066483 *
65076484 * @since 7.0.0
65086485 *
0 commit comments