incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Mueller (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-1666) [weinre] "INVALID_STATE_ERR: DOM Exception 11" with chbrody/Cordova-SQLitePlugin
Date Wed, 17 Oct 2012 13:26:03 GMT

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

Patrick Mueller commented on CB-1666:
-------------------------------------

Couple of q's:

- what version of Cordova are you using?
- what version of iOS are you using?  Does it do the same thing on other versions of iOS?
- wanted to double-check that this error message is just spurious, and shouldn't be displayed,
but is not hindering your app in any way.

Looking at the code, I honestly can't see how this is even happening, at least with the current
level of Cordova code.  It seems like the XHR in question must be a "/!gap" XHR request, as
part of the exec() impl [1], but ... it doesn't add any handlers, and so I don't see how it
could "close" (or something) the XHR.

I suppose it may be related to accessing the XHR responseText attribute if it's "not text"
or something [2].  It would be nice to know if that's ALL we had to wrap, but ... this all
seems so sketchy, it seems like wider-ranging try/catch would be safer.

Seems like the safest thing to do is to put a try/catch around the getXhrEventHandler() function
in NetworkRequest [3].  This may result in some XHR requests in weinre as not being complete,
but there were going to be SOME KIND of problem with such requests anyway, apparently :-)

I've seen some seemingly spurious but innocuous "INVALID_STATE_ERR: DOM Exception blah blah"
messages before, but never nailed down where they were coming from.  Hopefully this will get
rid of some/most/all of them!

Thoughts?

[1] https://github.com/apache/incubator-cordova-js/blob/master/lib/ios/exec.js#L124
[2] http://www.w3.org/TR/XMLHttpRequest/#the-responsetext-attribute
[3] https://github.com/apache/incubator-cordova-weinre/blob/master/weinre.web/modules/weinre/target/NetworkRequest.coffee#L189

                
> [weinre] "INVALID_STATE_ERR: DOM Exception 11" with chbrody/Cordova-SQLitePlugin
> --------------------------------------------------------------------------------
>
>                 Key: CB-1666
>                 URL: https://issues.apache.org/jira/browse/CB-1666
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: weinre
>    Affects Versions: 2.1.0
>         Environment: OS X Lion 10.7.4, Google Chrome 22.0.1229.94, iOS6 iPhone Simulator
>            Reporter: Christiaan van Zyl
>            Assignee: Patrick Mueller
>
> When using weinre with Cordova-SQLitePlugin we get a javascript error:
> "INVALID_STATE_ERR: DOM Exception 11: An attempt was made to use an object that is not,
or is no longer, usable. File: http://192.168.1.169:1337/target/target-script-min.js?_=1350463351336
Line Number: 2794"
> Above line number corresponds to the function NetworkRequest.prototype.handleDone in
target-script-min.js.
> As a work around I have just wrapped a try catch and made it fail silently:
> NetworkRequest.prototype.handleDone = function() {
>     try {
>         var description, sourceString, status, statusText, success, time;
>         sourceString = this.xhr.responseText;
>         Weinre.wi.NetworkNotify.setInitialContent(this.id, sourceString, "XHR");
>         time = Date.now() / 1000.0;
>         status = this.xhr.status;
>         if (status === 0) {
>             status = 200;
>         }
>         statusText = this.xhr.statusText;
>         success = status >= 200 && status < 300;
>         if (success) {
>             return Weinre.wi.NetworkNotify.didFinishLoading(this.id, time);
>         } else {
>             description = "" + status + " - " + statusText;
>             return Weinre.wi.NetworkNotify.didFailLoading(this.id, time, description);
>         }
>     } catch (e) {
>         return;
>     }
> };

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message