You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enabling Client Side Media Processing in Gutenberg blows Playground #2954
changed the title [-]Enabling Client Side Media Processing blows Playground[/-][+]Enabling Client Side Media Processing in Gutenberg blows Playground[/+]on Nov 27, 2025
I can confirm. From the browser console screenshot, it might be a CORS issue or so.
The Logs Tab doesn't reveal anything relevant. This is the only entry
[02-Dec-2025 08:17:07 UTC] JavaScript warn: The "zipPath" option of the unzip() Blueprint step is deprecated and will be removed. Use "zipFile" instead.
That's there too few, the browser console has too many entries.
Client-side media processing uses SharedArrayBuffer which, in turn, requires cross-origin isolation via the Cross-Origin-Embedder-Policy (COEP) and Cross-Origin-Resource-Policy (CORP) headers. Those headers are viral-ish, and once a part of a site sets them, the rest of the site must follow. This is why YouTube embeds broke at one point when I was experimenting with these.
I can see the following options:
Set the COEP/CORP headers only on the editor screens and only when media experiments are enabled – this will break embeds YouTube embeds, but only in the editor. That's consistent with what's likely happening in "native" WordPress and seems like a good option.
Set the COEP/CORP headers for the entire Playground – that's easier technically, but it will also break embeds such as YouTube site-wide so it's not a good option.
Don't support client-side media processing. That's not a good option, I'm only mentioning it for completeness.
I somehow assumed the entire server configuration needs updating to serve all the CSS, JS, etc. assets with COEP/CORP headers, but it seems like doing it just for the editor page is enough?
🤔
The difficult part seems to be embedding WordPress in an iframe. I think Playground is blowing up because we are embedding an origin-isolated resource in a non-origin-isolated page. If that's correct, we'd need to serve these headers on the entire https://playground.wordpress.net/ – but that would affect the editor even when the media experiment is not enabled.
Ideally, we'd be able to activate the origin-isolated mode when the editor demands it, and deactivate it once we navigate away from the isolated editor. However, I don't think we can switch between those modes without a full playground.wordpress.net reload. This means we need to either:
Stick to a non-isolated mode – and don't support client-side media processing
Stick to an isolated mode – and don't support embeds
Dynamically switch between the two modes – and make the user experience more rough, e.g. we may surprise the user with a sudden page reload, we'll likely lose some UI state, and we may also trigger the "are you sure you want to reload?" alert at times. We'll also need to save the temporary Playground in OPFS and restore it from there, which could take a few seconds and add to the roughness.
I wonder if I'm missing a fourth solution here that would solve it without any big downsides. Maybe an explicit ?origin-isolation setting that must be present from the beginning of the Playground session?
Chrome 137+ desktop only (no Firefox, Safari, or mobile)
Isolated frames lose synchronous DOM access to same-origin non-isolated frames
Recommendation
Hybrid approach with clear documentation:
Detect Document Isolation Policy support via feature detection
When supported (Chrome 137+): Add Document-Isolation-Policy: isolate-and-credentialless header
When not supported: Display a clear message explaining the limitation when the Gutenberg experiment is detected
Document the limitation in Playground docs with browser compatibility info
Alternatively, wait for broader browser support - Document Isolation Policy is very new. We could document the current limitation and implement when Firefox/Safari add support.
@JanJakes Oh! So it seems like using that header in Chrome 137+ would already improve the situation for some users? And perhaps we can even do it at a service worker level to swap the CORP/COEP headers for that one when we detect Chrome? Let's try that, it seems like a worthwhile plan.
With that PR merged and the editor no longer crashes on chrome. I still do not see the "media experiments" inspector controls from Pascal's post, but at least the editor canvas doesn't crash in Chrome. @swissspidy any idea what are we missing?
As for Safari and Firefox, I don't think there's any viable solution we could roll out there (other than just waiting for them to implement the Document-Isolation-Policy specification). If anyone has any ideas, please share.
I am investigating a fix for this on the Gutenberg side in WordPress/gutenberg#75941. If we can't get this to work properly, I will try to disable in the Playground context.
@adamsilverstein I'm investigating, let's hold with making any changes – I'd like to understand what broke exactly so that we can prevent similar breakages in the future.
@brandonpayton disabled the experiment in Playground for the time being to unlock using it with beta2. Meanwhile, I'm investigating what happened. This is pretty interesting:
It seems like the Document-Isolation-Policy doesn't mix well with COEP. I wonder if we're doing that anywhere or if anything changed about the way WordPress serves these headers.
#3320 explores the root causes of the problem, which seems to be at the intersection of some DIP nuances and the recent changes in the block editor. I wonder if there’s even a good solution to this given that DIP may not be coming to mobile which means WordPress Core doesn’t have a good incentive to adopt it as that would require maintaining both CORP/COEP and DIP. 🤔
With WordPress/gutenberg#75991 merged, we can probably remove all the DIP-related code from Playground and just let WordPress do its thing, at least if that PR is getting released with 7.0.
Closing as resolved by #3515, tracked to completion in #3514. The E2E tests cover the editor and media-processing feature on Chromium. Firefox and Safari use a fallback.
Activity
[-]Enabling Client Side Media Processing blows Playground[/-][+]Enabling Client Side Media Processing in Gutenberg blows Playground[/+]bph commentedon Dec 2, 2025
I can confirm. From the browser console screenshot, it might be a CORS issue or so.
The Logs Tab doesn't reveal anything relevant. This is the only entry
That's there too few, the browser console has too many entries.
This is the screen I see:
adamziel commentedon Dec 2, 2025
Client-side media processing uses SharedArrayBuffer which, in turn, requires cross-origin isolation via the
Cross-Origin-Embedder-Policy (COEP)andCross-Origin-Resource-Policy (CORP)headers. Those headers are viral-ish, and once a part of a site sets them, the rest of the site must follow. This is why YouTube embeds broke at one point when I was experimenting with these.I can see the following options:
I wonder if there are other good options I'm missing here – cc @swissspidy @ramonjd @brandonpayton
swissspidy commentedon Dec 2, 2025
This should already be the case in the current implementation in Gutenberg and in the Media Experiments plugin
adamziel commentedon Dec 2, 2025
@swissspidy Oh, that's right!:
I somehow assumed the entire server configuration needs updating to serve all the CSS, JS, etc. assets with COEP/CORP headers, but it seems like doing it just for the editor page is enough?
🤔
The difficult part seems to be embedding WordPress in an iframe. I think Playground is blowing up because we are embedding an origin-isolated resource in a non-origin-isolated page. If that's correct, we'd need to serve these headers on the entire https://playground.wordpress.net/ – but that would affect the editor even when the media experiment is not enabled.
Ideally, we'd be able to activate the origin-isolated mode when the editor demands it, and deactivate it once we navigate away from the isolated editor. However, I don't think we can switch between those modes without a full playground.wordpress.net reload. This means we need to either:
I wonder if I'm missing a fourth solution here that would solve it without any big downsides. Maybe an explicit
?origin-isolationsetting that must be present from the beginning of the Playground session?swissspidy commentedon Dec 2, 2025
You might want to check out Document Isolation Policy, which is supposed to supersede COEP/COOP and applies per frame. Chrome only now though at the moment. See https://developer.chrome.com/blog/document-isolation-policy
JanJakes commentedon Dec 11, 2025
I asked Claude to investigate, summarize, and research the possible solutions for me, and it did an impressive job (see below).
Then I went on to try Document Isolation Policy, and it appears to be working: #3020
[Claude summary of the issue below]
Root Cause
When the "Client-side media processing" experiment is enabled in Gutenberg within WordPress Playground, the application crashes because:
wasm-vips(image processing) andffmpeg.wasm(video/audio processing)SharedArrayBufferfor multi-threaded operationsSharedArrayBufferrequires cross-origin isolation via COEP (Cross-Origin-Embedder-Policy) and CORP (Cross-Origin-Resource-Policy) headersAssumptions Verified
Playground explicitly avoids COEP/CORP headers
Found in
packages/php-wasm/universal/src/lib/comlink-sync.ts:22-26:Service worker manipulates response headers but doesn't add cross-origin isolation
In
packages/php-wasm/web-service-worker/src/utils.ts, the service worker:x-frame-optionsto allow iframe embeddingframe-ancestorsfrom CSP to allow cross-origin embeddingThe iframe architecture is complex
Playground uses nested iframes, and the Gutenberg site editor adds another level that Playground patches in
service-worker.ts.Gutenberg does add headers when experiment is enabled (as @swissspidy mentioned)
The problem is that these headers conflict with Playground's iframe embedding model.
Solution Evaluation
Document Isolation Policy - A Potential Path Forward
Document Isolation Policy is a new feature shipping in Chrome 137 (late 2025) that differs from COEP:
Document-Isolation-Policy: isolate-and-credentiallessLimitations:
Recommendation
Hybrid approach with clear documentation:
Document-Isolation-Policy: isolate-and-credentiallessheaderAlternatively, wait for broader browser support - Document Isolation Policy is very new. We could document the current limitation and implement when Firefox/Safari add support.
References
adamziel commentedon Dec 12, 2025
@JanJakes Oh! So it seems like using that header in Chrome 137+ would already improve the situation for some users? And perhaps we can even do it at a service worker level to swap the CORP/COEP headers for that one when we detect Chrome? Let's try that, it seems like a worthwhile plan.
adamziel commentedon Dec 12, 2025
#3028 might fix it in Chrome
[Website] Rewrite COEP/COOP headers as Document-Isolation-Policy in s…
adamziel commentedon Dec 19, 2025
With that PR merged and the editor no longer crashes on chrome. I still do not see the "media experiments" inspector controls from Pascal's post, but at least the editor canvas doesn't crash in Chrome. @swissspidy any idea what are we missing?
As for Safari and Firefox, I don't think there's any viable solution we could roll out there (other than just waiting for them to implement the Document-Isolation-Policy specification). If anyone has any ideas, please share.
swissspidy commentedon Dec 19, 2025
These controls are from https://github.com/swissspidy/media-experiments. Only very little of that plugin's functionality is in Gutenberg yet.
adamsilverstein commentedon Feb 26, 2026
I am investigating a fix for this on the Gutenberg side in WordPress/gutenberg#75941. If we can't get this to work properly, I will try to disable in the Playground context.
adamsilverstein commentedon Feb 26, 2026
@adamziel how are you testing? how do i test GB trunk in playground?
if you upload an image do you see a bunch of rest-api "sideload" requests?
these are the resized images being uploaded to the server and indicate the feature is working correctly.
If not, do you agree I should disable Client Side Media for Playground since it is no longer an experiment?
adamziel commentedon Feb 26, 2026
@adamsilverstein I'm investigating, let's hold with making any changes – I'd like to understand what broke exactly so that we can prevent similar breakages in the future.
adamziel commentedon Feb 27, 2026
@brandonpayton disabled the experiment in Playground for the time being to unlock using it with beta2. Meanwhile, I'm investigating what happened. This is pretty interesting:
It seems like the Document-Isolation-Policy doesn't mix well with COEP. I wonder if we're doing that anywhere or if anything changed about the way WordPress serves these headers.
adamziel commentedon Feb 27, 2026
#3320 explores the root causes of the problem, which seems to be at the intersection of some DIP nuances and the recent changes in the block editor. I wonder if there’s even a good solution to this given that DIP may not be coming to mobile which means WordPress Core doesn’t have a good incentive to adopt it as that would require maintaining both CORP/COEP and DIP. 🤔
Also, related WebKit issue about DIP: WebKit/standards-positions#399
adamziel commentedon Mar 12, 2026
With WordPress/gutenberg#75991 merged, we can probably remove all the DIP-related code from Playground and just let WordPress do its thing, at least if that PR is getting released with 7.0.
Edit: It is! WordPress/wordpress-develop#11098
fellyph commentedon Nov 17, 2026
Closing as resolved by #3515, tracked to completion in #3514. The E2E tests cover the editor and media-processing feature on Chromium. Firefox and Safari use a fallback.