0

I am using XMLHttpRequest to call a REST service.

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.

Neven Boyanov
  • 749
  • 8
  • 14
  • I sounds like "Ripple" [re-]defined XMLHttpRequest when it was already present...? –  Apr 19 '12 at 07:47
  • Do you know this for a fact or you think this is the problem? – Neven Boyanov May 07 '12 at 11:17
  • No, and it would be silly. However, it is the *only* explanation that I can think of to explain "all the values of XMLHttpRequest.* are undefined" (object properties don't just "magically vanish"). Well, the other is that there is a *different* `XMLHttpRequest` variable in scope. In any case 1) The properties were removed (or not added) 2) `XMLHttpRequest` resolves to a different object or 3) a combination of #1 and #2. –  May 07 '12 at 22:38
  • Perhaps the "target" Ripple is trying to emulate does *not* have those properties (so they are removed) or it uses a proxy object and does *not* add the properties (never added to proxy object)? (I have no idea how Ripple actually works under the hood, but see #1 and #2.) –  May 07 '12 at 22:42

1 Answers1

0

After installing the Ripple Emulator 0.9.5 the testing script passes the test - the XMLHttpRequest values for LOADING, DONE, etc. are there.

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.

NOTE: At the time this question was asked the version above was not available so the problem existed.

NOTE2: Here is a link https://developer.blackberry.com/html5/documentation/ww_getting_started/Use_the_Ripple_emulator_Chrome_extension_2007542_11.html with instructions how to install the extension to the Chrome, i.e. drag-and-drop the ripple_ui.crx file.

Neven Boyanov
  • 749
  • 8
  • 14