[ https://issues.apache.org/jira/browse/CB-5219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13874814#comment-13874814 ]
Sergey Grebnov commented on CB-5219: ------------------------------------ Weinre fails due to Cordova XHR shim does not pass event argument for xhr.onreadystatechange event handler https://github.com/apache/cordova-wp8/blob/master/wp8/template/cordovalib/XHRHelper.cs#L121 Weinre tries to accesss argument.target property and crashes. xhr.onreadystatechange = _xhrEventHandler; ... _xhrEventHandler = function(event) { var xhr; xhr = event.target; if (xhr.readyState !== 4) { return; } return xhr.httpSocketHandler.call(xhr.httpSocket, xhr); }; If I patch cordova to correctly pass argument to onreadystatechange event handler then problem goes away. // mimic 'readystatechange' event; // TODO we can alternatively create a real event via document.createEvent('Event') but I don't think this is necessary here var evt = {type: 'readystatechange', target: this, timeStamp: new Date().getTime()}; this.onreadystatechange(evt); This part si simple, but I also want to spend some additional time to understand why onreadystatechange event is called at all. My understanding is that it should not be called in case of history.replaceState > weinre disconnects when history.replaceState is used > ---------------------------------------------------- > > Key: CB-5219 > URL: https://issues.apache.org/jira/browse/CB-5219 > Project: Apache Cordova > Issue Type: Bug > Components: weinre, WP8 > Affects Versions: 3.1.0 > Environment: Windows 8, Visual Studio 2012 > Reporter: Björn Andersson > Assignee: Sergey Grebnov > > I got an app that uses weinre and when developing on Android, BB10 and iOS I > never had any issues. But on WP8 it kept disconnect pretty much instantly > after connecting. > I found that if I do: > {code} > history.replaceState(null, 'weinre, say bye-bye', '/some-fake-url') > {code} > Weinre will disconnect. I've tried this with the Cordova hello world app and > just adding in that line above disconnects weinre. -- This message was sent by Atlassian JIRA (v6.1.5#6160)