[ 
https://issues.apache.org/jira/browse/CB-8042?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14225884#comment-14225884
 ] 

JoeSong commented on CB-8042:
-----------------------------

OK. I got this error with Android cordova 3.6.4 via Cordova CLI 4.1 on Android 
Emulator 4.0 and 4.0.3. So, I tried to google and found there is an fixing of 
issue CB-7868. The code changing can be saw by this link: 
https://github.com/apache/cordova-js/pull/88. Then, I apply this changes in my 
local cordova.js file and run the test again. It still failed. Then, I also 
apply the following change in my local cordova.js:
***************
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; }
);
*************

Then, it works well. 

I got the IOS Cordova 3.7 via Crodova CLI 4.1 and double checked the 
cordova.js. I just found the code change with the 
link:https://github.com/apache/cordova-js/pull/88 were applied on Cordova 3.7. 
But, I didn't see the code change on function clobber like above. So, I just 
want to confirm that the two code changes, 
https://github.com/apache/cordova-js/pull/88 and above 'clobber ' function 
should be the solution to fix the issue on Android Cordova 3.7.0. right?

Also, attached please find the updated cordova.js on 3.6.4 with the two 
changes. It works fine for me now.

> Still got the error “Cannot set property connection of #<Navigator>” with 
> fixing of CB-7868 on Android cordova 3.6.4
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: CB-8042
>                 URL: https://issues.apache.org/jira/browse/CB-8042
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, CordovaJS
>            Reporter: JoeSong
>            Assignee: Joe Bowser
>         Attachments: cordova.js
>
>
> 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. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to