more for 253220 - make app update reporting actually work

git-svn-id: svn://10.0.0.236/trunk@160560 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ben%bengoodger.com 2004-08-09 22:43:26 +00:00
parent 92db34882f
commit d8cbd91a92
2 changed files with 62 additions and 8 deletions

View File

@ -270,6 +270,13 @@ var gVersionPage = {
"nextButtonText", true,
"cancelButtonText", true);
document.documentElement.getButton("next").focus();
// If the user has disabled Extension/Theme update checking, don't bother
// doing version compatibility updates first.
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
if (!pref.getBoolPref(PREF_UPDATE_EXTENSIONS_ENABLED))
document.documentElement.advance();
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
@ -414,6 +421,9 @@ var gUpdatePage = {
onPageShow: function ()
{
if (!gUpdateTypes)
gUpdateWizard.init();
gUpdateWizard.setButtonLabels(null, true,
"nextButtonText", true,
"cancelButtonText", true);
@ -532,9 +542,11 @@ var gUpdatePage = {
break;
}
if (canFinish) {
if (canFinish) {
gUpdatePage.uninit();
if (gUpdateWizard.itemsToUpdate.length > 0 || gUpdateWizard.appUpdatesAvailable)
var updates = Components.classes["@mozilla.org/updates/update-service;1"]
.getService(Components.interfaces.nsIUpdateService);
if (gUpdateWizard.itemsToUpdate.length > 0 || updates.appUpdatesAvailable)
document.getElementById("checking").setAttribute("next", "found");
document.documentElement.advance();
}
@ -552,6 +564,11 @@ var gFoundPage = {
buildAddons: function ()
{
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
if (!pref.getBoolPref(PREF_UPDATE_EXTENSIONS_ENABLED))
return;
var hasExtensions = false;
var foundAddonsList = document.getElementById("found.addons.list");
var uri = Components.classes["@mozilla.org/network/standard-url;1"]
@ -887,9 +904,16 @@ var gOptionalPage = {
onCommand: function (aEvent)
{
if (aEvent.target.localName == "checkbox") {
var index = parseInt(aEvent.target.getAttribute("index"));
var item = gUpdateWizard.appComps.optional.optional[index];
gUpdateWizard.appComps.upgraded.optional.push(item);
gUpdateWizard.appComps.upgraded.optional = [];
var optionalItemsList = document.getElementById("optionalItemsList");
var checkboxes = optionalItemsList.getElementsByTagName("checkbox");
for (var i = 0; i < checkboxes.length; ++i) {
if (checkboxes[i].checked) {
var index = parseInt(checkboxes[i].getAttribute("index"));
var item = gUpdateWizard.appComps.optional.optional[index];
gUpdateWizard.appComps.upgraded.optional.push(item);
}
}
}
},

View File

@ -83,6 +83,33 @@ function getOSKey()
#endif
}
function stackTraceFunctionFormat(aFunctionName)
{
var classDelimiter = aFunctionName.indexOf("_");
var className = aFunctionName.substr(0, classDelimiter);
if (!className)
className == "<global>";
var functionName = aFunctionName.substr(classDelimiter + 1, aFunctionName.length);
if (!functionName)
functionName == "<anonymous>";
return className + "::" + functionName;
}
function stackTrace(aArguments, aMaxCount)
{
dump("=[STACKTRACE]=====================================================\n");
dump("*** at: " + stackTraceFunctionFormat(aArguments.callee.name) + "()\n");
var temp = aArguments.callee.caller;
var count = 0;
while (temp) {
dump("*** " + stackTraceFunctionFormat(temp.name) + ")\n");
temp = temp.arguments.callee.caller;
if (aMaxCount > 0 && ++count == aMaxCount)
break;
}
dump("==================================================================\n");
}
var gPref = null;
var gOS = null;
var gRDF = null;
@ -139,7 +166,6 @@ nsUpdateService.prototype = {
switch (aSourceEvent) {
case nsIUpdateService.SOURCE_EVENT_MISMATCH:
case nsIUpdateService.SOURCE_EVENT_USER:
if (aSourceEvent == nsIUpdateService.SOURCE_EVENT_USER &&
gPref.getBoolPref(PREF_UPDATE_APP_PERFORMED)) {
var sbs = Components.classes["@mozilla.org/intl/stringbundle;1"]
@ -328,7 +354,7 @@ nsUpdateService.prototype = {
PREF_UPDATE_APP_LASTUPDATEDATE)) {
types |= nsIUpdateItem.TYPE_APP;
}
if (types)
if (types)
this.checkForUpdatesInternal([], 0, types,
nsIUpdateService.SOURCE_EVENT_BACKGROUND);
},
@ -702,7 +728,11 @@ nsAppUpdater.prototype = {
try {
updatesResource = updatesResource.QueryInterface(Components.interfaces.nsIRDFResource);
}
catch (e) { return; }
catch (e) {
gOS.notifyObservers(null, "Update:App:Error", "");
gOS.notifyObservers(null, "Update:App:Ended", "");
return;
}
var cu = Components.classes["@mozilla.org/rdf/container-utils;1"]
.getService(Components.interfaces.nsIRDFContainerUtils);