You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
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.
Wow, looks like that line has been in there since the code was originally written 6 years ago!
I have no idea what the reason was for that originally but it a) looks like a rather ugly hack, b) doesn't look safe as there are no bounds checks on the variable and c) frankly doesn't make any sense.
That said, I've modified it in dec3258 and the module tests are still passing.
While working with the executeJS function of the tabs module I found an issue.
Sample Code
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:
trigger.io-tabs/inspector/an-inspector/ForgeModule/flavors/crosswalk/src/io/trigger/forge/android/modules/tabs/WebViewProxy.java
Line 190 in 20a21d5
I also couldn't get into the
value==null
path.How is the recommended way to return a value from an injected JS function?
The text was updated successfully, but these errors were encountered: