rem: var percent = Math.round( (bytes*100)/max ); 
add: var percent; if ( max != "-1" ) { percent = Math.round( (bytes*100)/max ); 
context: function onProgress( bytes, max ) {    // Check for first time.    if ( !started ) {        // Initialize download start time.        started = true;        startTime = ( new Date() ).getTime();        // Let the user stop, now.        dialog.cancel.removeAttribute( "disabled" );    }    // Get current time.    var now = ( new Date() ).getTime();    // If interval hasn't elapsed, ignore it.    if ( now - lastUpdate < interval && eval(bytes) < eval(max) ) {        return;    }    // Update this time.    lastUpdate = now;    // Update download rate.    elapsed = now - startTime;    var rate; // bytes/sec    if ( elapsed ) {        rate = ( bytes * 1000 ) / elapsed;    } else {        rate = 0;    }    // Calculate percentage.    var percent = Math.round( (bytes*100)/max );    // Advance progress meter.    dialog.progress.setAttribute( "value", percent );        // Check if download complete.    if ( !completed ) {        // Update status (nnn of mmm)        var status = "( ";        status += Math.round( bytes/1024 );        status += "K of ";        status += Math.round( max/1024 );        status += "K bytes ";        if ( rate ) {            status += "at ";            status += Math.round( (rate*10)/1024 ) / 10;            status += "K bytes/sec )";        } else {            status += ")";        }        // Update status msg.        onStatus( status );    }    // Update percentage label on progress meter.    dialog.progressPercent.childNodes[0].nodeValue = percent + "%";        if ( !completed ) {        // Update time remaining.        if ( rate ) {            var rem = Math.round( ( max - bytes ) / rate ); // In seconds.            dialog.timeLeft.childNodes[0].nodeValue = formatSeconds( rem );        }    } else {        // Clear time remaining field.        dialog.timeLeft.childNodes[0].nodeValue = "";    }}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/88626d4e625eadc54ce5b057631e93f15034a456/downloadProgress.js/buggy/xpfe/components/xfer/resources/downloadProgress.js