Repository navigation
Conversation
XCFramework BuildThis PR's XCFramework is available for testing. Add the following to your .package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/840")Built from 804158c |
dcalhoun
force-pushed
the
fix/android-editor-document-replacement
branch
from
October 30, 2026 13:58
8e6f324 to
ee318cc
Compare
A script in the editor could load blob, data, or new-window documents into the editor's frame, leaving the host with an editor that drops commands and fails content reads. Local documents now load in subframes only, new windows hand http(s) URLs to the browser, and any other page that still reaches the main frame is replaced by the editor again. Opening a URL no app handles no longer crashes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A script that navigates on every load reloaded the editor forever, closed windows stayed alive until the view detached, and an oversized URL crashed the app when opening it externally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hidden new windows share the editor's renderer and left its death unhandled, which killed the app. Automatic reloads over a replacing page also re-armed the renderer recovery limit, which only the user's reload should do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dcalhoun
force-pushed
the
fix/android-editor-document-replacement
branch
from
October 30, 2026 20:00
ad7dea6 to
0965959
Compare
…he editor No editor mounts behind the error view shown after repeated replacements, so nothing reported an open dialog closed. Hosts kept Close disabled and Back was refused, leaving Reload Editor as the only way out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dcalhoun
marked this pull request as ready for review
October 30, 2026 20:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Close CMM-2460. Close #732.
Prevent other documents from replacing the editor, and stop URLs that can't be opened from crashing the host app.
Plugin scripts could replace the editor with an entirely different document, leaving editor controls that no longer work.
blob,data,about, andfileURLs in the main frame; they still load in subframeswindow.open()otherwise returns the editor's own window anddocument.writewipes it without a navigationonEditorUnavailable. After 3 reloads, show the error view with a Reload Editor action instead, so a script that navigates on every load can't reload forever. Either way, report open dialogs closed so hosts don't keep navigation blockedTrade-off: plugin previews or exports using
window.openwith ablobURL ordocument.writenow do nothing visible. A recovery reload restores the host's latest persisted content, so edits since the last save can be lost.Known limitation: a script that calls
window.open()and synchronously writes a network iframe into the new window crashes the app. This reproduces in a bareWebViewwithout GutenbergKit, so it appears to be a Chromium bug. Ontrunk, the same sequence wipes the editor instead.Testing instructions
Tip
The Chrome inspector seems to often timeout when using GutenbergKit's local dev server with an emulator. Consider using a physical device and/or a local production build instead (
make build).chrome://inspectand inspect the editor WebView.top.location.href = URL.createObjectURL(new Blob(['<h1>Not the editor</h1>'], { type: 'text/html' }))window.open(URL.createObjectURL(new Blob(['<h1>Popup</h1>'], { type: 'text/html' })))window.open().document.write('<h1>Written</h1>')window.open('https://example.org')location.href = 'unknown-scheme://example'window.open('https://example.org/' + 'a'.repeat(1900000))const f = document.createElement('form'); f.method = 'post'; f.action = 'https://example.com/'; document.body.append(f); f.submit()const i = document.createElement('iframe'); i.src = URL.createObjectURL(new Blob(['<p>Subframe</p>'], { type: 'text/html' })); document.body.append(i)Additional AI-generated details
A script in the editor could load another document into the editor's WebView, leaving editor controls that no longer work. This change:
about,blob,data, andfileURLs in subframes only.onCreateWindowwith a hidden WebView that sends http(s) URLs to the browser and drops the rest.window.close()never reachesonCloseWindowwithout it.RuntimeExceptionwhen opening URLs externally. A 1.9 MB URL throwsRuntimeException: Failure from system, caused byTransactionTooLargeException.onEditorUnavailable;reloadEditor()now loads the editor URL instead ofwebView.reload().onRenderProcessGonein the hidden WebView. Windows share the editor's renderer, and any WebView leaving it unhandled kills the app.Verified on an emulator (steps 1–5 above):
trunk, the blob snippets replace the editor andunknown-scheme://crashes the app.window.open()returns the editor's own window, sodocument.writewipes the editor without any navigation callback. Multiple-window support is required for that case.Known limitation, on one API 36 emulator and one WebView build, with each variant run once:
onCreateWindow, before any popup callback runs.onCreateWindowreturnsfalse, which loses the URL.🤖 Generated with Claude Code