Skip to content

Commit 0bdef9d

Browse files
Remove wp_use_document_isolation_policy filter
DIP headers are sent based on browser capability alone. The existing wp_client_side_media_processing_enabled filter already gates the entire feature higher in the call chain.
1 parent 05dcc36 commit 0bdef9d

2 files changed

Lines changed: 2 additions & 54 deletions

File tree

src/wp-includes/media.php

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6395,13 +6395,7 @@ function wp_set_client_side_media_processing_flag(): void {
63956395

63966396
$chrome_version = wp_get_chrome_major_version();
63976397

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 ) {
6398+
if ( null !== $chrome_version && $chrome_version >= 137 ) {
64056399
wp_add_inline_script( 'wp-block-editor', 'window.__documentIsolationPolicy = true', 'before' );
64066400
}
64076401

@@ -6486,23 +6480,7 @@ function wp_set_up_cross_origin_isolation(): void {
64866480
function wp_start_cross_origin_isolation_output_buffer(): void {
64876481
$chrome_version = wp_get_chrome_major_version();
64886482

6489-
/**
6490-
* Filters whether to use Document-Isolation-Policy for cross-origin isolation.
6491-
*
6492-
* Document-Isolation-Policy provides per-document cross-origin isolation
6493-
* without affecting other iframes on the page, avoiding breakage of plugins
6494-
* whose iframes lose credentials/DOM access.
6495-
*
6496-
* @since 7.0.0
6497-
*
6498-
* @param bool $use_dip Whether DIP is supported and should be used.
6499-
*/
6500-
$use_dip = apply_filters(
6501-
'wp_use_document_isolation_policy',
6502-
null !== $chrome_version && $chrome_version >= 137
6503-
);
6504-
6505-
if ( ! $use_dip ) {
6483+
if ( null === $chrome_version || $chrome_version < 137 ) {
65066484
return;
65076485
}
65086486

tests/phpunit/tests/media/wpStartCrossOriginIsolationOutputBuffer.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ public function tear_down() {
3232
ob_end_clean();
3333
}
3434

35-
remove_all_filters( 'wp_use_document_isolation_policy' );
36-
3735
parent::tear_down();
3836
}
3937

@@ -83,34 +81,6 @@ public function test_does_not_start_output_buffer_for_safari() {
8381
$this->assertSame( $level_before, $level_after, 'Output buffer should not be started for Safari.' );
8482
}
8583

86-
/**
87-
* @runInSeparateProcess
88-
* @preserveGlobalState disabled
89-
*/
90-
public function test_filter_can_force_enable_dip() {
91-
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 10.0; rv:128.0) Gecko/20100101 Firefox/128.0';
92-
add_filter( 'wp_use_document_isolation_policy', '__return_true' );
93-
94-
$level_before = ob_get_level();
95-
wp_start_cross_origin_isolation_output_buffer();
96-
$level_after = ob_get_level();
97-
98-
$this->assertSame( $level_before + 1, $level_after, 'Filter should force-enable output buffer.' );
99-
100-
ob_end_clean();
101-
}
102-
103-
public function test_filter_can_force_disable_dip() {
104-
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36';
105-
add_filter( 'wp_use_document_isolation_policy', '__return_false' );
106-
107-
$level_before = ob_get_level();
108-
wp_start_cross_origin_isolation_output_buffer();
109-
$level_after = ob_get_level();
110-
111-
$this->assertSame( $level_before, $level_after, 'Filter should disable output buffer.' );
112-
}
113-
11484
/**
11585
* @runInSeparateProcess
11686
* @preserveGlobalState disabled

0 commit comments

Comments
 (0)