[OpenLayers-Trac] [OpenLayers] #3297: XMLHttpRequest.js : do NOT call _object.send after _object.abort

OpenLayers trac-20090302 at openlayers.org
Tue May 10 17:12:41 EDT 2011


#3297: XMLHttpRequest.js : do NOT call _object.send after _object.abort
--------------------+-------------------------------------------------------
 Reporter:  flexer  |       Owner:              
     Type:  bug     |      Status:  new         
 Priority:  minor   |   Milestone:  2.11 Release
Component:  Ajax    |     Version:  2.10        
 Keywords:  ajax    |       State:              
--------------------+-------------------------------------------------------
 I have got this error:

 uncaught exception: [Exception... "Component returned failure code:
 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]" nsresult:
 "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame ::
 .../ol/OpenLayers/Request/XMLHttpRequest.js :: anonymous :: line 227"
 data: no]

 Another user has the same problem: http://osgeo-org.1803224.n2.nabble.com
 /SOLVED-Firefox-nsIXMLHttpRequest-send-throwing-0xc1f30001-NS-ERROR-NOT-
 INITIALIZED-td5903108.html#a6349420
 and there is my comment ("flexer")  - almost the same as below:

 A solution:
 Do NOT call "this._object.send(vData);"
 if  "this._object.abort();" has been called (see XMLHttpRequest.js).

 -----------------------
 Look at Request.js:
             window.setTimeout(function(){
                 if (request._aborted !== true) {
                     request.send(config.data);
                 }
             }, 0);

 and look at XMLHttpRequest.js :
     cXMLHttpRequest.prototype.send    = function(vData) {
         // Add method sniffer
         if (cXMLHttpRequest.onsend)
     ....

 and look at XMLHttpRequest.js:
    cXMLHttpRequest.prototype.abort    = function() {
         ....
         // BUGFIX: Gecko - unnecessary DONE when aborting
         if (this.readyState > cXMLHttpRequest.UNSENT)
             this._aborted    = true;
         this._object.abort();
         ....
 -----------------------

 I have added to XMLHttpRequest.js these lines and the problem was solved:

     cXMLHttpRequest.prototype.send    = function(vData) {
         if (!!this._isAbortCalled)
             return;
         ....

     cXMLHttpRequest.prototype.abort    = function() {
         this._isAbortCalled    = true;
         ....

 ---------------------
 The changed file (with the fix) is attached.

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3297>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list