mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
make the update mismatch dialog not show every time
This commit is contained in:
parent
49d7e76eec
commit
a755fac7e0
@ -366,7 +366,8 @@ var gExtensionsViewController = {
|
||||
cmd_update: function ()
|
||||
{
|
||||
var items = this._getItemList(null);
|
||||
gExtensionManager.update(items, item.length, false);
|
||||
gExtensionManager.update(items, item.length,
|
||||
Components.interfaces.nsIExtensionManager.UPDATE_TYPE_USERINVOKED);
|
||||
},
|
||||
|
||||
_getItemList: function (aItemID)
|
||||
|
@ -74,9 +74,16 @@ interface nsIExtensionManager : nsISupports
|
||||
void installTheme(in string aThemeID);
|
||||
void uninstallTheme(in string aThemeID);
|
||||
|
||||
void update([array, size_is(aItemCount)] in nsIExtensionItem aItems,
|
||||
in unsigned long aItemCount,
|
||||
in boolean aShowUI);
|
||||
const unsigned short UPDATE_TYPE_MISMATCH = 0x01;
|
||||
const unsigned short UPDATE_TYPE_USERINVOKED = 0x02;
|
||||
const unsigned short UPDATE_TYPE_BACKGROUND = 0x04;
|
||||
|
||||
const unsigned short UPDATE_RESULT_OK = 0x00;
|
||||
const unsigned short UPDATE_RESULT_RESTART = 0x01;
|
||||
|
||||
unsigned short update([array, size_is(aItemCount)] in nsIExtensionItem aItems,
|
||||
in unsigned long aItemCount,
|
||||
in unsigned short aUpdateType);
|
||||
|
||||
readonly attribute nsIRDFDataSource datasource;
|
||||
};
|
||||
|
@ -190,25 +190,18 @@ nsExtensionManager.prototype = {
|
||||
var items = this._ds.getIncompatibleItemList(currAppID, currAppVersion);
|
||||
|
||||
if (items.length > 0) {
|
||||
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Components.interfaces.nsIWindowWatcher);
|
||||
var ary = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
for (var i = 0; i < items.length; ++i) {
|
||||
ary.AppendElement(items[i]);
|
||||
|
||||
// Now disable the extension so it won't hurt anything.
|
||||
this.disableExtension(items[i].id);
|
||||
}
|
||||
ww.openWindow(null, "chrome://mozapps/content/update/update.xul",
|
||||
"", "chrome,centerscreen,modal", ary);
|
||||
//
|
||||
this.update(items, items.length,
|
||||
Components.interfaces.nsIExtensionManager.UPDATE_TYPE_MISMATCH);
|
||||
}
|
||||
}
|
||||
|
||||
// Now update the last app version so we don't do this checking
|
||||
// again.
|
||||
// pref.setCharPref(PREF_EM_LAST_APP_VERSION, currAppVersion);
|
||||
pref.setCharPref(PREF_EM_LAST_APP_VERSION, currAppVersion);
|
||||
}
|
||||
},
|
||||
|
||||
@ -251,7 +244,7 @@ nsExtensionManager.prototype = {
|
||||
this._ds.disableExtension(aExtensionID);
|
||||
},
|
||||
|
||||
update: function (aItems, aItemCount, aShowUI)
|
||||
update: function (aItems, aItemCount, aUpdateType)
|
||||
{
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
@ -259,7 +252,26 @@ nsExtensionManager.prototype = {
|
||||
var appVersion = pref.getCharPref(PREF_EM_APP_VERSION);
|
||||
|
||||
var updater = new nsItemUpdater(aItems, appID, appVersion);
|
||||
updater.checkForUpdates();
|
||||
|
||||
switch (aUpdateType) {
|
||||
case Components.interfaces.nsIExtensionManager.UPDATE_TYPE_MISMATCH:
|
||||
case Components.interfaces.nsIExtensionManager.UPDATE_TYPE_USERINVOKED:
|
||||
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Components.interfaces.nsIWindowWatcher);
|
||||
var ary = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
ary.AppendElement(updater);
|
||||
for (var i = 0; i < aItems.length; ++i)
|
||||
ary.AppendElement(aItems[i]);
|
||||
ww.openWindow(null, "chrome://mozapps/content/update/update.xul",
|
||||
"", "chrome,modal,centerscreen", ary);
|
||||
break;
|
||||
case Components.interfaces.nsIExtensionManager.UPDATE_TYPE_BACKGROUND:
|
||||
// The Background Updater Service adds itself as a listener for
|
||||
// the various kinds of messages that the updater sends out.
|
||||
updater.checkForUpdates();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
// Themes
|
||||
|
@ -1,6 +1,8 @@
|
||||
//
|
||||
// window.arguments is an array of nsIExtensionItem implementing objects that
|
||||
// are to be updated.
|
||||
// window.arguments[0] is the nsIExtensionItemUpdater object
|
||||
//
|
||||
// window.arguments[1...] is an array of nsIExtensionItem implementing objects
|
||||
// that are to be updated.
|
||||
// * if the array is empty, all items are updated (like a background update
|
||||
// check)
|
||||
// * if the array contains one or two ExtensionItems, with null id fields,
|
||||
@ -40,12 +42,18 @@
|
||||
//
|
||||
|
||||
const nsIExtensionItem = Components.interfaces.nsIExtensionItem;
|
||||
var gExtensionItems = window.arguments;
|
||||
var gExtensionItems = [];
|
||||
var gUpdater = null;
|
||||
|
||||
var gUpdateWizard = {
|
||||
_items: [],
|
||||
|
||||
init: function ()
|
||||
{
|
||||
gUpdater = window.arguments[0];
|
||||
for (var i = 1; i < window.argments.length; ++i)
|
||||
this._items.push(window.arguments[i].QueryInterface(Components.interfaces.nsIExtensionItem));
|
||||
|
||||
gMismatchPage.init();
|
||||
},
|
||||
|
||||
@ -57,17 +65,12 @@ var gUpdateWizard = {
|
||||
|
||||
|
||||
var gMismatchPage = {
|
||||
_items: [],
|
||||
|
||||
init: function ()
|
||||
{
|
||||
for (var i = 0; i < gExtensionItems.length; ++i)
|
||||
this._items.push(gExtensionItems[i].QueryInterface(Components.interfaces.nsIExtensionItem));
|
||||
|
||||
var incompatible = document.getElementById("mismatch.incompatible");
|
||||
|
||||
for (var i = 0; i < this._items.length; ++i) {
|
||||
var item = this._items[i];
|
||||
for (var i = 0; i < gUpdateWizard._items.length; ++i) {
|
||||
var item = gUpdateWizard._items[i];
|
||||
var listitem = document.createElement("listitem");
|
||||
listitem.setAttribute("label", item.name + " " + item.version);
|
||||
incompatible.appendChild(listitem);
|
||||
|
@ -115,7 +115,7 @@ nsBackgroundUpdateService.prototype = {
|
||||
if (extUpdatesEnabled) {
|
||||
var em = Components.classes["@mozilla.org/extensions/manager;1"]
|
||||
.getService(Components.interfaces.nsIExtensionManager);
|
||||
em.update([], 0);
|
||||
em.update([], 0, Components.interfaces.nsIExtensionManager.UPDATE_TYPE_BACKGROUND);
|
||||
}
|
||||
|
||||
this._makeTimer(pref.getIntPref(PREF_UPDATE_INTERVAL));
|
||||
|
Loading…
Reference in New Issue
Block a user