Bug in Request.Queue When request

33 views
Skip to first unread message

Michael Fuery

unread,
Jun 11, 2010, 5:35:28 PM6/11/10
to MooTools Users, e...@fuery.com
Hello,

I seem to have run into a problem with Request.Queue. I don't know if
it is a result of my tricky usage or if it is in fact a bug in
MooTools. I have code that is trying to make a request queue for
things I need to get from the server, then instantiating the
Request.Queue class. My code is like this:

<=======
var myRequests = {},
listOfThings = $H(x:'blah',y:'blah',z:'blah');
listOfThings.each(function(item, key){
myRequests[item] = new Request({url:'/server/side/script/url',
onSuccess:function(j){
// do stuff with my j.
}});
});
console.log(myRequests);
var requestQueue = new Request.Queue({
requests:myRequests
}).send();
console.log(requestQueue);
======>
The console logs reveal that myRequests looks good, but requestQueue
never logs because I get the following JS error:
Permission denied for <http://dev.meruscase.com:8881> to get property
XMLHttpRequest.channel
[Break on this error] for (var p in object) unlinked[p] =
$unlink(object[p]);

I am using MooTools more 1.2.3.1 and core 1.2.4. The error occurs in
$unlink.

I have a hunch that Request.Queue is unlinking the requests object,
however, certain XHR properties are not copy-able or even readable. I
think that is why I'm getting this error. If I'm right, then
Request.Queue should not be unlinking the request objects like this.

Thoughts?

Using FF 3.6.3 on Win7 w/ Firebug.

Michael Fuery

unread,
Jun 11, 2010, 5:59:46 PM6/11/10
to MooTools Users
Well, after upgrading to More 1.2.4.4, that error was no longer an
issue. I see that Request.Queue.send() does not behave as I
expected. I thought that would spawn off the request queue, but it
does not. I still have to call all of my requests individually,
though they will not actually set off the request until the previous
one has completed successfully. The following code now works for me.

<=======
var myRequests = $H(),
listOfThings = $H(x:'blah1',y:'blah2',z:'blah3');
listOfThings.each(function(item, key){
myRequests[item] = new Request({url:'/server/side/script/url',
onSuccess:function(j){
// do stuff with my j.
}});
});

var requestQueue = new Request.Queue({
requests:myRequests
}).send();

myRequests.each(function(req,name){
req.send();
});
// Requests will all be sent, one at a time, which was the goal.

======>
Reply all
Reply to author
Forward
0 new messages