Skip to content

Runtime.callFunctionOn returns an empty value on debugging #166

@RedMickey

Description

@RedMickey

Hello, we are the development team of VS Code extension for debugging React Native apps (vscode-react-native). Now we are working on React Native Hermes debugger and we've faced the problem related to usage of Chrome DevTools Protocol method callFunctionOn. We use vscode-chrome-debug-core library to communicate with Hermes debugger. Some functions of the library (e.g. getNumPropsByEval) use Chrome DevTools Protocol method Runtime.callFunctionOn. But each call of this method returns the following response "{"result":{},"id":someId}" - an empty result object. We tried to call Runtime.callFunctionOn function with different parameters, but the result remained the same.
Below is the list of the function calls with different arguments that we tried:

  1. For example in case of usage of getNumPropsByEval method, the Runtime.callFunctionOn function is used to evaluate the length of the watched array. Below there is an example of the function call:
        this.chrome.Runtime.callFunctionOn({
            objectId,    // 121 
            functionDeclaration: " function() { return [this.length, Object.keys(this).length - this.length + 2]; }",
            silent: true,
            returnByValue: true
        })
  1. The function should only return a static array. Without silent mode.
        this.chrome.Runtime.callFunctionOn({
            objectId,    // 121 
            functionDeclaration: "function() { return [0, 2]; }",
            silent: false,
            returnByValue: true
        })
  1. The function should return process variable. Doesn't provide objectId prop and without silent mode.
        this.chrome.Runtime.callFunctionOn({
            functionDeclaration: "function() { return process; }",
            silent: false,
            returnByValue: true
        })

For all cases that are described above the callFunctionOn method returns empty result object.
Runtime.callFunctionOn method also doesn't return any error messages.

Could you please tell us if Runtime.callFunctionOn method is implemented in Hermes debugger and if it is, how can we use it?

For reference: the list of known issues with Hermes debugging for React Native Tools extension.

react-native info command output:

System:
    OS: macOS 10.15.2
    CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
    Memory: 33.88 MB / 32.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.16.3 - /usr/local/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 23, 25, 27, 28, 29
      Build Tools: 23.0.1, 25.0.1, 25.0.2, 27.0.3, 28.0.3, 29.0.0, 29.0.1
      System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5692245
    Xcode: 11.3/11C29 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.5 => 0.61.5 
  npmGlobalPackages:
    react-native-cli: 2.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions