Media: Set HEIC upload support flag for canvas-based conversion#12561
Media: Set HEIC upload support flag for canvas-based conversion#12561adamsilverstein wants to merge 2 commits into
Conversation
The block editor's HEIC canvas fallback is gated on window.__heicUploadSupport, which core never set. Without it, browsers that cannot use the full WebAssembly pipeline (such as Safari, which lacks Document-Isolation-Policy support) get no client-side HEIC conversion at all, even though they can decode HEIC natively via createImageBitmap(). Set the flag in wp_set_client_side_media_processing_flag() alongside the existing client-side media processing flags so Safari users get HEIC uploads converted to JPEG in the browser.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
At face value this makes it sound like something that should be fixed within the Gutenberg code. I.e. in Gutenberg we can add For this particular PHP change, since the conditions where we output Sorry if I'm missing something obvious! |

Summary
The block editor's HEIC canvas fallback is gated on
window.__heicUploadSupport, but core never sets that flag. The Gutenberg plugin sets it viagutenberg_set_heic_upload_support_flag(), and core has no equivalent.As a result, on a core-only WordPress 7.1 install, browsers that cannot use the full WebAssembly (vips) pipeline get no client-side HEIC conversion at all. This primarily affects Safari:
Document-Isolation-Policyfor Chromium 137+ (wp_set_up_cross_origin_isolation()), so in SafaridetectClientSideMediaSupport()fails and the full vips pipeline is disabled.shouldEnableHeicCanvasProcessing()in@wordpress/block-editor), which requireswindow.__heicUploadSupport- never set by core - so it bails before even checking browser capability.Safari is exactly the browser this fallback was built for: it can decode HEIC natively via
createImageBitmap()and convert to JPEG on a canvas, without needing SharedArrayBuffer or cross-origin isolation.Changes
window.__heicUploadSupport = trueinwp_set_client_side_media_processing_flag(), alongside the existing__clientSideMediaProcessingflag. It respects the samewp_client_side_media_processing_enabledfilter, so disabling client-side processing disables this path too. The browser-capability check (createImageBitmap+OffscreenCanvas+ successful HEIC decode) still happens client-side, so setting the flag for all browsers is safe - Chromium browsers with the full pipeline ignore it.Testing
Trac ticket: https://core.trac.wordpress.org/ticket/65648