cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Björn Andersson (JIRA) <j...@apache.org>
Subject [jira] [Updated] (CB-5203) Using XmlHTTPRequest.open on WP8 raises a TypeError
Date Fri, 25 Oct 2013 18:16:34 GMT

     [ https://issues.apache.org/jira/browse/CB-5203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Björn Andersson updated CB-5203:
--------------------------------

    Description: 
Using the {{cordova-app-hello-world}} code on a WP8 device, connected to the device through
weinre, trying to use XMLHTTPRequest like this:

{code:language=javascript}
var xhr = new XMLHttpRequest();
xhr.open('GET', 'js/index.js', true);
xhr.send();
console.log(xhr.responseText);
{code}

An error is raised at {{xhr.open}}: {{TypeError: Object doesn't support property or method
'addEventListener'}}

The same code on iOS runs through and shows me the content of {{index.js}}.

Changing the call to:

{code:javascript}
var xhr = new XMLHttpRequest();
xhr._url = 'js/index.js';
xhr.send();
console.log(xhr.responseText);
{code}

Returns the expected result.

I also noticed that {{XMLHttpRequest.prototype.open}} does not match the code in {{cordovalib\XHRHelper.cs}}:

{code:title=XMLHttpRequest.prototype.open|javascript}
function() {
var result;
callBeforeHooks(hookSite, this, arguments);
try {
result = func.apply(this, arguments);
} catch (e) {
callExceptHooks(hookSite, this, arguments, e);
throw e;
} finally {
callAfterHooks(hookSite, this, arguments, result);
}
return result;
}
{code}

GitHub repository with the code I used: https://github.com/gaqzi/cordova-wp8-xhr-test

  was:
Using the {{cordova-app-hello-world}} code on a WP8 device, connected to the device through
weinre, trying to use XMLHTTPRequest like this:

{code:language=javascript}
var xhr = new XMLHttpRequest();
xhr.open('GET', 'js/index.js', true);
xhr.send();
console.log(xhr.responseText);
{/code}

An error is raised at {{xhr.open}}: {{TypeError: Object doesn't support property or method
'addEventListener'}}

The same code on iOS runs through and shows me the content of {{index.js}}.

Changing the call to:

{code:javascript}
var xhr = new XMLHttpRequest();
xhr._url = 'js/index.js';
xhr.send();
console.log(xhr.responseText);
{/code}

Returns the expected result.

I also noticed that {{XMLHttpRequest.prototype.open}} does not match the code in {{cordovalib\XHRHelper.cs}}:

{code:title=XMLHttpRequest.prototype.open|javascript}
function() {
var result;
callBeforeHooks(hookSite, this, arguments);
try {
result = func.apply(this, arguments);
} catch (e) {
callExceptHooks(hookSite, this, arguments, e);
throw e;
} finally {
callAfterHooks(hookSite, this, arguments, result);
}
return result;
}
{/code}

GitHub repository with the code I used: https://github.com/gaqzi/cordova-wp8-xhr-test


> Using XmlHTTPRequest.open on WP8 raises a TypeError
> ---------------------------------------------------
>
>                 Key: CB-5203
>                 URL: https://issues.apache.org/jira/browse/CB-5203
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: WP8
>    Affects Versions: 3.1.0
>         Environment: Windows 8, MS Visual Studio Express 2012 for Windows Phone version
11.0.60610.01 Update 3. .NET version 4.5.50709. Weinre 2.0.0-pre-HH0SN197
>            Reporter: Björn Andersson
>            Assignee: Jesse MacFadyen
>
> Using the {{cordova-app-hello-world}} code on a WP8 device, connected to the device through
weinre, trying to use XMLHTTPRequest like this:
> {code:language=javascript}
> var xhr = new XMLHttpRequest();
> xhr.open('GET', 'js/index.js', true);
> xhr.send();
> console.log(xhr.responseText);
> {code}
> An error is raised at {{xhr.open}}: {{TypeError: Object doesn't support property or method
'addEventListener'}}
> The same code on iOS runs through and shows me the content of {{index.js}}.
> Changing the call to:
> {code:javascript}
> var xhr = new XMLHttpRequest();
> xhr._url = 'js/index.js';
> xhr.send();
> console.log(xhr.responseText);
> {code}
> Returns the expected result.
> I also noticed that {{XMLHttpRequest.prototype.open}} does not match the code in {{cordovalib\XHRHelper.cs}}:
> {code:title=XMLHttpRequest.prototype.open|javascript}
> function() {
> var result;
> callBeforeHooks(hookSite, this, arguments);
> try {
> result = func.apply(this, arguments);
> } catch (e) {
> callExceptHooks(hookSite, this, arguments, e);
> throw e;
> } finally {
> callAfterHooks(hookSite, this, arguments, result);
> }
> return result;
> }
> {code}
> GitHub repository with the code I used: https://github.com/gaqzi/cordova-wp8-xhr-test



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message