From fefb1bfe79790323263a0e6708adc129fed0b6a4 Mon Sep 17 00:00:00 2001 From: "mscott%netscape.com" Date: Thu, 14 Sep 2006 05:49:30 +0000 Subject: [PATCH] Bug #33156 --> finish new nsIWebProgress work --> implement real progress as a percentage of the document download. --- suite/browser/navigator.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/suite/browser/navigator.js b/suite/browser/navigator.js index d95aea1ca044..4a29093b3e9a 100644 --- a/suite/browser/navigator.js +++ b/suite/browser/navigator.js @@ -199,6 +199,22 @@ nsXULBrowserWindow.prototype = overLink = link; UpdateStatusField(); }, + onProgress : function (channel, current, max) + { + if(!statusMeter) + statusMeter = document.getElementById("statusbar-icon"); + var percentage = 0; + if (max > 0) + { + percentage = (current * 100) / max ; + statusMeter.setAttribute("mode", "normal"); + statusMeter.value = percentage; + statusMeter.progresstext = Math.round(percentage) + "%"; + } + else + statusMeter.setAttribute("mode","undetermined"); + + }, onStatusChange : function(channel, status) { if(!throbberElement) @@ -227,8 +243,10 @@ nsXULBrowserWindow.prototype = defaultStatus = msg; UpdateStatusField(); window.XULBrowserWindow.setDefaultStatus(msg); - // Turn progress meter off. - statusMeter.setAttribute("mode","normal"); + // Turn progress meter off. + statusMeter.setAttribute("mode","normal"); + statusMeter.value = 0; // be sure to clear the progress bar + statusMeter.progresstext = ""; throbberElement.setAttribute("busy", false); } else if(status & Components.interfaces.nsIWebProgress.flag_net_dns)