views:

193

answers:

3

Trying to optimize one web project.

It uses asp.net (webforms), bunch of jquery plugins and whatnot.

Problem: there's unnecessary HTTP request to localhost/undefined and that makes every request take ~1s longer than needed.

Question: is there any tactic to find guilty code?

Clue: undefined makes me think that there's JS involved.

Firebug log:

GET /undefined HTTP/1.1
Host: localhost:17817
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; lv; rv:1.9.2) Gecko/20100115
Firefox/3.6
Accept: image/png,image/;q=0.8,/*;q=0.5
Accept-Language: lv,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-13,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://localhost:17817/Default.aspx


if you right click a line in the code, it gives you a conditional breakpoint. Check the name of the variable that has the URL value, and set a condition when typeof URL === 'undefined' or url === 'undefined' and look at the stack

Just set breakproint at line 3400 (with no conditions). It does not go through there.

3397 ajax: function( s ) {
3398 // Extend the settings, but re-extend 's' so that it can be
3399 // checked again later (in the test suite, specifically)
3400 s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));


Narrowed issue down a bit => commented out 1 ascx controller that renders some images and uses gallerific jquery plugin and magic request dissapeared.


Problem was with galleriffic plugin initialization. It couldn't find anchor and it's href for creating thumbnails when there were no images or something. It's cool now...

A: 

You might want to try out the HTTP Watch.

Sarfraz
+1  A: 

Have you been able to identify what JS code is initiating the request? If you are using Firebug it should give you a line of code in the console window which is invoking the AJAX request. In the event it's something like a $.post() with a code line in the jQuery library, you can navigate the callstack within the Firebug plugin to try and figure out where the initial JS call is being invoked.

Nathan Taylor
At the moment - it seems that debugging JS with firebug is the way to go.
Arnis L.
if you right click a line in the code, it gives you a conditional breakpoint. Check the name of the variable that has the URL value, and set a condition when typeof URL === 'undefined' or url === 'undefined' and look at the stack
Mic
A: 

You might want to use Firebug

Dennis Cheung
Hah... Did you actually read my question? Did you notice request log and where it comes from? :D
Arnis L.