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

Still got the error “Cannot set property connection of #<Navigator>” with fixing of CB-7868 on Android cordova 3.6.4

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • cordova-android, cordova-js
    • None

    Description

      Android Cordova 3.6.4 breaks the compatibility with some versions of Android(4.0 and 4.0.3). The app won't load.

      The console print the "TypeError “Cannot set property connection of #<Navigator>”" . Then, it cause the device ready event can't be fired.

      There is another issue CB-7868 also mention this error. Also, I tried to merge the fixing of CB-7868,https://github.com/apache/cordova-js/pull/88, into my project. But, I still get the same error only on Android 4.0(API 14) and Android 4.0.3(API 15) emulator.

      Then, I merge the following fixing mentioned by Andrew Grieve on CB-7868. It works now.
      ***************
      function clobber(obj, key, value) {
      exports.replaceHookForTesting(obj, key);

      • obj[key] = value;
        + var needsProperty = false;
        + try { + obj[key] = value; + }

        catch (e)

        { + needsProperty = true; + }

        // Getters can only be overridden by getters.

      • if (obj[key] !== value) {
        + if (needsProperty || obj[key] !== value) {
        utils.defineGetter(obj, key, function() { return value; }

        );
        *************

      I also get the IOS cordova 3.7.0. I found the fixing with https://github.com/apache/cordova-js/pull/88 has been applied. But, the function, clobber , still don't has above fixing.

      So, my question is that, what's the right fixing for the error.

      Attachments

        1. cordova.js
          61 kB
          JoeSong

        Issue Links

          Activity

            People

              bowserj Joey Robert Bowser
              JoeSong JoeSong
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: