Fix and enable post-update prompting, make sure app managed items don't show up in incompatible list, make sure disabled items dont show up in incompatible list, reorg code and add documentation. bug 299302 for making extension manager getIncompatibleItemList have an optional filterDisabled parameter r=darin

This commit is contained in:
ben%bengoodger.com 2005-06-30 23:00:48 +00:00
Родитель b4bbc89714
Коммит a938271a67
12 изменённых файлов: 910 добавлений и 827 удалений

Просмотреть файл

@ -20,6 +20,14 @@
<!-- Front End MetaData -->
<em:name>Firefox (default)</em:name>
<em:description>The default theme</em:description>
<!-- EXTENSION AUTHORS!
DO NOT COPY THIS PROPERTY INTO YOUR INSTALL RDF FILES
It will cause users not to be informed of incompatibilities
with your extension when they are updated with Software Update
and your extension will become unavailable to them!
-->
<em:appManaged>true</em:appManaged>
<em:locked>true</em:locked>

Просмотреть файл

@ -447,7 +447,7 @@ function checkForUpdates()
{
var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
.createInstance(Components.interfaces.nsIUpdatePrompt);
prompter.checkForUpdates(window);
prompter.checkForUpdates();
}
function buildHelpMenu()

Просмотреть файл

@ -144,7 +144,7 @@ var gAdvancedPane = {
{
var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
.createInstance(Components.interfaces.nsIUpdatePrompt);
prompter.checkForUpdates(window);
prompter.checkForUpdates();
},
showAutoInstallOptions: function ()

Просмотреть файл

@ -151,8 +151,7 @@
<hbox>
<button id="checkNowButton"
label="&checkNow.label;" accesskey="&appCheckNow.accesskey;"
oncommand="gAdvancedPane.checkForUpdates();"
preference="app.update.enabled"/>
oncommand="gAdvancedPane.checkForUpdates();"/>
<button label="&showUpdates.label;" accesskey="&showUpdates.accesskey;"
oncommand="gAdvancedPane.showUpdates();"/>
</hbox>

Просмотреть файл

@ -26,6 +26,14 @@
</Description>
</em:targetApplication>
<!-- EXTENSION AUTHORS!
DO NOT COPY THIS PROPERTY INTO YOUR INSTALL RDF FILES
It will cause users not to be informed of incompatibilities
with your extension when they are updated with Software Update
and your extension will become unavailable to them!
-->
<em:appManaged>true</em:appManaged>
<!-- front-end metadata -->
<em:name>DOM Inspector</em:name>
<em:description>Inspect the DOM of HTML, XUL, and XML pages, including the browser chrome.</em:description>

Просмотреть файл

@ -26,6 +26,14 @@
</Description>
</em:targetApplication>
<!-- EXTENSION AUTHORS!
DO NOT COPY THIS PROPERTY INTO YOUR INSTALL RDF FILES
It will cause users not to be informed of incompatibilities
with your extension when they are updated with Software Update
and your extension will become unavailable to them!
-->
<em:appManaged>true</em:appManaged>
<!-- front-end metadata -->
<em:name>Reporter</em:name>
<em:description>Report a broken web site.</em:description>

Просмотреть файл

@ -194,7 +194,7 @@ interface nsIExtensionDownloadListener : nsISupports
* XXXben - Some of this stuff should go into a management-ey interface,
* some into an app-startup-ey interface.
*/
[scriptable, uuid(344c6fd1-ed48-4c84-a472-abdec533d1e2)]
[scriptable, uuid(e454bc28-cba8-4c27-83bd-01f2d5a2096c)]
interface nsIExtensionManager : nsISupports
{
/**
@ -320,6 +320,9 @@ interface nsIExtensionManager : nsISupports
* The version of the application to check compatibility against
* @param type
* The type of item to return
* @param includeDisabled
* true if disabled items should be included in the result set,
* false otherwise
* @param countRef
* The XPCJS reference to the number of items returned.
* @returns An array of incompatible nsIUpdateItems.
@ -327,6 +330,7 @@ interface nsIExtensionManager : nsISupports
void getIncompatibleItemList(in AString id,
in AString version,
in unsigned long type,
in boolean includeDisabled,
out unsigned long itemCount,
[retval, array, size_is(itemCount)] out nsIUpdateItem items);

Просмотреть файл

@ -3037,7 +3037,8 @@ ExtensionManager.prototype = {
var ds = this.datasource;
var currAppID = gApp.ID;
var items = ds.getIncompatibleItemList(currAppID, currAppVersion,
nsIUpdateItem.TYPE_ADDON);
nsIUpdateItem.TYPE_ADDON,
true); // XXXben - maybe we should only show enabled items?
if (items.length > 0) {
// Now disable the items so they won't hurt anything.
for (var i = 0; i < items.length; ++i)
@ -4301,8 +4302,10 @@ ExtensionManager.prototype = {
/**
* See nsIExtensionManager.idl
*/
getIncompatibleItemList: function(id, version, type, countRef) {
var items = this.datasource.getIncompatibleItemList(id, version, type);
getIncompatibleItemList: function(id, version, type, includeDisabled,
countRef) {
var items = this.datasource.getIncompatibleItemList(id, version, type,
includeDisabled);
countRef.value = items.length;
return items;
},
@ -5260,10 +5263,12 @@ ExtensionsDataSource.prototype = {
* The Version of the application to check for incompatibility against.
* @param desiredType
* The nsIUpdateItem type of items to look for
* @param includeDisabled
* Whether or not disabled items should be included in the set returned
* @returns An array of nsIUpdateItems that are incompatible with the application
* ID/Version supplied.
*/
getIncompatibleItemList: function(appID, appVersion, desiredType) {
getIncompatibleItemList: function(appID, appVersion, desiredType, includeDisabled) {
var items = [];
var ctr = getContainer(this._inner, this._itemRoot);
var elements = ctr.GetElements();
@ -5271,7 +5276,25 @@ ExtensionsDataSource.prototype = {
var item = elements.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
var id = stripPrefix(item.Value, PREFIX_ITEM_URI);
var type = this.getItemProperty(id, "type");
if (type != -1 && (type & desiredType) && !this.isCompatible(this, item, appVersion))
// Skip this item if we're not seeking disabled items
var disabled = this.getItemProperty(id, "disabled") == "true";
if (!includeDisabled && disabled)
continue;
// If the id of this item matches one of the items potentially installed
// with and maintained by this application AND it is installed in the
// global install location (i.e. the place installed by the app installer)
// it is and can be managed by the update file - it's not an item that has
// been manually installed by the user into their profile dir, and as such
// it is always compatible with the next release of the application since
// we will continue to support it.
var locationKey = this.getItemProperty(id, "installLocation");
var appManaged = this.getItemProperty(id, "appManaged") == "true";
if (!includeDisabled && appManaged && locationKey == KEY_APP_GLOBAL)
continue;
if (type != -1 && (type & desiredType) &&
!this.isCompatible(this, item, appVersion))
items.push(this.getItemForID(id));
}
return items;
@ -5734,6 +5757,8 @@ ExtensionsDataSource.prototype = {
// (can't be removed or disabled), and hidden (not shown in the UI)
if (installLocation.restricted)
singleProps = singleProps.concat(["locked", "hidden"]);
if (installLocation.name == KEY_APP_GLOBAL)
singleProps = singleProps.concat(["appManaged"]);
for (var i = 0; i < singleProps.length; ++i) {
var property = EM_R(singleProps[i]);
var literal = installManifest.GetTarget(gInstallManifestRoot, property, true);

Просмотреть файл

@ -47,7 +47,7 @@
<?xml-stylesheet href="chrome://global/skin/"?>
<?xml-stylesheet href="chrome://mozapps/content/update/updates.css"?>
<dialog id="history"
<dialog id="history" windowtype="Update:History"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
style="width: 35em;"
buttons="cancel" closebuttonlabel="&closebutton.label;"

Просмотреть файл

@ -259,7 +259,6 @@ var gUpdates = {
this.setUpdate(arg0);
var p = this.update.selectedPatch;
if (p) {
LOG("Downloader", "WIZARD UI STATE = " + p.state);
var state = p.state;
if (state == STATE_DOWNLOADING) {
var patchFailed = false;
@ -526,7 +525,8 @@ var gUpdatesAvailablePage = {
var em = Components.classes["@mozilla.org/extensions/manager;1"]
.getService(Components.interfaces.nsIExtensionManager);
var items = em.getIncompatibleItemList("", gUpdates.update.version,
nsIUpdateItem.TYPE_ADDON, { });
nsIUpdateItem.TYPE_ADDON, false,
{ });
if (items.length > 0) {
// There are addons that are incompatible with this update, so show the
// warning message.

Просмотреть файл

@ -228,33 +228,25 @@ interface nsIUpdatePrompt : nsISupports
/**
* Shows a user interface that checks for and then displays the available
* updates.
* @param parent
* A parent window to anchor this window to. Can be null.
*/
void checkForUpdates(in nsIDOMWindow parent);
void checkForUpdates();
/**
* Show a message advising that an update is available for download and
* install.
* @param parent
* A parent window to anchor this window to. Can be null.
* @param update
* The update to be downloaded and installed
*/
void showUpdateAvailable(in nsIDOMWindow parent,
in nsIUpdate update);
void showUpdateAvailable(in nsIUpdate update);
/**
* Show a message advising that an update has now been downloaded and that
* the user should restart their software should be restarted so that the
* update can be installed.
* @param parent
* A parent window to anchor this window to. Can be null.
* @param update
* The update that was downloaded
*/
void showUpdateDownloaded(in nsIDOMWindow parent,
in nsIUpdate update);
void showUpdateDownloaded(in nsIUpdate update);
/**
* Shows a message detailing the update which was installed.

Разница между файлами не показана из-за своего большого размера Загрузить разницу