This project is archived and is in readonly mode.

#270 ✓hold
mxschiff

Request.queue issues with Safari/Chrome

Reported by mxschiff | February 22nd, 2010 @ 07:28 PM

The specific problem I ran into was that trying to clear a named request didn't work in Safari or Chrome (on Mac OS X if that matters), though it worked fine in Firefox. However, I think there are likely to be other issues as well.

Our code looked like this when the initial request was created:

queue.addRequest(request_key, request);

then later

var request = queue.requests.get(request_key);
queue.clear(queue.getName(request));
request.cancel();
request.send({data: request_data});

I.e., we were canceling an existing request with a particular name and issuing a new one in its place.

What happened was that the new request executed first, then the old cancelled request executed afterwards. This didn't happen in Firefox.

I stepped through some of the Request.Queue code and saw that the code that was assigning values to "name" for the anonymous functions in the queue and then filtering on those values just wasn't working. I.e., after the assignment the value of q.name as displayed by the debugger was still "".

I'm not enough of a browser/javascript expert to know if this is expected or not, but substituting another property for name throughout Request.Queue made this code work as expected.

Comments and changes to this ticket

  • fakedarren

    fakedarren February 23rd, 2010 @ 10:58 AM

    • State changed from “new” to “hold”
    • Assigned user set to “fakedarren”

    Can you please provide a mooshell highlighting the issue.

  • mxschiff

    mxschiff February 23rd, 2010 @ 10:05 PM

    Here's one that more or less demonstrates the issue:

    http://mootools.net/shell/J6WbN/

    Note the behavioral difference between Firefox and Chrome/Safari...the request is not cancelled properly in the webkit browsers (or more accurately, it's not removed from the queue).

    I haven't replicated the out of order behavior that I noticed in my own code...and haven't analyzed the precise difference.

  • mxschiff

    mxschiff March 10th, 2010 @ 11:18 PM

    • no changes were found...

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The MooTools Extensions

People watching this ticket

Pages