Skip to content

Commit b698ffa

Browse files
adamsilversteinockham
authored andcommitted
Re-enable client-side media processing (#75848)
* Re-enable client-side media processing in the Gutenberg plugin Remove the disabling shim that was added in #75756, re-enable the cross-origin isolation e2e tests skipped in #75764, and add thorough e2e tests for client-side media filename handling, scaled image metadata, and thumbnail generation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Remove e2e test changes from this PR The improved e2e tests for file naming belong in #75817 instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Clean up dead bootstrap filter refs in tests The bootstrap override for client-side media processing was removed, but tests still referenced it with remove_filter / add_filter calls. Also replaces redundant "can be enabled" test with a "can be disabled via filter" test. --------- Co-authored-by: adamsilverstein <adamsilverstein@git.wordpress.org> Co-authored-by: ockham <bernhard-reiter@git.wordpress.org>
1 parent b5bec2e commit b698ffa

File tree

5 files changed

+115
-267
lines changed

5 files changed

+115
-267
lines changed

lib/compat/plugin/media.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

lib/load.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ function gutenberg_is_experiment_enabled( $name ) {
110110
require __DIR__ . '/compat/wordpress-7.0/kses.php';
111111
require __DIR__ . '/compat/wordpress-7.0/media.php';
112112

113-
// Gutenberg plugin compat: disable client-side media processing by default.
114-
require __DIR__ . '/compat/plugin/media.php';
115-
116113
// Experimental features.
117114
require __DIR__ . '/experimental/block-editor-settings-mobile.php';
118115
require __DIR__ . '/experimental/blocks.php';

phpunit/bootstrap.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,6 @@ function fail_if_died( $message ) {
9696
// Enable the widget block editor.
9797
tests_add_filter( 'gutenberg_use_widgets_block_editor', '__return_true' );
9898

99-
// Enable client-side media processing for tests.
100-
// The Gutenberg plugin disables this by default (lib/compat/plugin/media.php),
101-
// but tests need the media functions to be loaded.
102-
tests_add_filter( 'wp_client_side_media_processing_enabled', '__return_true', 20 );
103-
10499
// Start up the WP testing environment.
105100
require $_tests_dir . '/includes/bootstrap.php';
106101

phpunit/media/media-processing-test.php

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -202,31 +202,23 @@ public function test_gutenberg_override_media_templates(): void {
202202
}
203203

204204
/**
205-
* Tests that client-side media processing is disabled by default in the Gutenberg plugin.
206-
*
207-
* The core compat layer defaults to true, but the Gutenberg plugin
208-
* adds a filter to disable it by default (lib/compat/plugin/media.php)
209-
* until known issues are resolved.
205+
* Tests that client-side media processing is enabled by default in the Gutenberg plugin.
210206
*
211207
* @covers ::gutenberg_is_client_side_media_processing_enabled
212208
*/
213-
public function test_client_side_media_processing_disabled_by_default_in_plugin() {
214-
// Remove the test bootstrap override to check the plugin's actual default.
215-
remove_filter( 'wp_client_side_media_processing_enabled', '__return_true', 20 );
216-
$enabled = gutenberg_is_client_side_media_processing_enabled();
217-
// Restore the test bootstrap override.
218-
add_filter( 'wp_client_side_media_processing_enabled', '__return_true', 20 );
219-
220-
$this->assertFalse( $enabled );
209+
public function test_client_side_media_processing_enabled_by_default_in_plugin() {
210+
$this->assertTrue( gutenberg_is_client_side_media_processing_enabled() );
221211
}
222212

223213
/**
224-
* Tests that client-side media processing can be enabled via filter.
214+
* Tests that client-side media processing can be disabled via filter.
225215
*
226216
* @covers ::gutenberg_is_client_side_media_processing_enabled
227217
*/
228-
public function test_client_side_media_processing_can_be_enabled() {
229-
$this->assertTrue( gutenberg_is_client_side_media_processing_enabled() );
218+
public function test_client_side_media_processing_can_be_disabled_via_filter() {
219+
add_filter( 'wp_client_side_media_processing_enabled', '__return_false' );
220+
$this->assertFalse( gutenberg_is_client_side_media_processing_enabled() );
221+
remove_filter( 'wp_client_side_media_processing_enabled', '__return_false' );
230222
}
231223

232224
/**
@@ -235,14 +227,11 @@ public function test_client_side_media_processing_can_be_enabled() {
235227
* @covers ::gutenberg_override_attachments_rest_controller
236228
*/
237229
public function test_compat_rest_controller_used_when_filter_disabled() {
238-
// Remove the test bootstrap override so the disable filter takes effect.
239-
remove_filter( 'wp_client_side_media_processing_enabled', '__return_true', 20 );
240230
add_filter( 'wp_client_side_media_processing_enabled', '__return_false' );
241231

242232
$result = gutenberg_override_attachments_rest_controller( array(), 'attachment' );
243233

244234
remove_filter( 'wp_client_side_media_processing_enabled', '__return_false' );
245-
add_filter( 'wp_client_side_media_processing_enabled', '__return_true', 20 );
246235

247236
$this->assertSame(
248237
array( 'rest_controller_class' => 'Gutenberg_REST_Attachments_Controller_6_9' ),
@@ -256,7 +245,7 @@ public function test_compat_rest_controller_used_when_filter_disabled() {
256245
* @covers ::gutenberg_override_attachments_rest_controller
257246
*/
258247
public function test_compat_rest_controller_not_used_when_filter_enabled() {
259-
// Feature is enabled via test bootstrap filter at priority 20.
248+
// Feature is enabled by default (core compat layer).
260249
$result = gutenberg_override_attachments_rest_controller( array(), 'attachment' );
261250

262251
$this->assertSame( array(), $result );

0 commit comments

Comments
 (0)