Skip to content

[Website] Keep database tools in the app browser partition - #4479

Merged
adamziel merged 2 commits into
trunkfrom
codex/frame-review-04-database-popups
Oct 21, 2026
Merged

adamziel merged 2 commits into
trunkfrom
codex/frame-review-04-database-popups

Conversation

@adamziel

@adamziel adamziel commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Part 4/10. Builds on #4478 · Next: #4480.

Keeps “Open Adminer” and “Open phpMyAdmin” connected to the running Playground after WordPress moves to a separate origin.

Why opening the tool directly can break

For example, the running Playground has this layout:

playground.wordpress.net             ← browser tab
└── wpsandbox.wordpress.net      ← WordPress iframe

WordPress runs in the browser, not on our web server. Its HTTP requests must reach the service worker that connects them to the running PHP instance.

Opening Adminer directly would make the WordPress origin the top-level page:

wpsandbox.wordpress.net/scope:abc/adminer/  ← new tab

WebKit can look up service workers using both the top-level origin and the WordPress origin. The new tab has changed the first value, so it can miss the worker serving the existing site. This is browser separation called partitioning. WebKit describes the rule here.

What this changes

Open a small page on the Playground origin and put the database tool inside its WordPress iframe:

playground.wordpress.net/wordpress-popup.html  ← new tab
└── wpsandbox.wordpress.net/scope:abc/adminer/

Both origins now match the running Playground. The tool can use its existing service worker, PHP instance, and database. The wrapper is just a full-window iframe. It does not boot another Playground or copy the database.

  • Use the wrapper only when WordPress and remote.html have different origins. Same-origin setups keep their direct URLs.
  • Accept only URLs on the configured WordPress origin with a /scope:…/ path.
  • Disable phpMyAdmin's attempt to escape its iframe for the split-origin setup.
  • Keep WordPress code on the WordPress origin. The surrounding app-origin page does not grant it direct access to the app's OPFS.

Not every browser needs the wrapper: Chrome can share the service-worker partition for same-site origins. Keeping the frame layout also covers browsers that separate it by the full top-level origin. Chrome's partition rules.

Testing

With WordPress on a separate origin, open Adminer and phpMyAdmin from the database panel. In each tool, browse a table, save a change, and confirm it appears in the running WordPress site. Repeat with a same-origin setup to check the direct tabs still work.

Summary by CodeRabbit

  • New Features

    • Added support for opening Adminer and phpMyAdmin in dedicated WordPress popup pages.
    • Preserved destination paths, query parameters, and fragments when opening external WordPress tools.
    • Added a full-screen, sandboxed popup experience for embedded WordPress pages.
    • Improved cross-origin framing safeguards for database management tools.
  • Bug Fixes

    • Improved popup loading and navigation behavior for database tools, including iframe-based popups.

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0a538ec9-dda5-4b34-ad91-4e97159efc00
📥 Commits

Reviewing files that changed from the base of the PR and between 4f51da0 and 8a9458f.

📒 Files selected for processing: 9
  • packages/playground/remote/src/lib/wordpress-popup.ts
  • packages/playground/remote/vite.config.ts
  • packages/playground/remote/wordpress-popup.html
  • packages/playground/tools/src/phpmyadmin/config.inc.php
  • packages/playground/website/playwright/e2e/website-ui.spec.ts
  • packages/playground/website/src/components/site-manager/site-database-panel/adminer-button.tsx
  • packages/playground/website/src/components/site-manager/site-database-panel/phpmyadmin-button.tsx
  • packages/playground/website/src/lib/wordpress-popup.spec.ts
  • packages/playground/website/src/lib/wordpress-popup.ts
+----------------------------------------------------------------------------------------------------------------------+
| Adapting old programs to fit new machines usually means adapting new machines to behave like old ones. - Alan Perlis |
+----------------------------------------------------------------------------------------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Base automatically changed from codex/frame-review-03-frame-messages to trunk October 21, 2026 17:31
adamziel added a commit that referenced this pull request Oct 21, 2026
Part 3/10. Builds on #4477 · Next: #4479.

WordPress reports its current URL to the parent frame. Reply to late
subscriptions, report History API changes, and relay outside clicks so
the app can dismiss its menus without reading the WordPress document.

Check the sending window and origin. Send app relay and WebMCP messages
to the configured WordPress origin. The WordPress plugin accepts its
parent origin from the PHP runtime; ordinary same-origin behavior stays
unchanged.

This prepares the frame messages for the origin switch later in the
stack. It does not enable that switch.

## Testing

The existing website and remote tests still run. Follow dashboard links,
change the address bar, dismiss a menu by clicking WordPress, and use a
WebMCP tool.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

- **New Features**
- Improved synchronization between embedded WordPress pages and the
browser address bar, including History API navigation.
  - Added reliable URL retrieval for embedded pages.
  - Added pointer-event relaying across nested frames.

- **Bug Fixes**
  - Prevented relayed pointer events from being handled more than once.
- Improved compatibility with plain HTML pages and nested editor frames.
- Strengthened iframe message validation and handling when embedded
content is unavailable.
  - Improved secure communication with embedded WordPress content.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@adamziel
adamziel force-pushed the codex/frame-review-04-database-popups branch from c5f7f59 to 8a9458f Compare October 21, 2026 17:39
@adamziel
adamziel added this pull request to stack #4489 October 21, 2026 17:39
@adamziel
adamziel merged commit e1bb2ae into trunk Oct 21, 2026
@adamziel
adamziel deleted the codex/frame-review-04-database-popups branch October 21, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant