Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Asynchronous AJAX
Thu, Mar 14 2013 8:11 AMPermanent Link

Matthew Jones

I totally get the asynchronous requirement, and am using a state-machine to manage
things. However, trying to sort an issue on the iPhone where
webcore_tobjectlist.$p.setcount is causing an error due to a "null" reference makes
me wonder if there is a problem with multiple AJAX calls at the same time. Is there
an issue with that? Or can I have multiple calls going on at the same time with
abandon?

Basically, I currently have a TTimer which will initiate two types of calls to the
server. They are separately managed, so could overlap in any way. They also control
themselves so that if a call is in progress it cannot call the same call again. It
generally doesn't seem to be causing a problem, but I wonder if it might actually
be so.

/Matthew Jones/
Thu, Mar 14 2013 9:02 AMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

Are you using TServerRequestQueue to serialize the requests or just
multiple independent TServerRequest instances ?

Either way though there should be no reason for multiple requests not to
work as most modern browsers usually allow 6+ concurrent requests (old
IE might allow 2).

Raul

On 3/14/2013 8:11 AM, (Matthew Jones) wrote:
> I totally get the asynchronous requirement, and am using a state-machine to manage
> things. However, trying to sort an issue on the iPhone where
> webcore_tobjectlist.$p.setcount is causing an error due to a "null" reference makes
> me wonder if there is a problem with multiple AJAX calls at the same time. Is there
> an issue with that? Or can I have multiple calls going on at the same time with
> abandon?
>
> Basically, I currently have a TTimer which will initiate two types of calls to the
> server. They are separately managed, so could overlap in any way. They also control
> themselves so that if a call is in progress it cannot call the same call again. It
> generally doesn't seem to be causing a problem, but I wonder if it might actually
> be so.
>
> /Matthew Jones/
>
Thu, Mar 14 2013 9:42 AMPermanent Link

Matthew Jones

> webcore_tobjectlist.$p.setcount is causing an error due to a "null"
> reference

This is only happening on the iPhone FWIW. Hmm, and seems very related to updates
of a TListBox while one has tapped on it.

There must be something in the DOM that the iPhone 5 breaks. My Touch is fine, as
are all the other browsers. I did think I'd stopped it with a try/except when
updating the listbox, but it happened again. More digging follows.

/Matthew Jones/
Thu, Mar 14 2013 9:56 AMPermanent Link

Matthew Jones

> Are you using TServerRequestQueue to serialize the requests or just
> multiple independent TServerRequest instances ?

I don't think I'm using either. I am using the RemObjects code, and I haven't a
clue how that works! Given it is working fine on everything except my iPhone (I
must try my iPad), I suspect it is something else.

/Matthew Jones/
Thu, Mar 14 2013 10:44 AMPermanent Link

Matthew Jones

The actual line the error is reported on is actually a curly brace. This made me
wonder if it might not be the EWB code at all, so I am now looking at the
RemObjects code, which does have code at that line. And a quick test later, and
bingo!

Now, what I can't understand is why the last line of this block fails with a "'null'
is not an object" error when the first line tests for just that! More digging to
come.

----------
if (this.AJAX == null) {
 return false;
} else {
 this.onSuccess = onSuccessFunction || function () {
 };
 this.onError = onErrorFunction || function () {
 };
 var that = this;

 this.AJAX.onreadystatechange = function onreadystatechange() {
----------


/Matthew Jones/
Thu, Mar 14 2013 11:10 AMPermanent Link

Matthew Jones

I experimented with only one call at a time, in case the RO code was not re-entrant.
The issue can still occur. Poop.

/Matthew Jones/
Thu, Mar 14 2013 12:27 PMPermanent Link

Matthew Jones

Well, I mentioned it to my friend who does Javascript, and he pointed me at
http://developer.apple.com/library/ios/#documentation/AppleApplications/Reference/Sa
fariWebContent/DebuggingSafarioniPhoneContent/DebuggingSafarioniPhoneContent.html
which shows how to connect to your Mac (you do have one don't you?) and debug
Javascript. And bingo, it shows that the line is not the function definition, but
the content. I shall be raising this with RemObjects.

The line at about 1421 which is like this:
this.AJAX.onreadystatechange = function onreadystatechange() {
if (that.AJAX.readyState == 4) {

needs to be

this.AJAX.onreadystatechange = function onreadystatechange() {
if (that.AJAX != null) { // MJ
if (that.AJAX.readyState == 4) {

All still seems to work.

/Matthew Jones/
Image