Repository navigation
[Web] Load editor canvas assets with backtick iframe tags - #4532
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Extend iframe matching and test the post editor packages/playground/remote/service-worker.ts, packages/playground/website/playwright/e2e/service-worker-empty-html.spec.ts |
The rewrite matches iframe tag names enclosed in single quotes or backticks. Tests restore an omitted script, change the quote style, and check the editor canvas, title textbox, and service-worker controller. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related PRs
- WordPress/wordpress-playground#4522: This PR changes the same iframe-constructor match and supports single, double, and backtick quotes.
Suggested labels: [Package][@wp-playground] Remote, [Aspect] Service Worker, [Aspect] Browser, [Package][@wp-playground] Website
Suggested reviewers: janjakes
Merge Risk: 
Minimal · up to 07ff6
-
The change addresses the editor iframe asset-loading issue. No merge-blocking risk was identified.
Pre-merge checks: 
5
-
Full details: Linked Issues check
-
Explanation
[
#4531] Requirement: editor iframe assets load and the canvas is styled. Root cause: the service worker rewrite in packages/playground/remote/service-worker.ts matched only double-quoted("iframe",. Rolldown output uses backticks, so the canvas document did not receive the controlled-iframe wrapper and its assets returned 404. The change to/\(\s*(["'])iframe\1,/matches double quotes, single quotes, or backticks, and requires the same quote on both sides. The replacement(__playground_ControlledIframe,and the wrapper prefix are unchanged, so request routing is unchanged. The added Playwright tests (single quotes and backticks) assert that the canvas uses/wp-includes/empty.html`, that the 'Add title' textbox is visible, and that the canvas frame has a service worker controller. The fix addresses the reported cause. The live Gutenberg PR 85811 result is author-reported only and was not re-run during this review.
Full details: Out of Scope Changes check
-
Explanation
The PR changes two files. (1) packages/playground/remote/service-worker.ts (+2/-1) changes only the iframe-call regex, with a comment explaining the Rolldown backtick output. This directly implements [
#4531]. (2) packages/playground/website/playwright/e2e/service-worker-empty-html.spec.ts (+47) adds parameterized regression tests for single-quoted and backtick iframe calls. These tests support the same objective. No unrelated refactoring, feature, or configuration change appears in the reviewed whole-PR diff against the merge base.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.
-
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.
Comment @coderabbitai help to get the list of available commands.
Closes #4531.
Gutenberg's Rolldown output uses backticks around
iframe. Playground only matched double quotes, leaving the editor canvas as ablob:document without a service worker. CSS and font requests then reached the web server and returned 404.Accept matching double quotes, single quotes, or backticks. Keep the existing controlled-iframe wrapper and request routing.
Adds browser regressions for single quotes and backticks. The backtick case fails on trunk. Existing tests cover the older double-quoted output.
Before / after
Gutenberg PR #85811 on WordPress 7.1, using the built two-origin preview. Screenshots live on a separate image-only branch.
Testing
?gutenberg-pr=85811./wp-includes/empty.htmland its CSS and fonts load.Verified locally: 127 remote tests; Chromium and WebKit editor checks; remote and website type checks and lint. The exact Gutenberg PR also renders correctly at desktop and mobile widths. Firefox could not launch locally because of a macOS sandbox error.
Summary by CodeRabbit