Skip to content

prototype: Browser support Map<String,Object> (JS objects) in JSON codec - #3494

Open
laeubi wants to merge 1 commit into
eclipse-platform:masterfrom
laeubi:simple_object_support_for_browser
Open

prototype: Browser support Map<String,Object> (JS objects) in JSON codec#3494
laeubi wants to merge 1 commit into
eclipse-platform:masterfrom
laeubi:simple_object_support_for_browser

Conversation

@laeubi

@laeubi laeubi commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Currently BrowserFunction/Evaluate only supports primitives and arrays but not objects.

This is a prototype to add support for having a Map<String, Object> support, but is not complete because Object/Map support is inconsistent across the 4 native backends because they use two different marshalling strategies:

┌────────────────────────┬────────────────────────────────────────────┬─────────────────────────────────────────┐
│ Backend                │ evaluate() return                          │ BrowserFunction args/return             │
├────────────────────────┼────────────────────────────────────────────┼─────────────────────────────────────────┤
│ Edge (win32)           │ via JSON.parse/stringify                   │ via JSON.parse/stringify                │
├────────────────────────┼────────────────────────────────────────────┼─────────────────────────────────────────┤
│ WebKitGTK              │ native jsc_value/JSValueRef walk (no JSON) │ via JSON.parse/stringify                │
├────────────────────────┼────────────────────────────────────────────┼─────────────────────────────────────────┤
│ Cocoa (legacy WebView) │ native WebScriptObject walk (no JSON)      │ native WebScriptObject walk (no JSON)   │
├────────────────────────┼────────────────────────────────────────────┼─────────────────────────────────────────┤
│ IE (win32 legacy)      │ native IDispatch/Variant walk (no JSON)    │ native IDispatch/Variant walk (no JSON) │
└────────────────────────┴────────────────────────────────────────────┴─────────────────────────────────────────┘

So  JSON.java  is only the actual conversion path for Edge (fully) and for WebKitGTK's  BrowserFunction  call marshalling (function args come in via a  swt://  URL query string that's JSON-encoded, and the return value is JSON-stringified back to JS). The other native paths inspect JS values directly (JSC API, WebScriptObject, IDispatch) and only ever check for arrays via a  length  property/index — no key enumeration exists for plain objects.

I still wanted to share this here for gathering feedback of others, if such partial support would be helpful (windows+linux) and possibly ideas how we can streamline this across different OS. My main workaround currently is to start a local webserver and using rest calls, but this is a bit brittle and not always possible due to restricted environments.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

  212 files  ±0    212 suites  ±0   28m 51s ⏱️ + 1m 5s
4 894 tests ±0  4 870 ✅ ±0   24 💤 ±0  0 ❌ ±0 
7 065 runs  ±0  6 897 ✅ ±0  168 💤 ±0  0 ❌ ±0 

Results for commit 0108851. ± Comparison against base commit 4755f49.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant