Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wasm][debugger] Implement
Runtime.callFunctionOn
, and support arra…
…y expansion (#35156) - This was prompted by vscode/vs requiring this for array expansion. - It runs a given js function string, on a given object id. - We handle the case for dotnet object ids. Implementation: - We build a proxy object that reflects the details of the real dotnet object/array - And run the js function on that proxy object - Then if `returnByValue` was requested, the result is returned as-is - Else we cache that object, with a new special object id (`dotnet:cfo_res:..`), and return that id in the response. - Subsequently, we would get `Runtime.getProperties` request on this new object id - And a `Runtime.releaseObject` request, to free that function result. - All this is handled currently Tests: - A few tests were added which invoke `callFunctionOn`, on JS objects, and checks the result - And the same checks are performed on equivalent dotnet objects, with the same js function - This should help stay in sync with what we think `callFunctionOn` should work as - These tests have an additional parameter - `roundtrip`, which calls a simple function `function () { return this; }` .. on a dotnet object, and gets the result object id. If `roundtrip == true`, then it runs that same function on the result object, and gets a new result object id. And the tests run their checks on that. - this helps to check that outside of the proxy, the result object behaves same as any other dotnet object. - Also, most of the tests were modified to support an additional mode (`use_cfo`). - With this, whenever a test wants to run `Runtime.getProperties on an object, we pass that object through the earlier "identity" function, and then run `getProperties` on that resultant object. - This helps to take advantage most of the existing tests, and use them for `callFunctionOn` testing too, by ensuring that the results of CFO returns results same as any other object. Fixes mono/mono#19229, mono/mono#19531 Co-authored-by: radical <[email protected]>
- Loading branch information