Skip to content

Commit a65f438

Browse files
Media: Disable client-side processing on non-secure origins
SharedArrayBuffer is unavailable on non-HTTPS, non-localhost origins, so cross-origin isolation headers have no effect. Default the feature to disabled in those contexts to avoid unnecessary console warnings.
1 parent 12e10a9 commit a65f438

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/wp-includes/media.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6371,14 +6371,16 @@ function wp_get_image_editor_output_format( $filename, $mime_type ) {
63716371
* @return bool Whether client-side media processing is enabled.
63726372
*/
63736373
function wp_is_client_side_media_processing_enabled(): bool {
6374+
$enabled = ( is_ssl() || 'localhost' === $_SERVER['HTTP_HOST'] );
6375+
63746376
/**
63756377
* Filters whether client-side media processing is enabled.
63766378
*
63776379
* @since 7.0.0
63786380
*
6379-
* @param bool $enabled Whether client-side media processing is enabled. Default true.
6381+
* @param bool $enabled Whether client-side media processing is enabled. Default true if SSL or localhost.
63806382
*/
6381-
return (bool) apply_filters( 'wp_client_side_media_processing_enabled', true );
6383+
return (bool) apply_filters( 'wp_client_side_media_processing_enabled', $enabled );
63826384
}
63836385

63846386
/**

0 commit comments

Comments
 (0)