Salve a tutti, premetto che sono un neofita per quanto riguarda javascript e le tecnologie web in generale e che ho cercato di documentarmi il più possibile, ma essendo abbastanza inesperto ho qualche difficoltà a comprendere il codice che leggo.
Veniamo al dunque, mi è stato "assegnato" il compito di analizzare il codice sorgente di Firebug
(estensione di firefox : http://ww.w.getfirebug.com/) e di estenderlo in modo da far esportare in un database le informazioni che vengono generate su schermo in un pannello chiamato NET.

Ho individuato nel file net.js quello su cui lavorare tuttavia, sono in difficoltà nel capire la sintassi utilizzata in esso e anche i collegamenti con gli altri file dell'applicazione.
Incollo quotando il codice dell'intero file net.js sperando che qualcuno possa illuminarmi sul significato del codice utilizzato.

Per esempio non riesco a capire a cosa fa riferimento la prima riga:
FBL.ns(function() { with (FBL) {

o meglio credo di aver capito che si riferisca al namespace ma non capisco a quali altri file si collega nè mi è chiaro l'uso della sintassi.
Ringrazio chiunque possa cominciare ad aiutarmi.



/* See license.txt for terms of usage */
FBL.ns(function() { with (FBL) {

// ************************************************** **********************************************
// Constants

const nsIWebProgressListener = CI("nsIWebProgressListener")
const nsIWebProgress = CI("nsIWebProgress")
const nsIRequest = CI("nsIRequest")
const nsIChannel = CI("nsIChannel")
const nsIHttpChannel = CI("nsIHttpChannel")
const nsICacheService = CI("nsICacheService")
const nsICache = CI("nsICache")
const nsIObserverService = CI("nsIObserverService")
const nsISupportsWeakReference = CI("nsISupportsWeakReference")
const nsISupports = CI("nsISupports")
const nsIIOService = CI("nsIIOService")
const imgIRequest = CI("imgIRequest");

const CacheService = CC("@mozilla.org/network/cache-service;1");
const ImgCache = CC("@mozilla.org/image/cache;1");
const IOService = CC("@mozilla.org/network/io-service;1");

const NOTIFY_ALL = nsIWebProgress.NOTIFY_ALL;

const STATE_IS_WINDOW = nsIWebProgressListener.STATE_IS_WINDOW;
const STATE_IS_DOCUMENT = nsIWebProgressListener.STATE_IS_DOCUMENT;
const STATE_IS_NETWORK = nsIWebProgressListener.STATE_IS_NETWORK;
const STATE_IS_REQUEST = nsIWebProgressListener.STATE_IS_REQUEST;

const STATE_START = nsIWebProgressListener.STATE_START;
const STATE_STOP = nsIWebProgressListener.STATE_STOP;
const STATE_TRANSFERRING = nsIWebProgressListener.STATE_TRANSFERRING;

const LOAD_BACKGROUND = nsIRequest.LOAD_BACKGROUND;
const LOAD_FROM_CACHE = nsIRequest.LOAD_FROM_CACHE;
const LOAD_DOCUMENT_URI = nsIChannel.LOAD_DOCUMENT_URI;

const ACCESS_READ = nsICache.ACCESS_READ;

const observerService = CCSV("@mozilla.org/observer-service;1", "nsIObserverService");

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

const maxPendingCheck = 200;

const mimeExtensionMap =
{
"txt": "text/plain",
"html": "text/html",
"htm": "text/html",
"xhtml": "text/html",
"xml": "text/xml",
"css": "text/css",
"js": "application/x-javascript",
"jss": "application/x-javascript",
"jpg": "image/jpeg",
"jpeg": "image/jpeg",
"gif": "image/gif",
"png": "image/png",
"bmp": "image/bmp",
"swf": "application/x-shockwave-flash"
};

const fileCategories =
{
"undefined": 1,
"html": 1,
"css": 1,
"js": 1,
"xhr": 1,
"image": 1,
"flash": 1,
"txt": 1,
"bin": 1
};

const textFileCategories =
{
"txt": 1,
"html": 1,
"xhr": 1,
"css": 1,
"js": 1
};

const binaryFileCategories =
{
"bin": 1,
"flash": 1
};

const mimeCategoryMap =
{
"text/plain": "txt",
"application/octet-stream": "bin",
"text/html": "html",
"text/xml": "html",
"text/css": "css",
"application/x-javascript": "js",
"text/javascript": "js",
"image/jpeg": "image",
"image/gif": "image",
"image/png": "image",
"image/bmp": "image",
"application/x-shockwave-flash": "flash"
};

const binaryCategoryMap =
{
"image": 1,
"flash" : 1
};

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

const reIgnore = /about:|javascript:|resource:|chrome:|jar:/;

const layoutInterval = 300;
const phaseInterval = 1000;
const indentWidth = 18;

// ************************************************** **********************************************

Firebug.NetMonitor = extend(Firebug.Module,
{
clear: function(context)
{
var panel = context.getPanel("net", true);
if (panel)
panel.clear();

if (context.netProgress)
context.netProgress.clear();
},

onToggleFilter: function(context, filterCategory)
{
Firebug.setPref("netFilterCategory", filterCategory);

var panel = context.getPanel("net", true);
if (panel)
{
panel.setFilter(filterCategory);
panel.updateSummaries(now(), true);
}
},

syncFilterButtons: function(chrome)
{
var button = chrome.$("fbNetFilter-"+Firebug.netFilterCategory);
button.checked = true;
},

...continua