Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
boyanov
Posts: 22
Registered: ‎02-12-2010
My Device: BlackBerry Bold
Accepted Solution

XMLHttpRequest predefined values for LOADING, DONE, etc. appear undefined under Ripple

[ Edited ]

I am using XMLHttpRequest to call a REST services.

 

When testing is under Mozilla and Chrome everything works just fine.

 

Although, when I enabled the Ripple under Chrome it stopped working. After some debugging I found out that in the switch/case statement, where I do something like ...

 

switch (this.readyState) {
 case XMLHttpRequest.DONE: ... some code here ... break;
}

... the "case" does not get fired.

 

Closer examination determined that all the values XMLHttpRequest.* are undefined so that is the reason my code stopped working.

Q: Why XMLHttpRequest readyState values, otherwise well defined, become undefined under Ripple?

Are there any solutions for that issue, other than using plain numbers like 1, 2, 3, 4 or defining the values myself.

 

Contributor
boyanov
Posts: 22
Registered: ‎02-12-2010
My Device: BlackBerry Bold

Re: XMLHttpRequest predefined values for LOADING, DONE, etc. appear undefined under Ripple

Here is a testing script that I've used to determine the poblem above ...

 

<html>
<body>
<div id="log"></div>
<script type="text/javascript">
document.getElementById("log").innerHTML = "XMLHttpRequest.DONE=" + XMLHttpRequest.DONE + "<br />\n";
</script>
</body>
</html>

Under Chrome it gives XMLHttpRequest.DONE=4

Under Ripple it gives XMLHttpRequest.DONE=undefined


BlackBerry Development Advisor
twindsor
Posts: 832
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: XMLHttpRequest predefined values for LOADING, DONE, etc. appear undefined under Ripple

Are you using the latest version of Ripple - the Chrome extension beta? I just tested and the value is there.

Tim Windsor
Open Source Technical Lead
Contributor
boyanov
Posts: 22
Registered: ‎02-12-2010
My Device: BlackBerry Bold

Re: XMLHttpRequest predefined values for LOADING, DONE, etc. appear undefined under Ripple

Here are different environments I use to test:

 

(1)

Google Chrome 19.0.1084.46 m

Ripple Mobile Environment Emulator (Beta) 0.9.3

Settings: Platform=WebWorks, Device=Torch

Test: fail ... XMLHttpRequest.DONE=undefined

 

(2)

Ripple 0.9.0.16

  Ripple Mobile Emulator (v0.9.1)
  Ripple UI (v0.9.2)
  Ripple Framework (v0.9.1)
  Ripple Build & Deploy (v0.9.0)

Settings: Platform=WebWorks, Device=Torch

Test: fail .... XMLHttpRequest.DONE=undefined

 

 

BlackBerry Development Advisor
twindsor
Posts: 832
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: XMLHttpRequest predefined values for LOADING, DONE, etc. appear undefined under Ripple

Please try with 0.9.4 which is what I'm running.

Tim Windsor
Open Source Technical Lead
Contributor
boyanov
Posts: 22
Registered: ‎02-12-2010
My Device: BlackBerry Bold

Re: XMLHttpRequest predefined values for LOADING, DONE, etc. appear undefined under Ripple

After installing the Ripple Emulator (Beta) 0.9.5 the script passes the test.

 

Looks like you have to download the Ripple from https://developer.blackberry.com/html5/downloads/ripple and then manually install the Chrome extension instead of just updating the extension from the menu.

 

Thanks.