Broaden DIP header scope to all admin pages - #76662
Conversation
Send the Document-Isolation-Policy header on all admin pages and front-end preview pages instead of only specific editor screens. This keeps all admin navigations (site editor, template operations, pattern editing) and preview popups in the same agent cluster, preserving cross-window communication in Chromium 137+. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
…ounds Now that the DIP header is sent on all admin pages and preview pages, the agent cluster mismatch that previously broke cross-window communication no longer occurs. These test workarounds are no longer needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Size Change: -1.18 kB (-0.01%) Total Size: 8.05 MB 📦 View Changed
|
|
Flaky tests detected in 3dde058. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/27820882807
|
Resolve conflicts by keeping the broader DIP scope (admin_init + template_redirect) from this branch while incorporating trunk's third-party editor `action` query param skip. Drop the test plugin workarounds that trunk re-added in reordered hook positions -- DIP is now broad enough that the agent cluster mismatch no longer occurs.
DIP is an admin-context feature for WASM-based media processing; the front-end preview doesn't need cross-origin isolation and shouldn't send the header. Remove gutenberg_set_up_cross_origin_isolation_for_preview() and its template_redirect action.
|
Since this broadens the scope of the DIP header to all admin pages, would this be better to propose in trac/wordpress-develop and get some more folks to take a look? Code-wise it's a simple change, but I feel like I don't quite have the knowledge to evaluate how safe this might or might not be. |
I'd love to hear from more reviewers if they anticipate problems with this. Maybe @adamziel can weigh in, I'm guessing in Playground the Document Isolation Policy already extends to the site editor and other areas? The main advantage of broadening the scope is enabling client side media in these other contexts like the site editor. That said, I'm not sure media uploads are actually available? It also helps us avoid disabling the feature for some test runs. |
I will work on a core backport for this then open a trac ticket for further core discussion. |
Send the Document-Isolation-Policy (DIP) header on every admin page via `admin_init` rather than only on the four block-editor screens (`load-post.php`, `load-post-new.php`, `load-site-editor.php`, and `load-widgets.php`). Hooking the narrow set of screens placed the editor in its own browser agent cluster while sibling admin navigations (site editor sub-routes, template and pattern operations) loaded without the header. The agent cluster mismatch broke cross-window communication and SharedArrayBuffer access required for WebAssembly-based client-side media processing in Chromium 137+. The block-editor screen gate is replaced by an `upload_files` capability check, since cross-origin isolation is only needed for users who can upload media. The existing escape hatch for third-party page builders that override the block editor via a custom `action` query parameter is retained. The front-end preview is intentionally out of scope; DIP remains an admin-only concern. See related Gutenberg pull request: WordPress/gutenberg#76662.
The classic-theme home-route guard referenced $screen->id, but moving the hook to admin_init removed the get_current_screen() lookup, leaving $screen undefined. Detect the site editor via the global $pagenow instead, which is available on admin_init. Add the Core backport changelog entry linking to wordpress-develop#11298.
|
Core backport: WordPress/wordpress-develop#11298 |
|
Since this change risks some potential plugin breakage in wp-admin due to plugin conflicts - which is difficult to fully test - I'm nervous about backporting to WordPress core and wondering about merging plugin-only for now. What do you think @andrewserong? We could also leave it out for now until we find an actual use case for it. |
|
Punting from 7.1 for now. |
I'd leave it out for now. Because it affects all admin areas, I think wordpress-develop might be a better place to pick it up again in the future rather than in Gutenberg, as it likely needs a bit more core attention that's a bit more beyond the scope of GB. I.e. a good time to pick it up again might be if/when we look at introducing client-side media processing in the upload flows for core screens. |
Summary
Send the Document-Isolation-Policy (DIP) header on all admin pages rather than only on specific block-editor screens. This keeps navigations across admin screens (site editor, template editing, pattern editing, etc.) in the same agent cluster, preserving cross-window communication and SharedArrayBuffer access for WASM-based media processing on Chromium 137+.
admin_initinstead of the narrowload-post.php/load-post-new.php/load-site-editor.php/load-widgets.phpset.upload_filescapability.actionquery parameter.gutenberg-test-plugin-disable-client-side-media-processingactivations in E2E tests.DIP remains an admin-only concern — the front-end preview is explicitly out of scope.
Testing instructions
Fixes #77633.