The symptom
The invite screen of Chatter3 lets you share the app with a friend. Each share button opens a small window with the share page in it. On Android and iOS that is a new browser tab, and it works. In the HarmonyOS build the app froze the moment the button was pressed: the screen stopped responding, the page behind it stopped answering taps, and the only way out was to kill the app.
This was the first of the six findings in the Huawei AppGallery review of 11 November 2026, and the one that made the build a rejection rather than a warning. The reviewer had followed the instructions on the invite screen, which is exactly what a reviewer does.
What the code did
The page opens the share window with window.open(). ArkWeb turns that into an onWindowNew event, and the host app has to answer it with a controller that will render the new window. Version 1.0.7 answered it like this:
private openPopup(event: OnWindowNewEvent): void {
try {
this.popupUrl = event.targetUrl ? event.targetUrl : '';
event.handler.setWebController(this.popupController); // a controller nobody renders
this.showPopup = true;
} catch (err) {
try { event.handler.setWebController(null); } catch (ignore) {}
}
}
popupController was a WebviewController created in the handler. No Web component in the tree ever had it. The ArkWeb API reference says, about a window request that is not handed a controller that is already being rendered:
若不调用 setWebController 接口,会造成 render 进程阻塞
— a window request that is not given a controller that is rendered blocks the render process. The render process is the part of the engine that draws the page and answers touches. Once it was blocked, the app was not slow: it was gone, until the process was killed.
Nothing in the code is wrong in isolation. The controller is created, the URL is read, the error path is even handled. The mistake is an ordering relationship between two components — and it only shows up when the user presses a button on one screen while the engine is asked to render another.
The fix
The window the page asks for is now rendered by a second Web component that is part of the tree from the start. Its controller is therefore already attached to a rendered component when setWebController() is called, and there is no window in which the engine can be asked to render a controller that does not exist on screen.
/**
* The controller of the window the page asks for.
*
* It is created once, and the Web component that renders it is part of the
* component tree from the start. That is the whole point: the ArkWeb
* documentation says that a window request whose controller is not
* rendered blocks the render process.
*/
private popupController: webview.WebviewController = new webview.WebviewController();
private openPopup(event: OnWindowNewEvent): void {
try {
this.popupUrl = event.targetUrl ? event.targetUrl : '';
// The controller is already attached to a Web component (the one that is
// always in the component tree), so the engine can put the new window
// into it without blocking.
event.handler.setWebController(this.popupController);
this.showPopup = true;
} catch (err) {
// The engine has to be told that no new window was created, otherwise
// the render process blocks.
try { event.handler.setWebController(null); } catch (ignore) {}
}
}
Three things changed with it, and each one is a decision rather than a detail:
- The window shows its own address bar. The share page is a third‑party site. The user can see where they are, and the address is read from the controller as the window navigates.
- The window is sandboxed. A window request can come from a frame, so the new window gets no camera, no microphone, no storage and no windows of its own.
- The web side no longer waits forever. Every share call in the page has an eight‑second deadline and always reports an outcome, so a host that cannot open a share sheet still tells the user what happened. In the HarmonyOS build there is no share sheet at all: the file is shown in an overlay inside the page.
The rule that keeps it fixed
A bug this easy to reintroduce needs a rule, not a memory. The house rules of the project — the file an automated code review reads before it says anything — now carry it verbatim:
1. THE WINDOW. The requested Web window is rendered by a SECOND Web
component that is always present in the tree, because the controller is
attached when setWebController() is called; a render-process block is
documented for the other order. Never suggest moving the window into a
conditional branch or creating it on demand.
The same rules file carries the three other constraints of this build: the system permissions are asked at the moment the page asks for them and the page is granted only what the system granted; mailto:, sms: and tel: are blocked; and the version name and version code have to match the build that goes to the store.
What is left
The fix could not be tested on a real HarmonyOS phone in the lab: the emulator on the build machine had device profiles but no system image, which is a multi‑gigabyte download behind an interactive licence. So the evidence for this note is the documentation, the code, and the fact that the shell no longer contains a path where the controller can be unrendered. A reviewer with a physical device is still the right final check, and that is one of the reasons this note is public.
← All notes · Next: the camera that was granted and still denied →