[
https://issues.apache.org/jira/browse/CB-12218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15755028#comment-15755028
]
Alan Kinzie commented on CB-12218:
----------------------------------
I was not able to find a repro case with an official cordova plugin. I didn't
do a completely exhaustive search, but it seems that cordova plugins tend to
call the error callback instead of calling success with null. However, to help
out (hopefully) I have attached a zipped project that demonstrates the issue.
Something I noticed while creating the sample project was that the EVAL_BRIDGE
is not consistent with itself. If the success callback is called with null
from the main thread, the javascript will get result===null (this is consistent
with ONLINE_EVENT, and is what I would expect). If the success callback is
called with null from a worker thread then the javascript will get result==="".
> inconsistent null handling between EVAL and ONLINE bridge modes
> ---------------------------------------------------------------
>
> Key: CB-12218
> URL: https://issues.apache.org/jira/browse/CB-12218
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 6.0.0
> Environment: Android
> Reporter: Alan Kinzie
> Attachments: CB12218.zip
>
>
> If the Android native code invokes the success callback like this:
> callbackContext.success(null);
> then the value given to the javascript callback changes depending on the
> bridge type used.
> If the ONLINE_EVENT type is used, then null will be passed to the javascript
> callback.
> ie: if result is the parameter of the javascript success callback then
> result === null // will be true
> result === "" // will be false
> If the EVAL_BRIDGE type is used, then an empty string will be passed to the
> javascript callback.
> ie: if result is the parameter of the javascript success callback then
> result === null // will be false
> result === "" // will be true
> The value of the parameter given to the success callback should not change
> depending on the bridge type. Since ONLINE_EVENT was the default before
> cordova android 6.0.0, I am inclined to think the ONLINE bridge is doing the
> correct behaviour. Also, converting null to an empty string loses
> information. Therefore I think the EVAL mode should to be changed to be
> consistent with the ONLINE mode.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]