Skip to content

Different behaviour of execute JS between Android and IOS #26

Open
@Ninerian

Description

@Ninerian

While working with the executeJS function of the tabs module I found an issue.

Sample Code

function y (result) { console.log('result',result)}
function x () {  return [[{"ss":"zz"}]]; }

// a native tab, bound to a global variable
window.testTab.executeJS('(' + x.toString() + ')();',y)

Expected Result

A log entry with: [FORGE] '[[{"ss":"zz"}]]'

Actual Result

Android log entry: [FORGE] '[{"ss":"zz"}]'
IOS log entry: [FORGE] '[[{"ss":"zz"}]]'

On android the first and last character is removed from the output. This makes it impossible to send a valid JSON string as return value and parse it on the application side. Also if nothing is return, the callback parameter is ul, as null gets the same handling.

It think this line causes the behaviour:

I also couldn't get into the value==null path.

How is the recommended way to return a value from an injected JS function?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions