Skip to content

Commit 291c608

Browse files
Add __documentIsolationPolicy JS flag
Sets window.__documentIsolationPolicy when DIP is active so JS can distinguish DIP from COOP/COEP cross-origin isolation and skip unnecessary iframe credentialless attributes.
1 parent 602018a commit 291c608

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/wp-includes/media.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6393,6 +6393,18 @@ function wp_set_client_side_media_processing_flag(): void {
63936393

63946394
wp_add_inline_script( 'wp-block-editor', 'window.__clientSideMediaProcessing = true', 'before' );
63956395

6396+
$chrome_version = wp_get_chrome_major_version();
6397+
6398+
/** This filter is documented in src/wp-includes/media.php */
6399+
$use_dip = apply_filters(
6400+
'wp_use_document_isolation_policy',
6401+
null !== $chrome_version && $chrome_version >= 137
6402+
);
6403+
6404+
if ( $use_dip ) {
6405+
wp_add_inline_script( 'wp-block-editor', 'window.__documentIsolationPolicy = true', 'before' );
6406+
}
6407+
63966408
/*
63976409
* Register the @wordpress/vips/worker script module as a dynamic dependency
63986410
* of the wp-upload-media classic script. This ensures it is included in the

0 commit comments

Comments
 (0)