Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-12218

inconsistent null handling between EVAL and ONLINE bridge modes

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.0.0
    • Fix Version/s: None
    • Component/s: cordova-android
    • Labels:
      None
    • Environment:

      Android

      Description

      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.

        Attachments

        1. CB12218.zip
          10.39 MB
          Alan Kinzie

          Issue Links

            Activity

              People

              • Assignee:
                bowserj Joe Bowser
                Reporter:
                akinzie Alan Kinzie
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: