[OpenLayers-Users] Error when using XMLHTTPRequest (throughrefreshing a wfs layer every n seconds)

Frederic Junod frederic.junod at camptocamp.com
Tue Apr 28 08:43:29 EDT 2009


Hello,

Same error here, and the patch fixes the problem thanks.

The smallest test case is:
  var protocol = new OpenLayers.Protocol.HTTP();
  protocol.abort(protocol.read());

With FF 3.0.9 linux, I (sometimes !) have the following error (in the
firebug console):
uncaught exception: [Exception... "Component returned failure code:
0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]"
nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame
:: http://kirishima.wrk.lsn.camptocamp.com/~fredj/openlayers/lib/OpenLayers/Request/XMLHttpRequest.js
:: anonymous :: line 200" data: no]


fredj

On Tue, Apr 28, 2009 at 10:20 AM, Kris Geusebroek <kgeusebroek at xebia.com> wrote:
> Hi all,
>
>
> Found the solution to this and wanted to share that with you ;-)
>
>
> Everytime a new read was done on the layer through refreshing the refresh
> event triggered the update of the BBOX strategy. Here the abort was called
> on the protocol.
>
> In the protocol abort method the abort was propagated to the XMLHttpRequest.
>
> The abort method of the XMLHttpRequest propagated again to the
> XMLHttpRequest native object or the ActiveX object depending on the browser
> used.
>
> It seems that the abort is not working correctly if readystate has reached 4
> already. So changing that to conditionally propagate the abort only when
> readystate > 0 and < 4 did the trick.
>
>
>
> Attached you’ll find a patch file including this change and also:
>
> -          Setting readystatechange function after open is called (as good
> practice from ajaxian.com:
> http://ajaxian.com/archives/reusing-xmlhttprequest-without-abort)
>
> -          Applied changes from version 1.0.3 of the used library from
> http://code.google.com/p/xmlhttprequest
>
>
>
> Hope its usefull for anyone (and makes it into a new release).
>
>
>
> Cheers Kris
>
>
>
> From: Kris Geusebroek
> Sent: Monday, April 27, 2009 9:52 AM
> To: Kris Geusebroek; users at openlayers.org
> Subject: RE: [OpenLayers-Users] Error when using XMLHTTPRequest
> (throughrefreshing a wfs layer every n seconds)
>
>
>
> Hi All,
>
>
>
> Some further investigating shows that the location of the error (unspecified
> error) is at line 1087 /29937 (for uncompressed openLayers.js)
>
> This is the line in XMLHTTPRequest.js where the this._object.send(vData) is
> called form cXMLHttpRequest.prototype.send
>
>
>
> In script debugeer I can see that this._aborted = true
>
> But nothing more strange things to see.
>
>
>
> Anybode knows how I can investigate more?
>
>
>
> Cheers Kris
>
>
>
> From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On
> Behalf Of Kris Geusebroek
> Sent: Monday, April 27, 2009 8:17 AM
> To: users at openlayers.org
> Subject: [OpenLayers-Users] Error when using XMLHTTPRequest
> (throughrefreshing a wfs layer every n seconds)
>
>
>
> Hi all,
>
>
>
> When using openlayers to refresh my wfs layers frequently after some time
> using the application (zooming, panning etc while still refreshing every n
> seconds)
>
> I get an error: unknown error at line 977 (or 1076 sometimes).
>
> After that error the app becomes very unresponsive. Zooming in for example
> takes about 30 seconds after clicking the button in the PanZoom control.
>
>
>
> My feeling is that the error comes form the XMLHttpRequest code so I need to
> investigate that more.
>
> Anybody know a good help to investigate what goes wrong and to find out how
> to fix this?
>
>
>
> Environment is IE6 (I know bad choice). But the error also comes in Firefox
> but there the response times remain ok.
>
>
>
> Any help I much appreciated
>
>
>
> Cheers
>
>
>
> Kris Geusebroek
>
> Consultant
>
>
>
> Email: kgeusebroek at xebia.com
>
> Tel: +31 (0)35 538 1921
>
> Fax: +31 (0)35 538 1922
>
> Mobile: +31 (0)6 30 697 223
>
> http://www.xebia.com
>
>
>
> Utrechtseweg 49
>
> 1213 TL Hilversum
>
> The Netherlands
>
>
>
> Xebia Blog !   http://blog.xebia.com/
>
> Xebia Podcast!   http://podcast.xebia.com/
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>



-- 
Frédéric Junod
Camptocamp SA



More information about the Users mailing list