executeScript_Sandbox errors on a `null` return value and removes them in an array as return value

Hello,

The executeScript_Sandbox command errors when null is in the return value or just removes them from nested arrays.

On the contrary, executeScript commands handles them just fine.

Test Environment/s
Chrome on Linux with UI.Vision V1.9.5
No XModules installed
Clean Profile (i.e., no other extensions installed, clean cookies and history, all default settings)

Edge on Windows 10 with UI.Vision V1.9.3
No XModules installed

Expected Behavior: Handle and return null as it is done by ExecuteScript
Observed Behavior: Errors on “null” and if returning a nested array removes all null elements within the nested array.

Test Macro:

{
  "Name": "NullStripper",
  "CreationDate": "2024-4-17",
  "Commands": [
    {
      "Command": "executeScript_Sandbox",
      "Target": "return [[1,null,3,null,5,null,7,null,9]];",
      "Value": "NS_ARRAY",
      "Description": "This will write a nested array to NS_ARRAY but will remove all nulls and mess up the positions of the elements."
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return [420,69,null];",
      "Value": "",
      "Description": "This line will throw an error."
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return null;",
      "Value": "",
      "Description": "This line will also throw an error"
    }
  ]
}

WORKAROUND:
For now, the workaround on this is to return the JSON wrapped version with JSON.stringify. Then, use JSON.parse to unwrap it on the next executeScript*.

Or, just use the regular executeScript, or avoid having your executeScript_Sandbox commands return null?

Thanks for reporting this issue, I confirmed it and we will try to solve it with the next update.

Background info: For technical reasons executeScript_Sandbox needs to use its own JS interpreter. The non-sandbox executeScript runs inside the web browser and can use the Chrome V8 engine or the Firefox equivalent Spidermonkey.