5

I am using Firebug 1.10.2 with Firefox 14.0.1. When showing a web page, the Firebug add-on has this "behavior": Firebug’s “Aborted” message upon Ajax request.

What should I make? Is it so dangerous that I must improve my web application because the presence of some error, or it is a Firebug bug or something else?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user12882
  • 4,702
  • 9
  • 39
  • 54
  • So what exactly is the question? DO you suspect a firebug bug? Try the built-in inspector in Chrome. You think you made the same mistake as in the article (reusing XMLHTTP requests prematurely)? Get rid of the reuse, get the functionality right at first, optimize later if needed at all. – Szocske Aug 24 '12 at 21:10
  • @Szocske - (1) Yes, I think I "made the same mistake as in the article". What "reusing XMLHTTP requests prematurely" exactly means? (2) Why I "could" / "may" get rid of the reuse? – user12882 Aug 24 '12 at 21:13
  • Just instantiate a new XHR object every time you need one. If it turns out to be a performance issue, you can always add a pool later. Trying to get by with just one XHR instance is premature optimization. – Szocske Aug 24 '12 at 22:04
  • @Szocske - You: "Just instantiate a new XHR object every time you need one". I: Practically speaking, are you referring to "unbind" something? *P.S.:* your last comment did not clarify at all my "sub" question (2)... is there a reason to "get rid of the reuse"? – user12882 Aug 25 '12 at 02:18
  • I don't understand what you mean by "unbind". You want to do an AJAX request? Create a new XHR instance. Sub question 2: Read the blog post you linked along with the XHR.open method document I quoted in the answer: if you reuse the same XHR instance before it's done, it gets "aborted". This is the reason you should not reuse one XHR instance and create a new one when you need one. Better yet, use jQuery or other library to shield you from such details. – Szocske Aug 25 '12 at 18:08
  • @Szocske - I am using jQuery ("unbind" - mentioned in my previous comment - refers to a [jQuery method](http://api.jquery.com/unbind/) since in my case the AJAX Request "firing" / "activation" process is "bound" with the `bind` jQuery method...). You: "[...] you should not reuse one XHR instance and create a new one when you need one". I: How to create a new XHR instance in those cases? – user12882 Aug 25 '12 at 18:25
  • If you have jQuery you can just use $.ajax(), handle the response with "deferred", very clean, elegant, expressive, and several layers above what you are struggling with now. – Szocske Aug 28 '12 at 21:46

2 Answers2

5

Please see the documentation of XHR open() for example here: https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest

Note: Calling this method an already active request (one for which open()or openRequest()has already been called) is the equivalent of calling abort().

Just create a new XHR instance whenever you need one. Better yet, use jQuery or other JS library to do AJAX. It should shield you from these intricacies.

Szocske
  • 7,466
  • 2
  • 20
  • 24
0

I saw this problem when trying to load a JavaScript file using HTTPS, but was serving the site on my local development environment using HTTP. The request to fetch the JavaScript file would fail with the Aborted message in FireBug. Making the requests use the same protocol worked for me.

Raj
  • 3,791
  • 5
  • 43
  • 56