Skip to content

Commit acd6641

Browse files
committed
Fixed the current startup blocker in the worker/main-thread bridge path
1 parent 5fb5575 commit acd6641

8 files changed

Lines changed: 498 additions & 46 deletions

File tree

Ports/JavaScriptPort/STATUS.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
JavaScript Port Status (ParparVM)
44
=================================
55

6-
Last updated: 2026-04-09
6+
Last updated: 2026-04-10
77

88
Current State
99
-------------
@@ -38,14 +38,22 @@ Current State
3838
- `DataCloneError: Failed to execute 'postMessage' ... function(...) could not be cloned`
3939
- cause: non-cloneable callback/function payload crossing worker host-call boundary.
4040
- mitigation added: runtime host-call argument sanitization (`toHostTransferArg`) before `emitVmMessage`.
41+
- Latest CI artifact (`~/Downloads/javascript-ui-tests/browser.log`) first blocker is:
42+
- `Error: Missing host receiver for JSO bridge`
43+
- stack points to worker runtime host-callback error after `__cn1_jso_bridge__`.
44+
- Additional fix applied (not yet CI-verified):
45+
- worker JSO host-call request now includes `receiverClass` hint.
46+
- host bridge now attempts class-based receiver fallback (`Window`/`Document` and `JSOImplementations_*` classes) before throwing.
47+
- missing-receiver diagnostics now also emit `hostReceiverClass`.
4148
- Existing form-constructor recovery diagnostics remain active in `port.js` and are still relevant while migrating.
4249

4350
Next Steps
4451
----------
4552

46-
1. Validate latest host-call serialization fix in CI artifacts:
47-
- Check whether first failure moved off `DataCloneError`.
48-
- If still present, capture offending host symbol + argument type and add explicit callback-handle transport (not null coercion) for that symbol.
53+
1. Validate latest JSO receiver rehydration fix in CI artifacts:
54+
- Check whether first failure moved off `Missing host receiver for JSO bridge`.
55+
- Confirm new diagnostics include `hostReceiverClass` when missing.
56+
- If still present, capture exact failing symbol/member/class and add targeted fallback for that class.
4957
2. Continue worker-only boot validation:
5058
- Required markers: `PARPAR:worker-mode`, `PARPAR:DIAG:BOOT:bridgeMode=worker`.
5159
- Any `main-thread-mode` marker now indicates stale artifact or wrong bundle.
@@ -62,14 +70,11 @@ Next Steps
6270
- Exit gate remains `CN1SS:SUITE:FINISHED` with expected screenshot artifacts and no `BROWSER:PARPAR_ERROR`.
6371

6472
Important Notes
65-
--------------
73+
---------------
6674

67-
- Current local debug artifact (`/tmp/js-ci-debug/browser.log`) shows:
68-
- `PARPAR:worker-mode`
69-
- `PARPAR:DIAG:BOOT:bridgeMode=worker`
70-
- `TOP_BLOCKER=runtime_error|none|none`
71-
- first crash currently as `DataCloneError` during worker->host message transport.
72-
- This indicates startup has progressed beyond initial null DOM receiver failure and is now blocked by host-call payload transport semantics.
75+
- This Codex environment currently cannot run the local browser harness end-to-end due sandbox socket restrictions:
76+
- `PermissionError: [Errno 1] Operation not permitted` from `javascript_browser_harness.py` bind.
77+
- CI artifacts remain the source of truth for runtime progression.
7378

7479
Known Important Context
7580
-----------------------

Ports/JavaScriptPort/src/main/java/com/codename1/impl/html5/HTML5BrowserComponent.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,10 @@ private void uncancelScroll() {
245245
@JSBody(params={"doc", "str"}, script="doc.write(str)")
246246
private static native void documentWrite(HTMLDocument doc, String str);
247247

248-
@JSBody(params={}, script="!!(\"srcdoc\" in document.createElement(\"iframe\"))")
248+
@JSBody(
249+
params={},
250+
script="var d=(typeof document!=='undefined'&&document)?document:((typeof window!=='undefined'&&window.document)?window.document:null);"
251+
+ "return !!(d&&('srcdoc' in d.createElement('iframe')));")
249252
private static native boolean supportsSrcdocAttribute();
250253
private boolean supportsSrcdocAttribute;
251254

Ports/JavaScriptPort/src/main/java/com/codename1/impl/html5/HTML5Implementation.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7188,7 +7188,10 @@ public PeerComponent createBrowserComponent(Object browserComponent) {
71887188
if (browserComponent instanceof SystemBrowserComponent) {
71897189
return new HTML5BrowserComponent(null, browserComponent);
71907190
}
7191-
HTMLIFrameElement el = (HTMLIFrameElement)window.getDocument().createElement("iframe");
7191+
// In ParparVM worker/host bridging, createElement("iframe") can be surfaced as a
7192+
// generic HTMLElement wrapper. Keep this typed as HTMLElement to avoid strict cast
7193+
// failures while still constructing the browser peer correctly.
7194+
HTMLElement el = window.getDocument().createElement("iframe");
71927195
//HTMLIFrameElement el = createBlankIFrame();
71937196

71947197
HTML5BrowserComponent browser = new HTML5BrowserComponent(el, browserComponent);

0 commit comments

Comments
 (0)