Firefox 3.5rc3 problems with Request + solution

General Discussion about Mootools 1.2

Moderator: 1.2 Moderators

Firefox 3.5rc3 problems with Request + solution

Postby nea on Sun Jun 28, 2009 7:44 pm

It appears that Firefox 3.5rc3 has a bug involving XHR.onreadystatechange - in a very indeterministic fashion (only with very frequent requests) it sometimes doesn't fire this event at all, but that's only when it's defined between XHR.open() and XHR.send() (like it is in Mootools 1.2.3). Defining XHR.onreadystatechange after XHR.send() fixes that.

So, kind of a temporary hack around this bug until Mozilla fixes their shit (it's called release candidate for a reason :P) would be something like this:

  1. // send your request
  2. yourRequest.send(...);
  3. // and overwrite the event
  4. yourRequest.xhr.onreadystatechange = yourRequest.onStateChange.bind(yourRequest);


edit: should be "yourRequest" there instead of "ajaxRequest", that's my var name :P.
Last edited by nea on Sun Jun 28, 2009 10:05 pm, edited 1 time in total.
nea
 
Posts: 4
Joined: Wed Jul 16, 2008 12:08 pm

Re: Firefox 3.5rc3 problems with Request + solution

Postby daKmoR on Sun Jun 28, 2009 8:19 pm

thx for the info... will definitely prevent me from going crazy when I'm trying FF 3.5rc3
"Speak when you are angry and you will make the best speech you will ever regret." - Ambrose Bierce
User avatar
daKmoR
Site Admin
 
Posts: 860
Joined: Mon Jul 14, 2008 11:40 am

Re: Firefox 3.5rc3 problems with Request + solution

Postby nea on Tue Jun 30, 2009 12:15 pm

Just installed Firefox 3.5 stable, and this bug is still in...
nea
 
Posts: 4
Joined: Wed Jul 16, 2008 12:08 pm

Re: Firefox 3.5rc3 problems with Request + solution

Postby desmart on Wed Jul 01, 2009 3:17 pm

Added this.xhr.onreadystatechange = this.onStateChange.bind(this); in mootools.core.js:

  1.  
  2. this.fireEvent('request');
  3. this.xhr.send(data);
  4. this.xhr.onreadystatechange = this.onStateChange.bind(this);
  5.  


This seems to solve the problem. Only thing is when request is canceled - in firebug this request is visible as still running (loader icon still visible). It runs forever... I'm not sure if this is just Firebug or FireFox 3.5 really runs this request (and takes resources)
desmart
 
Posts: 1
Joined: Wed Jul 01, 2009 2:23 pm


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest