зеркало из https://github.com/mozilla/gecko-dev.git
Bug 299716 - Need for em:targetApplication marker for 'the toolkit'. patch=ajvincent, r=dtownsend, r=rstrong
This commit is contained in:
Родитель
7a4ce65d7f
Коммит
dd0789ea57
|
@ -140,3 +140,5 @@ goOnlineButtonAccesskey=G
|
|||
|
||||
newUpdateWindowTitle=%S Add-on Updates
|
||||
newUpdatesAvailableMsg=There are new updates available for your add-ons.
|
||||
|
||||
toolkitName=Gecko Toolkit
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
#
|
||||
# The Original Code is The Extension Manager.
|
||||
#
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@mozilla.org>
|
||||
# Robert Strong <robert.bugzilla@gmail.com>
|
||||
# Dão Gottwald <dao@design-noir.de>
|
||||
#
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
|
@ -34,7 +34,7 @@
|
|||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -88,7 +88,7 @@ const OP_NEEDS_ENABLE = "needs-enable";
|
|||
const OP_NEEDS_DISABLE = "needs-disable";
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Utility Functions
|
||||
// Utility Functions
|
||||
function setElementDisabledByID(aID, aDoDisable) {
|
||||
var element = document.getElementById(aID);
|
||||
if (element) {
|
||||
|
@ -163,7 +163,7 @@ var AddonsViewBuilder = {
|
|||
gExtensionsView.appendChild(template);
|
||||
for (var i = 0; i < aRulesList.length; ++i)
|
||||
template.appendChild(this.createRule(aRulesList[i], aURI));
|
||||
|
||||
|
||||
this._bindingList = null;
|
||||
this._actionList = null;
|
||||
gExtensionsView.builder.rebuild();
|
||||
|
@ -460,9 +460,9 @@ function LOG(msg) {
|
|||
dump("*** " + msg + "\n");
|
||||
}
|
||||
|
||||
function getIDFromResourceURI(aURI)
|
||||
function getIDFromResourceURI(aURI)
|
||||
{
|
||||
if (aURI.substring(0, PREFIX_ITEM_URI.length) == PREFIX_ITEM_URI)
|
||||
if (aURI.substring(0, PREFIX_ITEM_URI.length) == PREFIX_ITEM_URI)
|
||||
return aURI.substring(PREFIX_ITEM_URI.length);
|
||||
return aURI;
|
||||
}
|
||||
|
@ -669,7 +669,7 @@ function Startup()
|
|||
var viewGroup = document.getElementById("viewGroup");
|
||||
|
||||
gExtensionsView.focus();
|
||||
gExtensionsViewController.onCommandUpdate();
|
||||
gExtensionsViewController.onCommandUpdate();
|
||||
|
||||
// Now look and see if we're being opened by XPInstall
|
||||
gDownloadManager = new XPInstallDownloadManager();
|
||||
|
@ -734,7 +734,7 @@ function Startup()
|
|||
window.close();
|
||||
}
|
||||
|
||||
function Shutdown()
|
||||
function Shutdown()
|
||||
{
|
||||
gPref = null;
|
||||
gExtensionsView.removeEventListener("select", onAddonSelect, false);
|
||||
|
@ -809,7 +809,7 @@ XPInstallDownloadManager.prototype = {
|
|||
var type = isTheme ? nsIUpdateItem.TYPE_THEME : nsIUpdateItem.TYPE_EXTENSION;
|
||||
var item = Components.classes["@mozilla.org/updates/item;1"]
|
||||
.createInstance(Components.interfaces.nsIUpdateItem);
|
||||
item.init(url, " ", "app-profile", "", "", displayName, url, "", iconURL, "", type);
|
||||
item.init(url, " ", "app-profile", "", "", displayName, url, "", iconURL, "", type, "");
|
||||
items.push(item);
|
||||
|
||||
// Advance the enumerator
|
||||
|
@ -828,7 +828,7 @@ XPInstallDownloadManager.prototype = {
|
|||
return element;
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAddonUpdateListener
|
||||
onStateChange: function (aAddon, aState, aValue)
|
||||
{
|
||||
|
@ -906,7 +906,7 @@ XPInstallDownloadManager.prototype = {
|
|||
element.setAttribute("status", statusCurrent);
|
||||
},
|
||||
|
||||
_replaceInsert: function ( text, index, value )
|
||||
_replaceInsert: function ( text, index, value )
|
||||
{
|
||||
return text.replace("#"+index, value);
|
||||
},
|
||||
|
@ -919,7 +919,7 @@ XPInstallDownloadManager.prototype = {
|
|||
{
|
||||
var progressHasMB = parseInt(aKBytes/1000) > 0;
|
||||
var totalHasMB = parseInt(aTotalKBytes/1000) > 0;
|
||||
|
||||
|
||||
var format = "";
|
||||
if (!progressHasMB && !totalHasMB) {
|
||||
format = this._statusFormatKBKB;
|
||||
|
@ -941,12 +941,12 @@ XPInstallDownloadManager.prototype = {
|
|||
dump("*** huh?!\n");
|
||||
}
|
||||
|
||||
return format;
|
||||
return format;
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
QueryInterface: function (aIID)
|
||||
QueryInterface: function (aIID)
|
||||
{
|
||||
if (!aIID.equals(Components.interfaces.nsIAddonUpdateListener) &&
|
||||
!aIID.equals(Components.interfaces.nsISupports))
|
||||
|
@ -965,7 +965,7 @@ UpdateCheckListener.prototype = {
|
|||
_updateFound: false,
|
||||
_totalCount: 0,
|
||||
_completedCount: 0,
|
||||
|
||||
|
||||
/**
|
||||
* See nsIExtensionManager.idl
|
||||
*/
|
||||
|
@ -975,7 +975,7 @@ UpdateCheckListener.prototype = {
|
|||
updateGlobalCommands();
|
||||
this._totalCount = gExtensionsView.children.length;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* See nsIExtensionManager.idl
|
||||
*/
|
||||
|
@ -997,7 +997,7 @@ UpdateCheckListener.prototype = {
|
|||
window.addEventListener("command", noUpdatesDismiss, true);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* See nsIExtensionManager.idl
|
||||
*/
|
||||
|
@ -1008,7 +1008,7 @@ UpdateCheckListener.prototype = {
|
|||
element.setAttribute("loading", "true");
|
||||
element.setAttribute("updateStatus", getExtensionString("updatingMsg"));
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* See nsIExtensionManager.idl
|
||||
*/
|
||||
|
@ -1053,7 +1053,7 @@ UpdateCheckListener.prototype = {
|
|||
document.getElementById("progressStatus").value = getExtensionString("finishedUpdateCheck", [addon.name]);
|
||||
document.getElementById("addonsProgress").value = Math.ceil((this._completedCount / this._totalCount) * 100);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* See nsISupports.idl
|
||||
*/
|
||||
|
@ -1226,7 +1226,7 @@ function buildContextMenu(aEvent)
|
|||
case "installs":
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1237,7 +1237,7 @@ var gExtensionsDNDObserver =
|
|||
{
|
||||
_ioServ: null,
|
||||
_canDrop: false,
|
||||
|
||||
|
||||
_ensureServices: function ()
|
||||
{
|
||||
if (!this._ioServ)
|
||||
|
@ -1318,12 +1318,12 @@ var gExtensionsDNDObserver =
|
|||
return;
|
||||
|
||||
this._ensureServices();
|
||||
|
||||
|
||||
var xpinstallObj = { };
|
||||
var themes = { };
|
||||
var xpiCount = 0;
|
||||
var themeCount = 0;
|
||||
|
||||
|
||||
var count = aDragSession.numDropItems;
|
||||
for (var i = 0; i < count; ++i) {
|
||||
var fileData = this._getDataFromDragSession(aDragSession, i);
|
||||
|
@ -1340,7 +1340,7 @@ var gExtensionsDNDObserver =
|
|||
}
|
||||
}
|
||||
|
||||
if (xpiCount > 0)
|
||||
if (xpiCount > 0)
|
||||
InstallTrigger.install(xpinstallObj);
|
||||
if (themeCount > 0) {
|
||||
// XXXrstrong Only allow the install of one theme due to bug 257992
|
||||
|
@ -1350,7 +1350,7 @@ var gExtensionsDNDObserver =
|
|||
}
|
||||
}
|
||||
},
|
||||
_flavourSet: null,
|
||||
_flavourSet: null,
|
||||
getSupportedFlavours: function ()
|
||||
{
|
||||
if (!this._flavourSet) {
|
||||
|
@ -1582,7 +1582,7 @@ function restartApp() {
|
|||
.createInstance(Components.interfaces.nsISupportsPRBool);
|
||||
os.notifyObservers(cancelQuit, "quit-application-requested", "restart");
|
||||
|
||||
// Something aborted the quit process.
|
||||
// Something aborted the quit process.
|
||||
if (cancelQuit.data)
|
||||
return;
|
||||
|
||||
|
@ -1620,7 +1620,7 @@ function confirmOperation(aName, aTitle, aQueryMsg, aAcceptBtn, aCancelBtn,
|
|||
for (var i = 0; i < aDependantItems.length; ++i)
|
||||
names.push(aDependantItems[i].name + " " + aDependantItems[i].version);
|
||||
|
||||
window.openDialog("chrome://mozapps/content/extensions/list.xul", "",
|
||||
window.openDialog("chrome://mozapps/content/extensions/list.xul", "",
|
||||
"titlebar,modal,centerscreen", names, params);
|
||||
return params.result == "accept";
|
||||
}
|
||||
|
@ -1714,29 +1714,29 @@ var gExtensionsViewController = {
|
|||
{
|
||||
if (this.isCommandEnabled(aCommand))
|
||||
this.commands[aCommand](gExtensionsView.selectedItem);
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
onCommandUpdate: function ()
|
||||
{
|
||||
var extensionsCommands = document.getElementById("extensionsCommands");
|
||||
for (var i = 0; i < extensionsCommands.childNodes.length; ++i)
|
||||
this.updateCommand(extensionsCommands.childNodes[i]);
|
||||
},
|
||||
|
||||
updateCommand: function (command)
|
||||
|
||||
updateCommand: function (command)
|
||||
{
|
||||
if (this.isCommandEnabled(command.id))
|
||||
command.removeAttribute("disabled");
|
||||
else
|
||||
command.setAttribute("disabled", "true");
|
||||
},
|
||||
|
||||
commands: {
|
||||
|
||||
commands: {
|
||||
cmd_close: function (aSelectedItem)
|
||||
{
|
||||
closeWindow(true);
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
cmd_useTheme: function (aSelectedItem)
|
||||
{
|
||||
gCurrentTheme = aSelectedItem.getAttribute("internalName");
|
||||
|
@ -1755,14 +1755,15 @@ var gExtensionsViewController = {
|
|||
// Update the view
|
||||
setRestartMessage(aSelectedItem);
|
||||
}
|
||||
|
||||
// Flush preference change to disk
|
||||
gPref.QueryInterface(Components.interfaces.nsIPrefService)
|
||||
.savePrefFile(null);
|
||||
|
||||
|
||||
// disable the useThemeButton
|
||||
gExtensionsViewController.onCommandUpdate();
|
||||
},
|
||||
|
||||
|
||||
cmd_options: function (aSelectedItem)
|
||||
{
|
||||
if (!aSelectedItem) return;
|
||||
|
@ -1791,7 +1792,7 @@ var gExtensionsViewController = {
|
|||
}
|
||||
openDialog(optionsURL, "", features);
|
||||
},
|
||||
|
||||
|
||||
cmd_homepage: function (aSelectedItem)
|
||||
{
|
||||
if (!aSelectedItem) return;
|
||||
|
@ -1806,7 +1807,7 @@ var gExtensionsViewController = {
|
|||
if (uri && (scheme == "http" || scheme == "https"))
|
||||
openURL(uri.spec);
|
||||
},
|
||||
|
||||
|
||||
cmd_about: function (aSelectedItem)
|
||||
{
|
||||
if (!aSelectedItem) return;
|
||||
|
@ -1815,8 +1816,8 @@ var gExtensionsViewController = {
|
|||
openDialog(aboutURL, "", "chrome,centerscreen,modal");
|
||||
else
|
||||
openDialog("chrome://mozapps/content/extensions/about.xul", "", "chrome,centerscreen,modal", aSelectedItem.id, gExtensionsView.database);
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
cmd_checkUpdate: function (aSelectedItem)
|
||||
{
|
||||
if (isOffline("offlineUpdateMsg"))
|
||||
|
@ -1950,7 +1951,7 @@ var gExtensionsViewController = {
|
|||
gExtensionsView.selectedItem.focus();
|
||||
updateOptionalViews();
|
||||
},
|
||||
|
||||
|
||||
cmd_enable: function (aSelectedItem)
|
||||
{
|
||||
if (aSelectedItem.getAttribute("plugin") == "true") {
|
||||
|
@ -1971,14 +1972,14 @@ var gExtensionsViewController = {
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
function installSkin()
|
||||
{
|
||||
// 1) Prompt the user for the location of the theme to install.
|
||||
// 1) Prompt the user for the location of the theme to install.
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
|
||||
fp.init(window, getExtensionString("installThemePickerTitle"), nsIFilePicker.modeOpen);
|
||||
fp.appendFilter(getExtensionString("themesFilter"), "*.jar");
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
|
||||
var ret = fp.show();
|
||||
if (ret == nsIFilePicker.returnOK)
|
||||
if (ret == nsIFilePicker.returnOK)
|
||||
{
|
||||
var ioService = Components.classes['@mozilla.org/network/io-service;1'].getService(nsIIOService);
|
||||
var fileProtocolHandler =
|
||||
|
@ -1996,7 +1997,7 @@ function installExtension()
|
|||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
|
||||
var ret = fp.show();
|
||||
if (ret == nsIFilePicker.returnOK)
|
||||
if (ret == nsIFilePicker.returnOK)
|
||||
{
|
||||
var ioService = Components.classes['@mozilla.org/network/io-service;1'].getService(nsIIOService);
|
||||
var fileProtocolHandler =
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
#
|
||||
# The Original Code is The Update Service.
|
||||
#
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
# Robert Strong <robert.bugzilla@gmail.com>
|
||||
#
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
|
@ -33,7 +33,7 @@
|
|||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
// This UI is only opened from the Extension Manager when the app is upgraded.
|
||||
|
@ -56,19 +56,19 @@ var gUpdateWizard = {
|
|||
shouldAutoCheck: false,
|
||||
xpinstallEnabled: false,
|
||||
xpinstallLocked: false,
|
||||
|
||||
|
||||
init: function ()
|
||||
{
|
||||
var em = Components.classes["@mozilla.org/extensions/manager;1"]
|
||||
.getService(nsIExtensionManager);
|
||||
// Retrieve all items in order to sync their app compatibility information
|
||||
this.items = em.getItemList(nsIUpdateItem.TYPE_ADDON, { });
|
||||
var pref =
|
||||
var pref =
|
||||
Components.classes["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
try {
|
||||
this.shouldSuggestAutoChecking =
|
||||
this.shouldSuggestAutoChecking =
|
||||
!pref.getBoolPref(PREF_UPDATE_EXTENSIONS_ENABLED);
|
||||
}
|
||||
catch (e) {
|
||||
|
@ -83,13 +83,13 @@ var gUpdateWizard = {
|
|||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
if (ioService.offline)
|
||||
document.documentElement.currentPage =
|
||||
document.documentElement.currentPage =
|
||||
document.getElementById("offline");
|
||||
else
|
||||
document.documentElement.currentPage =
|
||||
document.documentElement.currentPage =
|
||||
document.getElementById("versioninfo");
|
||||
},
|
||||
|
||||
|
||||
onWizardFinish: function ()
|
||||
{
|
||||
var pref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
|
@ -97,7 +97,7 @@ var gUpdateWizard = {
|
|||
if (this.shouldSuggestAutoChecking)
|
||||
pref.setBoolPref(PREF_UPDATE_EXTENSIONS_ENABLED, this.shouldAutoCheck);
|
||||
},
|
||||
|
||||
|
||||
_setUpButton: function (aButtonID, aButtonKey, aDisabled)
|
||||
{
|
||||
var strings = document.getElementById("updateStrings");
|
||||
|
@ -112,8 +112,8 @@ var gUpdateWizard = {
|
|||
}
|
||||
button.disabled = aDisabled;
|
||||
},
|
||||
|
||||
setButtonLabels: function (aBackButton, aBackButtonIsDisabled,
|
||||
|
||||
setButtonLabels: function (aBackButton, aBackButtonIsDisabled,
|
||||
aNextButton, aNextButtonIsDisabled,
|
||||
aCancelButton, aCancelButtonIsDisabled)
|
||||
{
|
||||
|
@ -121,16 +121,16 @@ var gUpdateWizard = {
|
|||
this._setUpButton("next", aNextButton, aNextButtonIsDisabled);
|
||||
this._setUpButton("cancel", aCancelButton, aCancelButtonIsDisabled);
|
||||
},
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Update Errors
|
||||
errorItems: [],
|
||||
showErrors: function (aState, aErrors)
|
||||
{
|
||||
openDialog("chrome://mozapps/content/update/errors.xul", "",
|
||||
openDialog("chrome://mozapps/content/update/errors.xul", "",
|
||||
"modal", { state: aState, errors: aErrors });
|
||||
},
|
||||
|
||||
|
||||
// Displays a list of items that had an error during the update check. We
|
||||
// don't display the actual error that occured since
|
||||
// nsIAddonUpdateCheckListener doesn't return the error details.
|
||||
|
@ -147,7 +147,7 @@ var gUpdateWizard = {
|
|||
if (this.errorItems.length > 0)
|
||||
document.getElementById(aElementIDToShow).hidden = false;
|
||||
},
|
||||
|
||||
|
||||
onWizardClose: function (aEvent)
|
||||
{
|
||||
if (gInstallingPage._installing) {
|
||||
|
@ -155,7 +155,7 @@ var gUpdateWizard = {
|
|||
.getService(Components.interfaces.nsIObserverService);
|
||||
os.notifyObservers(null, "xpinstall-progress", "cancel");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@ -168,7 +168,7 @@ var gOfflinePage = {
|
|||
ioService.offline = false;
|
||||
return true;
|
||||
},
|
||||
|
||||
|
||||
toggleOffline: function ()
|
||||
{
|
||||
var nextbtn = document.documentElement.getButton("next");
|
||||
|
@ -181,8 +181,8 @@ var gVersionInfoPage = {
|
|||
_totalCount: 0,
|
||||
onPageShow: function ()
|
||||
{
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"nextButtonText", true,
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"nextButtonText", true,
|
||||
"cancelButtonText", false);
|
||||
var em = Components.classes["@mozilla.org/extensions/manager;1"]
|
||||
.getService(nsIExtensionManager);
|
||||
|
@ -195,17 +195,17 @@ var gVersionInfoPage = {
|
|||
onUpdateStarted: function() {
|
||||
this._totalCount = gUpdateWizard.items.length;
|
||||
},
|
||||
|
||||
|
||||
onUpdateEnded: function() {
|
||||
var em = Components.classes["@mozilla.org/extensions/manager;1"]
|
||||
.getService(nsIExtensionManager);
|
||||
// Retrieve the remaining incompatible items.
|
||||
gUpdateWizard.items = em.getIncompatibleItemList(null, null,
|
||||
gUpdateWizard.items = em.getIncompatibleItemList(null, null, null,
|
||||
nsIUpdateItem.TYPE_ADDON,
|
||||
true, { });
|
||||
if (gUpdateWizard.items.length > 0) {
|
||||
// There are still incompatible addons, inform the user.
|
||||
document.documentElement.currentPage =
|
||||
document.documentElement.currentPage =
|
||||
document.getElementById("mismatch");
|
||||
}
|
||||
else {
|
||||
|
@ -216,10 +216,10 @@ var gVersionInfoPage = {
|
|||
setTimeout(close, 0);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
onAddonUpdateStarted: function(addon) {
|
||||
},
|
||||
|
||||
|
||||
onAddonUpdateEnded: function(addon, status) {
|
||||
if (status == nsIAUCL.STATUS_VERSIONINFO) {
|
||||
for (var i = 0; i < gUpdateWizard.items.length; ++i) {
|
||||
|
@ -246,11 +246,11 @@ var gVersionInfoPage = {
|
|||
progress.mode = "normal";
|
||||
progress.value = Math.ceil((this._completeCount / this._totalCount) * 100);
|
||||
},
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
QueryInterface: function(iid) {
|
||||
if (!iid.equals(Components.interfaces.nsIAddonUpdateCheckListener) &&
|
||||
if (!iid.equals(Components.interfaces.nsIAddonUpdateCheckListener) &&
|
||||
!iid.equals(Components.interfaces.nsISupports))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return this;
|
||||
|
@ -260,8 +260,8 @@ var gVersionInfoPage = {
|
|||
var gMismatchPage = {
|
||||
onPageShow: function ()
|
||||
{
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"mismatchCheckNow", false,
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"mismatchCheckNow", false,
|
||||
"mismatchDontCheck", false);
|
||||
document.documentElement.getButton("next").focus();
|
||||
|
||||
|
@ -285,13 +285,13 @@ var gUpdatePage = {
|
|||
return;
|
||||
}
|
||||
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"nextButtonText", true,
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"nextButtonText", true,
|
||||
"cancelButtonText", false);
|
||||
document.documentElement.getButton("next").focus();
|
||||
|
||||
gUpdateWizard.errorItems = [];
|
||||
|
||||
|
||||
this._totalCount = gUpdateWizard.items.length;
|
||||
var em = Components.classes["@mozilla.org/extensions/manager;1"]
|
||||
.getService(nsIExtensionManager);
|
||||
|
@ -303,23 +303,23 @@ var gUpdatePage = {
|
|||
// nsIAddonUpdateCheckListener
|
||||
onUpdateStarted: function() {
|
||||
},
|
||||
|
||||
|
||||
onUpdateEnded: function() {
|
||||
var nextPage = document.getElementById("noupdates");
|
||||
if (gUpdateWizard.itemsToUpdate.length > 0)
|
||||
nextPage = document.getElementById("found");
|
||||
document.documentElement.currentPage = nextPage;
|
||||
},
|
||||
|
||||
|
||||
onAddonUpdateStarted: function(addon) {
|
||||
},
|
||||
|
||||
|
||||
onAddonUpdateEnded: function(addon, status) {
|
||||
if (status == nsIAUCL.STATUS_UPDATE)
|
||||
gUpdateWizard.itemsToUpdate.push(addon);
|
||||
else if (status == nsIAUCL.STATUS_FAILURE)
|
||||
gUpdateWizard.errorItems.push(addon);
|
||||
|
||||
|
||||
++this._completeCount;
|
||||
|
||||
// Update the status text and progress bar
|
||||
|
@ -331,22 +331,22 @@ var gUpdatePage = {
|
|||
var progress = document.getElementById("checking.progress");
|
||||
progress.value = Math.ceil((this._completeCount / this._totalCount) * 100);
|
||||
},
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
QueryInterface: function(iid) {
|
||||
if (!iid.equals(Components.interfaces.nsIAddonUpdateCheckListener) &&
|
||||
if (!iid.equals(Components.interfaces.nsIAddonUpdateCheckListener) &&
|
||||
!iid.equals(Components.interfaces.nsISupports))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var gFoundPage = {
|
||||
onPageShow: function ()
|
||||
{
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"installButtonText", false,
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"installButtonText", false,
|
||||
null, false);
|
||||
|
||||
var foundUpdates = document.getElementById("found.updates");
|
||||
|
@ -371,7 +371,7 @@ var gFoundPage = {
|
|||
document.documentElement.getButton("next").disabled = false;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
toggleXPInstallEnable: function(aEvent)
|
||||
{
|
||||
var enabled = aEvent.target.checked;
|
||||
|
@ -399,10 +399,10 @@ var gFoundPage = {
|
|||
break;
|
||||
}
|
||||
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"installButtonText", true,
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"installButtonText", true,
|
||||
null, false);
|
||||
document.getElementById("found").setAttribute("next", "installing");
|
||||
document.getElementById("found").setAttribute("next", "installing");
|
||||
document.documentElement.getButton("next").disabled = !oneChecked;
|
||||
}
|
||||
};
|
||||
|
@ -414,12 +414,12 @@ var gInstallingPage = {
|
|||
|
||||
onPageShow: function ()
|
||||
{
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"nextButtonText", true,
|
||||
gUpdateWizard.setButtonLabels(null, true,
|
||||
"nextButtonText", true,
|
||||
null, true);
|
||||
|
||||
// Get XPInstallManager and kick off download/install
|
||||
// process, registering us as an observer.
|
||||
// Get XPInstallManager and kick off download/install
|
||||
// process, registering us as an observer.
|
||||
var items = [];
|
||||
var hashes = [];
|
||||
this._objs = [];
|
||||
|
@ -434,12 +434,12 @@ var gInstallingPage = {
|
|||
hashes.push(updates[i].getAttribute("hash") ? updates[i].getAttribute("hash") : null);
|
||||
this._objs.push({ name: updates[i].label });
|
||||
}
|
||||
|
||||
|
||||
var xpimgr = Components.classes["@mozilla.org/xpinstall/install-manager;1"]
|
||||
.createInstance(Components.interfaces.nsIXPInstallManager);
|
||||
xpimgr.initManagerWithHashes(items, hashes, items.length, this);
|
||||
},
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsIXPIProgressDialog
|
||||
onStateChange: function (aIndex, aState, aValue)
|
||||
|
@ -477,7 +477,7 @@ var gInstallingPage = {
|
|||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
onProgress: function (aIndex, aValue, aMaxValue)
|
||||
{
|
||||
var downloadProgress = document.getElementById("downloadProgress");
|
||||
|
@ -491,7 +491,7 @@ var gInstallErrorsPage = {
|
|||
gUpdateWizard.setButtonLabels(null, true, null, true, null, true);
|
||||
document.documentElement.getButton("finish").focus();
|
||||
},
|
||||
|
||||
|
||||
onShowErrors: function ()
|
||||
{
|
||||
gUpdateWizard.showErrors("install", gInstallingPage._errors);
|
||||
|
@ -503,7 +503,7 @@ var gInstallErrorsPage = {
|
|||
var gAdminDisabledPage = {
|
||||
onPageShow: function ()
|
||||
{
|
||||
gUpdateWizard.setButtonLabels(null, true, null, true,
|
||||
gUpdateWizard.setButtonLabels(null, true, null, true,
|
||||
"cancelButtonText", true);
|
||||
document.documentElement.getButton("finish").focus();
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ var gFinishedPage = {
|
|||
{
|
||||
gUpdateWizard.setButtonLabels(null, true, null, true, null, true);
|
||||
document.documentElement.getButton("finish").focus();
|
||||
|
||||
|
||||
if (gUpdateWizard.shouldSuggestAutoChecking) {
|
||||
document.getElementById("finishedCheckDisabled").hidden = false;
|
||||
gUpdateWizard.shouldAutoCheck = true;
|
||||
|
@ -545,4 +545,3 @@ var gNoUpdatesPage = {
|
|||
document.documentElement.getButton("finish").focus();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
* Contributor(s):
|
||||
* Ben Goodger <ben@mozilla.org> (Google Inc.)
|
||||
* Robert Strong <robert.bugzilla@gmail.com>
|
||||
* Alexander J. Vincent <ajvincent@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -49,7 +50,7 @@ interface nsISimpleEnumerator;
|
|||
interface nsIDirectoryEnumerator;
|
||||
|
||||
/**
|
||||
* Interface representing a location where extensions, themes etc are
|
||||
* Interface representing a location where extensions, themes etc are
|
||||
* installed.
|
||||
*/
|
||||
[scriptable, uuid(32a74707-ec7c-af19-f4d8-d0cd8cb6a948)]
|
||||
|
@ -59,7 +60,7 @@ interface nsIInstallLocation : nsISupports
|
|||
* The string identifier of this Install Location
|
||||
*/
|
||||
readonly attribute AString name;
|
||||
|
||||
|
||||
/**
|
||||
* An enumeration of nsIFiles for:
|
||||
* - locations that contain items
|
||||
|
@ -72,8 +73,8 @@ interface nsIInstallLocation : nsISupports
|
|||
/**
|
||||
* The file system location where items live. Items can be dropped in
|
||||
* at this location. Can be null for Install Locations that don't have
|
||||
* a file system presence.
|
||||
* Note: This is a clone of the actual location which the caller can
|
||||
* a file system presence.
|
||||
* Note: This is a clone of the actual location which the caller can
|
||||
* modify freely.
|
||||
*/
|
||||
readonly attribute nsIFile location;
|
||||
|
@ -82,14 +83,14 @@ interface nsIInstallLocation : nsISupports
|
|||
* Whether or not this Install Location is on an area of the file system
|
||||
* that could be restricted on a restricted-access account, regardless
|
||||
* of whether or not the location is restricted with the current user
|
||||
* privileges.
|
||||
* privileges.
|
||||
*/
|
||||
readonly attribute boolean restricted;
|
||||
|
||||
/**
|
||||
* Whether or not the user can write to the Install Location with the
|
||||
* current access privileges. This is different from restricted because
|
||||
* it's not whether or not the location *might* be restricted, it's
|
||||
* it's not whether or not the location *might* be restricted, it's
|
||||
* whether or not it actually *is* restricted right now.
|
||||
*/
|
||||
readonly attribute boolean canAccess;
|
||||
|
@ -97,7 +98,7 @@ interface nsIInstallLocation : nsISupports
|
|||
/**
|
||||
* Constants representing priority of some default Install Locations.
|
||||
* XXXben - priority ranking of user-level items vs. global-level items
|
||||
* here is debatable. Should app-system-global trump
|
||||
* here is debatable. Should app-system-global trump
|
||||
* xre-system-user?
|
||||
* You should not use the exact values here, you should offset from
|
||||
* these values each time you create a new Install Location. Offsetting
|
||||
|
@ -109,17 +110,17 @@ interface nsIInstallLocation : nsISupports
|
|||
const unsigned long PRIORITY_XRE_SYSTEM_USER = 100;
|
||||
const unsigned long PRIORITY_APP_SYSTEM_GLOBAL = 1000;
|
||||
const unsigned long PRIORITY_XRE_SYSTEM_GLOBAL = 10000;
|
||||
|
||||
|
||||
/**
|
||||
* The priority level of this Install Location in loading.
|
||||
* The priority level of this Install Location in loading.
|
||||
*/
|
||||
readonly attribute long priority;
|
||||
|
||||
|
||||
/**
|
||||
* Gets the directory that contains an item.
|
||||
* @param id
|
||||
* The GUID of the item.
|
||||
* @returns The location of the item.
|
||||
* @returns The location of the item.
|
||||
*/
|
||||
nsIFile getItemLocation(in AString id);
|
||||
|
||||
|
@ -192,12 +193,12 @@ interface nsIInstallLocation : nsISupports
|
|||
|
||||
/**
|
||||
* Interface representing a system for the installation and management of
|
||||
* Extensions, Themes etc.
|
||||
* Extensions, Themes etc.
|
||||
*
|
||||
* XXXben - Some of this stuff should go into a management-ey interface,
|
||||
* XXXben - Some of this stuff should go into a management-ey interface,
|
||||
* some into an app-startup-ey interface.
|
||||
*/
|
||||
[scriptable, uuid(f5c34a77-3487-4b70-a65a-6727fa066324)]
|
||||
[scriptable, uuid(feccf1ac-df58-43c1-bef0-b86dc768b906)]
|
||||
interface nsIExtensionManager : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -206,21 +207,21 @@ interface nsIExtensionManager : nsISupports
|
|||
const unsigned long UPDATE_CHECK_NEWVERSION = 0;
|
||||
const unsigned long UPDATE_CHECK_COMPATIBILITY = 1;
|
||||
const unsigned long UPDATE_SYNC_COMPATIBILITY = 2;
|
||||
|
||||
|
||||
/**
|
||||
* Starts the Extension Manager, checking for item changes, additions and
|
||||
* removals, and finishing pending operations.
|
||||
* @param commandLine
|
||||
* The command line the application was started with.
|
||||
* @returns true if the application has rewritten the extensions.ini file
|
||||
* and needs to restart to register components/chrome etc,
|
||||
* and needs to restart to register components/chrome etc,
|
||||
* false otherwise
|
||||
*/
|
||||
boolean start(in nsICommandLine commandLine);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Determines if there are incompatible items installed (and offers to
|
||||
* upgrade them to newer versions if available, via a UI).
|
||||
* upgrade them to newer versions if available, via a UI).
|
||||
* @returns true if there were incompatible items that were disabled
|
||||
* and the application needs to restart to re-register components,
|
||||
* chrome etc, false otherwise.
|
||||
|
@ -231,7 +232,7 @@ interface nsIExtensionManager : nsISupports
|
|||
* Handle command line flags, e.g. -install-global-[extension|theme]
|
||||
* @param cmdLine
|
||||
* the command line the application was started with
|
||||
* XXXben - move this off this API - currently it is only used for
|
||||
* XXXben - move this off this API - currently it is only used for
|
||||
* global installation, and the apprunner can do this directly
|
||||
* with |installItemFromFile|
|
||||
*/
|
||||
|
@ -251,12 +252,12 @@ interface nsIExtensionManager : nsISupports
|
|||
readonly attribute nsISimpleEnumerator installLocations;
|
||||
|
||||
/**
|
||||
* Installs an item from a XPI/JAR file into the location specified.
|
||||
* Installs an item from a XPI/JAR file into the location specified.
|
||||
* @param xpiFile
|
||||
* The source file to install from. This function stages a copy
|
||||
* of this file for persistence across potential application
|
||||
* of this file for persistence across potential application
|
||||
* restarts, you are responsible for removing the file you pass
|
||||
* in.
|
||||
* in.
|
||||
* @param installLocationKey
|
||||
* The name identifier of an Install Location to install into.
|
||||
*/
|
||||
|
@ -300,10 +301,12 @@ interface nsIExtensionManager : nsISupports
|
|||
* installed version and synchronize the values.
|
||||
* @param listener
|
||||
* An nsIAddonUpdateCheckListener object which will be notified during
|
||||
* the update check process.
|
||||
* the update check process.
|
||||
*
|
||||
* @throws NS_ERROR_ILLEGAL_VALUE if any item is invalid, or if itemCount == 0.
|
||||
*/
|
||||
void update([array, size_is(itemCount)] in nsIUpdateItem items,
|
||||
in unsigned long itemCount,
|
||||
in unsigned long itemCount,
|
||||
in unsigned long updateCheckType,
|
||||
in nsIAddonUpdateCheckListener listener);
|
||||
|
||||
|
@ -317,7 +320,7 @@ interface nsIExtensionManager : nsISupports
|
|||
nsIUpdateItem getItemForID(in AString id);
|
||||
|
||||
/**
|
||||
* Retrieves a list of visible nsIUpdateItems of items matching the
|
||||
* Retrieves a list of visible nsIUpdateItems of items matching the
|
||||
* specified type.
|
||||
* @param type
|
||||
* The type of item to return.
|
||||
|
@ -325,7 +328,7 @@ interface nsIExtensionManager : nsISupports
|
|||
* The XPCJS reference to the number of items returned.
|
||||
* @returns An array of nsIUpdateItems matching the id/type filter.
|
||||
*
|
||||
* XXXben - it would be good if this function took an optional
|
||||
* XXXben - it would be good if this function took an optional
|
||||
* install location.
|
||||
*/
|
||||
void getItemList(in unsigned long type, out unsigned long itemCount,
|
||||
|
@ -336,19 +339,22 @@ interface nsIExtensionManager : nsISupports
|
|||
* with the supplied parameters.
|
||||
* @param id
|
||||
* The id of the application to check compatibility against
|
||||
* @param version
|
||||
* @param appVersion
|
||||
* The version of the application to check compatibility against
|
||||
* @param platformVersion
|
||||
* The version of the toolkit 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,
|
||||
* 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.
|
||||
*/
|
||||
void getIncompatibleItemList(in AString id,
|
||||
in AString version,
|
||||
void getIncompatibleItemList(in AString id,
|
||||
in AString appVersion,
|
||||
in AString platformVersion,
|
||||
in unsigned long type,
|
||||
in boolean includeDisabled,
|
||||
out unsigned long itemCount,
|
||||
|
@ -356,7 +362,7 @@ interface nsIExtensionManager : nsISupports
|
|||
|
||||
/**
|
||||
* The Extensions Datasource
|
||||
* XXXben - the datasource should be registered with the RDF system, so it
|
||||
* XXXben - the datasource should be registered with the RDF system, so it
|
||||
* can be accessed via rdf:extensions, and not exposed through the API
|
||||
* like this.
|
||||
*/
|
||||
|
@ -371,6 +377,8 @@ interface nsIExtensionManager : nsISupports
|
|||
* @param fromChrome
|
||||
* true when called from chrome
|
||||
* false when not called from chrome (e.g. web page)
|
||||
*
|
||||
* @throws NS_ERROR_ILLEGAL_VALUE if any item is invalid, or if itemCount == 0.
|
||||
*/
|
||||
void addDownloads([array, size_is(itemCount)] in nsIUpdateItem items,
|
||||
in unsigned long itemCount, in boolean fromChrome);
|
||||
|
@ -387,7 +395,7 @@ interface nsIExtensionManager : nsISupports
|
|||
* and install progress.
|
||||
* @param listener
|
||||
* The listener to add
|
||||
* @returns the index of the added listen in the listener list.
|
||||
* @returns the index of the added listen in the listener list.
|
||||
*/
|
||||
long addUpdateListener(in nsIAddonUpdateListener listener);
|
||||
|
||||
|
@ -465,12 +473,12 @@ interface nsIExtensionManager : nsISupports
|
|||
};
|
||||
|
||||
/**
|
||||
* An item managed by the Extension System. Contains metadata that describes
|
||||
* An item managed by the Extension System. Contains metadata that describes
|
||||
* the item.
|
||||
* XXXben work in progress, the name of this interface will change after the
|
||||
* update system is complete, probably to nsIAddon
|
||||
*/
|
||||
[scriptable, uuid(7f952767-427f-402b-8114-f80c95d1980d)]
|
||||
[scriptable, uuid(a15390e0-2ad6-422c-9596-94f95286c16f)]
|
||||
interface nsIUpdateItem : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -484,7 +492,7 @@ interface nsIUpdateItem : nsISupports
|
|||
readonly attribute AString version;
|
||||
|
||||
/**
|
||||
* The minimum version of the application that this item works with,
|
||||
* The minimum version of the application that this item works with,
|
||||
* in FVF format.
|
||||
*/
|
||||
readonly attribute AString minAppVersion;
|
||||
|
@ -526,7 +534,7 @@ interface nsIUpdateItem : nsISupports
|
|||
* The URL of the update RDF file for this item.
|
||||
*/
|
||||
readonly attribute AString updateRDF;
|
||||
|
||||
|
||||
const unsigned long TYPE_APP = 0x01;
|
||||
const unsigned long TYPE_EXTENSION = 0x02;
|
||||
const unsigned long TYPE_THEME = 0x04;
|
||||
|
@ -540,14 +548,23 @@ interface nsIUpdateItem : nsISupports
|
|||
*/
|
||||
readonly attribute long type;
|
||||
|
||||
/**
|
||||
* The target application ID used for checking compatibility for this item.
|
||||
*
|
||||
* @note Add-ons can specify a targetApplication id of toolkit@mozilla.org in
|
||||
* their install manifest for compatibility with all apps using a
|
||||
* specific release of the toolkit.
|
||||
*/
|
||||
readonly attribute AString targetAppID;
|
||||
|
||||
/**
|
||||
* Initializes this Item object.
|
||||
*/
|
||||
void init(in AString id, in AString version,
|
||||
in AString installLocationKey, in AString minAppVersion,
|
||||
void init(in AString id, in AString version,
|
||||
in AString installLocationKey, in AString minAppVersion,
|
||||
in AString maxAppVersion, in AString name,
|
||||
in AString downloadURL, in AString xpiHash, in AString iconURL,
|
||||
in AString updateURL, in long type);
|
||||
in AString updateURL, in long type, in AString targetAppID);
|
||||
|
||||
/**
|
||||
* Returns a JS Object source representing an nsIUpdateItem.
|
||||
|
@ -556,7 +573,7 @@ interface nsIUpdateItem : nsISupports
|
|||
};
|
||||
|
||||
/**
|
||||
* Interface for handling download and install progress notifications for
|
||||
* Interface for handling download and install progress notifications for
|
||||
* addons.
|
||||
*/
|
||||
[scriptable, uuid(bb86037c-98c1-4c22-8e03-1e4c9fc89a8e)]
|
||||
|
@ -582,7 +599,7 @@ interface nsIAddonUpdateListener : nsISupports
|
|||
* @param maxValue
|
||||
* The maximum value |value| can reach
|
||||
*/
|
||||
void onProgress(in nsIUpdateItem addon, in unsigned long value,
|
||||
void onProgress(in nsIUpdateItem addon, in unsigned long value,
|
||||
in unsigned long maxValue);
|
||||
};
|
||||
|
||||
|
@ -600,7 +617,7 @@ interface nsIAddonUpdateCheckListener : nsISupports
|
|||
const unsigned long STATUS_NONE = 0;
|
||||
const unsigned long STATUS_UPDATE = 1;
|
||||
const unsigned long STATUS_VERSIONINFO = 2;
|
||||
const unsigned long STATUS_DATA_FOUND =
|
||||
const unsigned long STATUS_DATA_FOUND =
|
||||
STATUS_UPDATE + STATUS_VERSIONINFO;
|
||||
const unsigned long STATUS_FAILURE = 4;
|
||||
const unsigned long STATUS_NO_UPDATE = 8;
|
||||
|
@ -622,6 +639,8 @@ interface nsIAddonUpdateCheckListener : nsISupports
|
|||
* Update for an individual addon has begun
|
||||
* @param addon
|
||||
* A nsIUpdateItem object representing the addon being updated
|
||||
*
|
||||
* @throws NS_ERROR_ILLEGAL_VALUE if the addon is invalid.
|
||||
*/
|
||||
void onAddonUpdateStarted(in nsIUpdateItem addon);
|
||||
|
||||
|
@ -631,6 +650,8 @@ interface nsIAddonUpdateCheckListener : nsISupports
|
|||
* A nsIUpdateItem object representing the addon being updated
|
||||
* @param status
|
||||
* The success or failure code of the update operation
|
||||
*
|
||||
* @throws NS_ERROR_ILLEGAL_VALUE if the addon is invalid.
|
||||
*/
|
||||
void onAddonUpdateEnded(in nsIUpdateItem addon, in long status);
|
||||
};
|
||||
|
@ -646,8 +667,8 @@ interface nsIAddonUpdateCheckListener : nsISupports
|
|||
*/
|
||||
#define NS_INSTALL_LOCATION_APPPROFILE NS_LITERAL_STRING("app-profile")
|
||||
|
||||
/**
|
||||
* The category that contains a list of contract-ids to Install Location
|
||||
/**
|
||||
* The category that contains a list of contract-ids to Install Location
|
||||
* services.
|
||||
*/
|
||||
#define CATEGORY_INSTALL_LOCATIONS "extension-install-locations"
|
||||
|
@ -666,4 +687,3 @@ interface nsIAddonUpdateCheckListener : nsISupports
|
|||
#define EM_ITEM_CANCEL "item-cancel-action"
|
||||
|
||||
%}
|
||||
|
||||
|
|
|
@ -135,11 +135,11 @@ function getFile(key, pathArray) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Opens a safe file output stream for writing.
|
||||
* Opens a safe file output stream for writing.
|
||||
* @param file
|
||||
* The file to write to.
|
||||
* @param modeFlags
|
||||
* (optional) File open flags. Can be undefined.
|
||||
* (optional) File open flags. Can be undefined.
|
||||
* @returns nsIFileOutputStream to write to.
|
||||
*/
|
||||
function openSafeFileOutputStream(file, modeFlags) {
|
||||
|
@ -147,7 +147,7 @@ function openSafeFileOutputStream(file, modeFlags) {
|
|||
createInstance(Ci.nsIFileOutputStream);
|
||||
if (modeFlags === undefined)
|
||||
modeFlags = MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE;
|
||||
if (!file.exists())
|
||||
if (!file.exists())
|
||||
file.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
|
||||
fos.init(file, modeFlags, PERMS_FILE, 0);
|
||||
return fos;
|
||||
|
@ -192,8 +192,8 @@ function Blocklist() {
|
|||
gVersionChecker = Cc["@mozilla.org/xpcom/version-comparator;1"].
|
||||
getService(Ci.nsIVersionComparator);
|
||||
gConsole = Cc["@mozilla.org/consoleservice;1"].
|
||||
getService(Ci.nsIConsoleService);
|
||||
|
||||
getService(Ci.nsIConsoleService);
|
||||
|
||||
gOS = Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
gOS.addObserver(this, "xpcom-shutdown", false);
|
||||
|
@ -295,7 +295,7 @@ Blocklist.prototype = {
|
|||
var dsURI = gPref.getCharPref(PREF_BLOCKLIST_URL);
|
||||
}
|
||||
catch (e) {
|
||||
LOG("Blocklist::notify: The " + PREF_BLOCKLIST_URL + " preference" +
|
||||
LOG("Blocklist::notify: The " + PREF_BLOCKLIST_URL + " preference" +
|
||||
" is missing!");
|
||||
return;
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ Blocklist.prototype = {
|
|||
var uri = newURI(dsURI);
|
||||
}
|
||||
catch (e) {
|
||||
LOG("Blocklist::notify: There was an error creating the blocklist URI\r\n" +
|
||||
LOG("Blocklist::notify: There was an error creating the blocklist URI\r\n" +
|
||||
"for: " + dsURI + ", error: " + e);
|
||||
return;
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ Blocklist.prototype = {
|
|||
# <versionRange minVersion="1.7" maxVersion="1.7.*"/>
|
||||
# </targetApplication>
|
||||
# <targetApplication id="toolkit@mozilla.org">
|
||||
# <versionRange minVersion="1.8" maxVersion="1.8.*"/>
|
||||
# <versionRange minVersion="1.9" maxVersion="1.9.*"/>
|
||||
# </targetApplication>
|
||||
# </versionRange>
|
||||
# <versionRange minVersion="3.0" maxVersion="3.0.*">
|
||||
|
@ -392,7 +392,7 @@ Blocklist.prototype = {
|
|||
# <versionRange minVersion="1.5" maxVersion="1.5.*"/>
|
||||
# </targetApplication>
|
||||
# <targetApplication id="toolkit@mozilla.org">
|
||||
# <versionRange minVersion="1.8" maxVersion="1.8.*"/>
|
||||
# <versionRange minVersion="1.9" maxVersion="1.9.*"/>
|
||||
# </targetApplication>
|
||||
# </versionRange>
|
||||
# </emItem>
|
||||
|
@ -421,7 +421,7 @@ Blocklist.prototype = {
|
|||
# <match name="description" exp="1[.]2[.]3"/>
|
||||
# </pluginItem>
|
||||
# </pluginItems>
|
||||
# </blocklist>
|
||||
# </blocklist>
|
||||
*/
|
||||
|
||||
_loadBlocklistFromFile: function(file) {
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug299716-2@tests.mozilla.org</em:id>
|
||||
<em:version>0.1</em:version>
|
||||
|
||||
<!-- XPCShell -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>1</em:minVersion>
|
||||
<em:maxVersion>1</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Toolkit -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>1.9</em:minVersion>
|
||||
<em:maxVersion>1.9</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<em:name>Bug 299716</em:name>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug299716_2.rdf</em:updateURL>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug299716-a@tests.mozilla.org</em:id>
|
||||
<em:version>0.1</em:version>
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>5</em:minVersion>
|
||||
<em:maxVersion>5</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<em:name>Bug 299716 test A</em:name>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug299716.rdf</em:updateURL>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug299716-a@tests.mozilla.org</em:id>
|
||||
<em:version>0.2</em:version>
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>5</em:minVersion>
|
||||
<em:maxVersion>5</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<em:name>Bug 299716 test A</em:name>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug299716.rdf</em:updateURL>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug299716-b@tests.mozilla.org</em:id>
|
||||
<em:version>0.1</em:version>
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>1.9</em:minVersion>
|
||||
<em:maxVersion>1.9</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<em:name>Bug 299716 test B</em:name>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug299716.rdf</em:updateURL>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug299716-b@tests.mozilla.org</em:id>
|
||||
<em:version>0.2</em:version>
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>1.9</em:minVersion>
|
||||
<em:maxVersion>1.9</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<em:name>Bug 299716 test B</em:name>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug299716.rdf</em:updateURL>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug299716-c@tests.mozilla.org</em:id>
|
||||
<em:version>0.1</em:version>
|
||||
|
||||
<!-- XPCShell -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>5</em:minVersion>
|
||||
<em:maxVersion>5</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Toolkit -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>1.9</em:minVersion>
|
||||
<em:maxVersion>1.9</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<em:name>Bug 299716 test C</em:name>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug299716.rdf</em:updateURL>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug299716-c@tests.mozilla.org</em:id>
|
||||
<em:version>0.2</em:version>
|
||||
|
||||
<!-- XPCShell -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>5</em:minVersion>
|
||||
<em:maxVersion>5</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Toolkit -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>1.9</em:minVersion>
|
||||
<em:maxVersion>1.9</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<em:name>Bug 299716 test C</em:name>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug299716.rdf</em:updateURL>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug299716-d@tests.mozilla.org</em:id>
|
||||
<em:version>0.1</em:version>
|
||||
|
||||
<!-- XPCShell -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>5</em:minVersion>
|
||||
<em:maxVersion>5</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Toolkit, invalid -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>30</em:minVersion>
|
||||
<em:maxVersion>30</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<em:name>Bug 299716 test D</em:name>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug299716.rdf</em:updateURL>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug299716-d@tests.mozilla.org</em:id>
|
||||
<em:version>0.2</em:version>
|
||||
|
||||
<!-- XPCShell -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>5</em:minVersion>
|
||||
<em:maxVersion>5</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Toolkit, invalid -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>30</em:minVersion>
|
||||
<em:maxVersion>30</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<em:name>Bug 299716 test D</em:name>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug299716.rdf</em:updateURL>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug299716-e@tests.mozilla.org</em:id>
|
||||
<em:version>0.1</em:version>
|
||||
|
||||
<!-- Toolkit -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>1.9</em:minVersion>
|
||||
<em:maxVersion>1.9</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- XPCShell, invalid -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>30</em:minVersion>
|
||||
<em:maxVersion>30</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<em:name>Bug 299716 test E</em:name>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug299716.rdf</em:updateURL>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug299716-e@tests.mozilla.org</em:id>
|
||||
<em:version>0.2</em:version>
|
||||
|
||||
<!-- Toolkit -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>1.9</em:minVersion>
|
||||
<em:maxVersion>1.9</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- XPCShell, invalid -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>30</em:minVersion>
|
||||
<em:maxVersion>30</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<em:name>Bug 299716 test E</em:name>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug299716.rdf</em:updateURL>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug299716-f@tests.mozilla.org</em:id>
|
||||
<em:version>0.1</em:version>
|
||||
|
||||
<!-- Toolkit, invalid -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>30</em:minVersion>
|
||||
<em:maxVersion>30</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- XPCShell, invalid -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>30</em:minVersion>
|
||||
<em:maxVersion>30</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<em:name>Bug 299716 test F</em:name>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug299716.rdf</em:updateURL>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug299716-f@tests.mozilla.org</em:id>
|
||||
<em:version>0.2</em:version>
|
||||
|
||||
<!-- Toolkit, invalid -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>30</em:minVersion>
|
||||
<em:maxVersion>30</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- XPCShell, invalid -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>30</em:minVersion>
|
||||
<em:maxVersion>30</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<em:name>Bug 299716 test F</em:name>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug299716.rdf</em:updateURL>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug299716-g@tests.mozilla.org</em:id>
|
||||
<em:version>0.1</em:version>
|
||||
|
||||
<!-- Toolkit, invalid -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>30</em:minVersion>
|
||||
<em:maxVersion>30</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<em:name>Bug 299716 test G</em:name>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug299716.rdf</em:updateURL>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>bug299716-g@tests.mozilla.org</em:id>
|
||||
<em:version>0.2</em:version>
|
||||
|
||||
<!-- Toolkit, invalid -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>30</em:minVersion>
|
||||
<em:maxVersion>30</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<em:name>Bug 299716 test G</em:name>
|
||||
<em:updateURL>http://localhost:4444/data/test_bug299716.rdf</em:updateURL>
|
||||
</Description>
|
||||
</RDF>
|
|
@ -0,0 +1,181 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE RDF:RDF [
|
||||
<!ENTITY bug299716 "urn:mozilla:extension:bug299716">
|
||||
<!ENTITY addons_prefix "http://localhost:4444/addons/test_bug299716">
|
||||
<!ENTITY v0.2 "<em:version>0.2</em:version>">
|
||||
|
||||
<!ENTITY xpcshell.app "
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>5</em:minVersion>
|
||||
<em:maxVersion>5</em:maxVersion>
|
||||
">
|
||||
|
||||
<!ENTITY toolkit.app "
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>1.9</em:minVersion>
|
||||
<em:maxVersion>1.9</em:maxVersion>
|
||||
">
|
||||
|
||||
<!ENTITY invalidRange "
|
||||
<em:minVersion>30</em:minVersion>
|
||||
<em:maxVersion>30</em:maxVersion>
|
||||
">
|
||||
|
||||
<!ENTITY xpcshell.invalid "
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
&invalidRange;
|
||||
">
|
||||
|
||||
<!ENTITY toolkit.invalid "
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
&invalidRange;
|
||||
">
|
||||
]>
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<!-- XPCShell -->
|
||||
<RDF:Description about="&bug299716;-a@tests.mozilla.org">
|
||||
<em:updates>
|
||||
<RDF:Seq>
|
||||
<RDF:li RDF:resource="&bug299716;-a@tests.mozilla.org:0.2"/>
|
||||
</RDF:Seq>
|
||||
</em:updates>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description about="&bug299716;-a@tests.mozilla.org:0.2">
|
||||
&v0.2;
|
||||
<em:targetApplication>
|
||||
<RDF:Description em:updateLink="&addons_prefix;_a_2.xpi">
|
||||
&xpcshell.app;
|
||||
</RDF:Description>
|
||||
</em:targetApplication>
|
||||
</RDF:Description>
|
||||
|
||||
<!-- Toolkit -->
|
||||
<RDF:Description about="&bug299716;-b@tests.mozilla.org">
|
||||
<em:updates>
|
||||
<RDF:Seq>
|
||||
<RDF:li RDF:resource="&bug299716;-b@tests.mozilla.org:0.2"/>
|
||||
</RDF:Seq>
|
||||
</em:updates>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description about="&bug299716;-b@tests.mozilla.org:0.2">
|
||||
&v0.2;
|
||||
<em:targetApplication>
|
||||
<RDF:Description em:updateLink="&addons_prefix;_b_2.xpi">
|
||||
&toolkit.app;
|
||||
</RDF:Description>
|
||||
</em:targetApplication>
|
||||
</RDF:Description>
|
||||
|
||||
<!-- XPCShell + Toolkit -->
|
||||
<RDF:Description about="&bug299716;-c@tests.mozilla.org">
|
||||
<em:updates>
|
||||
<RDF:Seq>
|
||||
<RDF:li RDF:resource="&bug299716;-c@tests.mozilla.org:0.2"/>
|
||||
</RDF:Seq>
|
||||
</em:updates>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description about="&bug299716;-c@tests.mozilla.org:0.2">
|
||||
&v0.2;
|
||||
<em:targetApplication>
|
||||
<RDF:Description em:updateLink="&addons_prefix;_c_2.xpi">
|
||||
&xpcshell.app;
|
||||
</RDF:Description>
|
||||
</em:targetApplication>
|
||||
<em:targetApplication>
|
||||
<RDF:Description em:updateLink="&addons_prefix;_c_2.xpi">
|
||||
&toolkit.app;
|
||||
</RDF:Description>
|
||||
</em:targetApplication>
|
||||
</RDF:Description>
|
||||
|
||||
<!-- XPCShell (Toolkit invalid) -->
|
||||
<RDF:Description about="&bug299716;-d@tests.mozilla.org">
|
||||
<em:updates>
|
||||
<RDF:Seq>
|
||||
<RDF:li RDF:resource="&bug299716;-d@tests.mozilla.org:0.2"/>
|
||||
</RDF:Seq>
|
||||
</em:updates>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description about="&bug299716;-d@tests.mozilla.org:0.2">
|
||||
&v0.2;
|
||||
<em:targetApplication>
|
||||
<RDF:Description em:updateLink="&addons_prefix;_d_2.xpi">
|
||||
&xpcshell.app;
|
||||
</RDF:Description>
|
||||
</em:targetApplication>
|
||||
<em:targetApplication>
|
||||
<RDF:Description em:updateLink="&addons_prefix;_d_2.xpi">
|
||||
&toolkit.invalid;
|
||||
</RDF:Description>
|
||||
</em:targetApplication>
|
||||
</RDF:Description>
|
||||
|
||||
<!-- Toolkit (XPCShell invalid), should not install -->
|
||||
<RDF:Description about="&bug299716;-e@tests.mozilla.org">
|
||||
<em:updates>
|
||||
<RDF:Seq>
|
||||
<RDF:li RDF:resource="&bug299716;-e@tests.mozilla.org:0.2"/>
|
||||
</RDF:Seq>
|
||||
</em:updates>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description about="&bug299716;-e@tests.mozilla.org:0.2">
|
||||
&v0.2;
|
||||
<em:targetApplication>
|
||||
<RDF:Description em:updateLink="&addons_prefix;_e_2.xpi">
|
||||
&xpcshell.invalid;
|
||||
</RDF:Description>
|
||||
</em:targetApplication>
|
||||
<em:targetApplication>
|
||||
<RDF:Description em:updateLink="&addons_prefix;_e_2.xpi">
|
||||
&toolkit.app;
|
||||
</RDF:Description>
|
||||
</em:targetApplication>
|
||||
</RDF:Description>
|
||||
|
||||
<!-- None (XPCShell, Toolkit invalid), should not install -->
|
||||
<RDF:Description about="&bug299716;-f@tests.mozilla.org">
|
||||
<em:updates>
|
||||
<RDF:Seq>
|
||||
<RDF:li RDF:resource="&bug299716;-f@tests.mozilla.org:0.2"/>
|
||||
</RDF:Seq>
|
||||
</em:updates>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description about="&bug299716;-f@tests.mozilla.org:0.2">
|
||||
&v0.2;
|
||||
<em:targetApplication>
|
||||
<RDF:Description em:updateLink="&addons_prefix;_f_2.xpi">
|
||||
&xpcshell.invalid;
|
||||
</RDF:Description>
|
||||
</em:targetApplication>
|
||||
<em:targetApplication>
|
||||
<RDF:Description em:updateLink="&addons_prefix;_f_2.xpi">
|
||||
&toolkit.invalid;
|
||||
</RDF:Description>
|
||||
</em:targetApplication>
|
||||
</RDF:Description>
|
||||
|
||||
<!-- Toolkit (invalid), should not install -->
|
||||
<RDF:Description about="&bug299716;-g@tests.mozilla.org">
|
||||
<em:updates>
|
||||
<RDF:Seq>
|
||||
<RDF:li RDF:resource="&bug299716;-g@tests.mozilla.org:0.2"/>
|
||||
</RDF:Seq>
|
||||
</em:updates>
|
||||
</RDF:Description>
|
||||
|
||||
<RDF:Description about="&bug299716;-g@tests.mozilla.org:0.2">
|
||||
&v0.2;
|
||||
<em:targetApplication>
|
||||
<RDF:Description em:updateLink="&addons_prefix;_g_2.xpi">
|
||||
&toolkit.invalid;
|
||||
</RDF:Description>
|
||||
</em:targetApplication>
|
||||
</RDF:Description>
|
||||
</RDF:RDF>
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
<RDF:Description about="urn:mozilla:extension:bug299716-2@tests.mozilla.org">
|
||||
<em:updates>
|
||||
<RDF:Seq>
|
||||
<RDF:li>
|
||||
<RDF:Description>
|
||||
<em:version>0.1</em:version>
|
||||
<em:targetApplication>
|
||||
<RDF:Description>
|
||||
<em:id>toolkit@mozilla.org</em:id>
|
||||
<em:minVersion>1.9</em:minVersion>
|
||||
<em:maxVersion>2.0.*</em:maxVersion>
|
||||
</RDF:Description>
|
||||
</em:targetApplication>
|
||||
</RDF:Description>
|
||||
</RDF:li>
|
||||
</RDF:Seq>
|
||||
</em:updates>
|
||||
</RDF:Description>
|
||||
</RDF:RDF>
|
|
@ -0,0 +1,449 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Alexander J. Vincent <ajvincent@gmail.com>.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/* XXX ajvincent XPCOM_DEBUG_BREAK automatically causes a xpcshell test to crash
|
||||
if a NS_ASSERTION fires. However, the assertions this testcase triggers are
|
||||
unrelated to the actual test, and the component this test runs against is
|
||||
JavaScript-based - so assertions here do not apply against the tested
|
||||
component. I am (reluctantly) turning the assertions into stack warnings in
|
||||
order to prevent test failures at this point which are not the fault of the
|
||||
code being tested or the test script.
|
||||
|
||||
At present, the assertions fired are for calls which aren't thread-safe.
|
||||
*/
|
||||
var env = Components.classes["@mozilla.org/process/environment;1"]
|
||||
.getService(Components.interfaces.nsIEnvironment);
|
||||
env.set("XPCOM_DEBUG_BREAK", "stack");
|
||||
|
||||
// This allows the EM to attempt to display errors to the user without failing.
|
||||
var promptService = {
|
||||
// nsIPromptService
|
||||
alert: function alert(aParent,
|
||||
aDialogTitle,
|
||||
aText) {
|
||||
const title = "Bug 299716 test ";
|
||||
var keyChar = aText.charAt(title.length).toLowerCase();
|
||||
var id = "bug299716-" + keyChar + "@tests.mozilla.org";
|
||||
for (var i = 0; i < ADDONS.length; i++) {
|
||||
if (ADDONS[i].id != id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
do_check_false(ADDONS[i].installed);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
// nsIPromptService
|
||||
alertCheck: function alertCheck(aParent,
|
||||
aDialogTitle,
|
||||
aText,
|
||||
aCheckMsg,
|
||||
aCheckState) {
|
||||
do_throw("Unexpected call to alertCheck!");
|
||||
},
|
||||
|
||||
// nsIPromptService
|
||||
confirm: function confirm(aParent,
|
||||
aDialogTitle,
|
||||
aText) {
|
||||
do_throw("Unexpected call to confirm!");
|
||||
},
|
||||
|
||||
// nsIPromptService
|
||||
confirmCheck: function confirmCheck(aParent,
|
||||
aDialogTitle,
|
||||
aText,
|
||||
aCheckMsg,
|
||||
aCheckState) {
|
||||
do_throw("Unexpected call to confirmCheck!");
|
||||
},
|
||||
|
||||
// nsIPromptService
|
||||
confirmEx: function confirmEx(aParent,
|
||||
aDialogTitle,
|
||||
aText,
|
||||
aButtonFlags,
|
||||
aButton0Title,
|
||||
aButton1Title,
|
||||
aButton2Title,
|
||||
aCheckMsg,
|
||||
aCheckState) {
|
||||
do_throw("Unexpected call to confirmEx!");
|
||||
},
|
||||
|
||||
// nsIPromptService
|
||||
prompt: function prompt(aParent,
|
||||
aDialogTitle,
|
||||
aText,
|
||||
aValue,
|
||||
aCheckMsg,
|
||||
aCheckState) {
|
||||
do_throw("Unexpected call to prompt!");
|
||||
},
|
||||
|
||||
// nsIPromptService
|
||||
promptUsernameAndPassword:
|
||||
function promptUsernameAndPassword(aParent,
|
||||
aDialogTitle,
|
||||
aText,
|
||||
aUsername,
|
||||
aPassword,
|
||||
aCheckMsg,
|
||||
aCheckState) {
|
||||
do_throw("Unexpected call to promptUsernameAndPassword!");
|
||||
},
|
||||
|
||||
// nsIPromptService
|
||||
promptPassword: function promptPassword(aParent,
|
||||
aDialogTitle,
|
||||
aText,
|
||||
aPassword,
|
||||
aCheckMsg,
|
||||
aCheckState) {
|
||||
do_throw("Unexpected call to promptPassword!");
|
||||
},
|
||||
|
||||
// nsIPromptService
|
||||
select: function select(aParent,
|
||||
aDialogTitle,
|
||||
aText,
|
||||
aCount,
|
||||
aSelectList,
|
||||
aOutSelection) {
|
||||
do_throw("Unexpected call to select!");
|
||||
},
|
||||
|
||||
// nsISupports
|
||||
QueryInterface: function QueryInterface(iid) {
|
||||
if (iid.equals(Components.interfaces.nsIPromptService)
|
||||
|| iid.equals(Components.interfaces.nsISupports))
|
||||
return this;
|
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
};
|
||||
|
||||
var PromptServiceFactory = {
|
||||
createInstance: function createInstance(outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
return promptService.QueryInterface(iid);
|
||||
}
|
||||
};
|
||||
const nsIComponentRegistrar = Components.interfaces.nsIComponentRegistrar;
|
||||
var registrar = Components.manager.QueryInterface(nsIComponentRegistrar);
|
||||
const psID = Components.ID("{6cc9c9fe-bc0b-432b-a410-253ef8bcc699}");
|
||||
registrar.registerFactory(psID,
|
||||
"PromptService",
|
||||
"@mozilla.org/embedcomp/prompt-service;1",
|
||||
PromptServiceFactory);
|
||||
|
||||
const updateListener = {
|
||||
_state: -1,
|
||||
|
||||
// nsIAddonUpdateListener
|
||||
onStateChange: function onStateChange(aAddon, aState, aValue) {
|
||||
if ((this._state == -1) &&
|
||||
(aState == Components.interfaces.nsIXPIProgressDialog.DIALOG_CLOSE)) {
|
||||
this._state = aState;
|
||||
next_test();
|
||||
}
|
||||
},
|
||||
|
||||
onProgress: function onProgress(aAddon, aValue, aMaxValue) {
|
||||
// do nothing.
|
||||
}
|
||||
};
|
||||
|
||||
// Update check listener.
|
||||
const checkListener = {
|
||||
// nsIAddonUpdateCheckListener
|
||||
onUpdateStarted: function onUpdateStarted() {
|
||||
// do nothing
|
||||
},
|
||||
|
||||
// nsIAddonUpdateCheckListener
|
||||
onUpdateEnded: function onUpdateEnded() {
|
||||
next_test();
|
||||
},
|
||||
|
||||
// nsIAddonUpdateCheckListener
|
||||
onAddonUpdateStarted: function onAddonUpdateStarted(aAddon) {
|
||||
// do nothing
|
||||
},
|
||||
|
||||
// nsIAddonUpdateCheckListener
|
||||
onAddonUpdateEnded: function onAddonUpdateEnded(aAddon, aStatus) {
|
||||
for (var i = 0; i < ADDONS.length; i++) {
|
||||
if (ADDONS[i].id == aAddon.id) {
|
||||
ADDONS[i].newItem = aAddon;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the HTTP server.
|
||||
do_import_script("netwerk/test/httpserver/httpd.js");
|
||||
var testserver;
|
||||
var updateItems = [];
|
||||
|
||||
// Configure test.
|
||||
const DELAY = 2000;
|
||||
|
||||
var ADDONS = [
|
||||
// XPCShell
|
||||
{
|
||||
id: "bug299716-a@tests.mozilla.org",
|
||||
addon: "test_bug299716_a_1",
|
||||
installed: true,
|
||||
item: null,
|
||||
newItem: null
|
||||
},
|
||||
|
||||
// Toolkit
|
||||
{
|
||||
id: "bug299716-b@tests.mozilla.org",
|
||||
addon: "test_bug299716_b_1",
|
||||
installed: true,
|
||||
item: null,
|
||||
newItem: null
|
||||
},
|
||||
|
||||
// XPCShell + Toolkit
|
||||
{
|
||||
id: "bug299716-c@tests.mozilla.org",
|
||||
addon: "test_bug299716_c_1",
|
||||
installed: true,
|
||||
item: null,
|
||||
newItem: null
|
||||
},
|
||||
|
||||
// XPCShell (Toolkit invalid)
|
||||
{
|
||||
id: "bug299716-d@tests.mozilla.org",
|
||||
addon: "test_bug299716_d_1",
|
||||
installed: true,
|
||||
item: null,
|
||||
newItem: null
|
||||
},
|
||||
|
||||
// Toolkit (XPCShell invalid)
|
||||
{
|
||||
id: "bug299716-e@tests.mozilla.org",
|
||||
addon: "test_bug299716_e_1",
|
||||
installed: false,
|
||||
item: null,
|
||||
newItem: null,
|
||||
failedAppName: "XPCShell"
|
||||
},
|
||||
|
||||
// None (XPCShell, Toolkit invalid)
|
||||
{
|
||||
id: "bug299716-f@tests.mozilla.org",
|
||||
addon: "test_bug299716_f_1",
|
||||
installed: false,
|
||||
item: null,
|
||||
newItem: null,
|
||||
failedAppName: "XPCShell"
|
||||
},
|
||||
|
||||
// None (Toolkit invalid)
|
||||
{
|
||||
id: "bug299716-g@tests.mozilla.org",
|
||||
addon: "test_bug299716_g_1",
|
||||
installed: false,
|
||||
item: null,
|
||||
newItem: null,
|
||||
failedAppName: "Toolkit"
|
||||
},
|
||||
];
|
||||
|
||||
var currentAddonObj = null;
|
||||
var next_test = function() {};
|
||||
|
||||
function do_check_item(aItem, aVersion, aAddonsEntry) {
|
||||
if (aAddonsEntry.installed) {
|
||||
do_check_eq(aItem.version, aVersion);
|
||||
} else {
|
||||
do_check_eq(aItem, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the test by installing extensions.
|
||||
*/
|
||||
function run_test() {
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "5", "1.9");
|
||||
|
||||
const dataDir = do_get_file("toolkit/mozapps/extensions/test/unit/data");
|
||||
const addonsDir = do_get_addon(ADDONS[0].addon).parent;
|
||||
|
||||
// Make sure we can actually get our data files.
|
||||
const xpiFile = addonsDir.clone();
|
||||
xpiFile.append("test_bug299716_a_2.xpi");
|
||||
do_check_true(xpiFile.exists());
|
||||
|
||||
// Create and configure the HTTP server.
|
||||
testserver = new nsHttpServer();
|
||||
testserver.registerDirectory("/addons/", addonsDir);
|
||||
testserver.registerDirectory("/data/", dataDir);
|
||||
testserver.start(4444);
|
||||
|
||||
// Make sure we can fetch the files over HTTP.
|
||||
const Ci = Components.interfaces;
|
||||
const xhr = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
|
||||
.createInstance(Ci.nsIXMLHttpRequest)
|
||||
xhr.open("GET", "http://localhost:4444/addons/test_bug299716_a_2.xpi", false);
|
||||
xhr.send(null);
|
||||
do_check_true(xhr.status == 200);
|
||||
|
||||
xhr.open("GET", "http://localhost:4444/data/test_bug299716.rdf", false);
|
||||
xhr.send(null);
|
||||
do_check_true(xhr.status == 200);
|
||||
|
||||
// Start the real test.
|
||||
startupEM();
|
||||
dump("\n\n*** INSTALLING NEW ITEMS\n\n");
|
||||
|
||||
gEM.addUpdateListener(updateListener);
|
||||
|
||||
for (var i = 0; i < ADDONS.length; i++) {
|
||||
gEM.installItemFromFile(do_get_addon(ADDONS[i].addon),
|
||||
NS_INSTALL_LOCATION_APPPROFILE);
|
||||
}
|
||||
do_test_pending();
|
||||
|
||||
// Give time for phone home to complete.
|
||||
do_timeout(DELAY, "run_test_pt2()");
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the versions of all items, and ask the extension manager to find updates.
|
||||
*/
|
||||
function run_test_pt2() {
|
||||
dump("\n\n*** RESTARTING EXTENSION MANAGER\n\n");
|
||||
restartEM();
|
||||
|
||||
// Try to update the items.
|
||||
for (var i = 0; i < ADDONS.length; i++) {
|
||||
var item = gEM.getItemForID(ADDONS[i].id);
|
||||
do_check_item(item, "0.1", ADDONS[i]);
|
||||
ADDONS[i].item = item;
|
||||
updateItems[updateItems.length] = item;
|
||||
}
|
||||
|
||||
dump("\n\n*** REQUESTING UPDATE\n\n");
|
||||
// updateListener will call run_test_pt3().
|
||||
next_test = run_test_pt3;
|
||||
try {
|
||||
gEM.update(updateItems,
|
||||
updateItems.length,
|
||||
Components.interfaces.nsIExtensionManager.UPDATE_CHECK_NEWVERSION,
|
||||
checkListener);
|
||||
do_throw("Shouldn't reach here!");
|
||||
} catch (e if (e instanceof Components.interfaces.nsIException &&
|
||||
e.result == Components.results.NS_ERROR_ILLEGAL_VALUE)) {
|
||||
// do nothing, this is good
|
||||
}
|
||||
|
||||
var addonsArray = [];
|
||||
for (var i = 0; i < ADDONS.length; i++) {
|
||||
if (ADDONS[i].item) {
|
||||
addonsArray.push(ADDONS[i].item);
|
||||
}
|
||||
}
|
||||
gEM.update(addonsArray,
|
||||
addonsArray.length,
|
||||
Components.interfaces.nsIExtensionManager.UPDATE_CHECK_NEWVERSION,
|
||||
checkListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install new items for each enabled extension.
|
||||
*/
|
||||
function run_test_pt3() {
|
||||
// Install the new items.
|
||||
var addonsArray = [];
|
||||
for (var i = 0; i < ADDONS.length; i++) {
|
||||
addonsArray.push(ADDONS[i].newItem);
|
||||
}
|
||||
dump("\n\n*** UPDATING " + addonsArray.length + " ITEMS\n\n");
|
||||
|
||||
// updateListener will call run_test_pt4().
|
||||
next_test = run_test_pt4;
|
||||
|
||||
// Here, we have some bad items that try to update. Pepto-Bismol time.
|
||||
try {
|
||||
gEM.addDownloads(addonsArray, addonsArray.length, true);
|
||||
do_throw("Shouldn't reach here!");
|
||||
} catch (e if (e instanceof Components.interfaces.nsIException &&
|
||||
e.result == Components.results.NS_ERROR_ILLEGAL_VALUE)) {
|
||||
// do nothing, this is good
|
||||
}
|
||||
|
||||
for (i = addonsArray.length - 1; i >= 0; i--) {
|
||||
if (!addonsArray[i]) {
|
||||
addonsArray.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
do_check_true(addonsArray.length > 0);
|
||||
gEM.addDownloads(addonsArray, addonsArray.length, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the final version of each extension.
|
||||
*/
|
||||
function run_test_pt4() {
|
||||
dump("\n\n*** RESTARTING EXTENSION MANAGER\n\n");
|
||||
restartEM();
|
||||
|
||||
dump("\n\n*** FINAL CHECKS\n\n");
|
||||
for (var i = 0; i < ADDONS.length; i++) {
|
||||
var item = gEM.getItemForID(ADDONS[i].id);
|
||||
do_check_item(item, "0.2", ADDONS[i]);
|
||||
}
|
||||
do_test_finished();
|
||||
|
||||
testserver.stop();
|
||||
|
||||
// If we've gotten this far, then the test has passed.
|
||||
env.set("XPCOM_DEBUG_BREAK", "abort");
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Dave Townsend <dtownsend@mozilla.com>.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
// Update check listener.
|
||||
const checkListener = {
|
||||
// nsIAddonUpdateCheckListener
|
||||
onUpdateStarted: function onUpdateStarted() {
|
||||
},
|
||||
|
||||
// nsIAddonUpdateCheckListener
|
||||
onUpdateEnded: function onUpdateEnded() {
|
||||
var item = gEM.getItemForID(ADDON.id);
|
||||
do_check_eq(item.version, 0.1);
|
||||
do_check_eq(item.targetAppID, "xpcshell@tests.mozilla.org");
|
||||
do_check_eq(item.minAppVersion, 1);
|
||||
do_check_eq(item.maxAppVersion, 1);
|
||||
|
||||
do_test_finished();
|
||||
|
||||
testserver.stop();
|
||||
},
|
||||
|
||||
// nsIAddonUpdateCheckListener
|
||||
onAddonUpdateStarted: function onAddonUpdateStarted(aAddon) {
|
||||
},
|
||||
|
||||
// nsIAddonUpdateCheckListener
|
||||
onAddonUpdateEnded: function onAddonUpdateEnded(aAddon, aStatus) {
|
||||
}
|
||||
}
|
||||
|
||||
// Get the HTTP server.
|
||||
do_import_script("netwerk/test/httpserver/httpd.js");
|
||||
var testserver;
|
||||
|
||||
var ADDON = {
|
||||
id: "bug299716-2@tests.mozilla.org",
|
||||
addon: "test_bug299716_2"
|
||||
};
|
||||
|
||||
function run_test() {
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
||||
|
||||
const dataDir = do_get_file("toolkit/mozapps/extensions/test/unit/data");
|
||||
const addonsDir = do_get_addon(ADDON.addon).parent;
|
||||
|
||||
// Create and configure the HTTP server.
|
||||
testserver = new nsHttpServer();
|
||||
testserver.registerDirectory("/addons/", addonsDir);
|
||||
testserver.registerDirectory("/data/", dataDir);
|
||||
testserver.start(4444);
|
||||
|
||||
startupEM();
|
||||
|
||||
// Should just install.
|
||||
gEM.installItemFromFile(do_get_addon(ADDON.addon),
|
||||
NS_INSTALL_LOCATION_APPPROFILE);
|
||||
restartEM();
|
||||
|
||||
var item = gEM.getItemForID(ADDON.id);
|
||||
do_check_eq(item.version, 0.1);
|
||||
do_check_eq(item.targetAppID, "xpcshell@tests.mozilla.org");
|
||||
do_check_eq(item.minAppVersion, 1);
|
||||
do_check_eq(item.maxAppVersion, 1);
|
||||
|
||||
do_test_pending();
|
||||
|
||||
gEM.update([item], 1,
|
||||
Components.interfaces.nsIExtensionManager.UPDATE_SYNC_COMPATIBILITY,
|
||||
checkListener);
|
||||
}
|
|
@ -51,7 +51,7 @@ var observer = {
|
|||
function initTest()
|
||||
{
|
||||
// Setup extension manager
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1");
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
||||
startupEM();
|
||||
|
||||
// Register our parameter handlers
|
||||
|
@ -80,7 +80,7 @@ function run_test()
|
|||
|
||||
var item = Cc["@mozilla.org/updates/item;1"].createInstance(Ci.nsIUpdateItem);
|
||||
item.init("test@mozilla.org", "1.0", "app-profile", "0.0", "100.0", "Test extension",
|
||||
null, null, "", null, item.TYPE_EXTENSION);
|
||||
null, null, "", null, item.TYPE_EXTENSION, "xpcshell@tests.mozilla.org");
|
||||
|
||||
gExpectedURL = gTestURL.replace(/%ITEM_ID%/, item.id)
|
||||
.replace(/%CUSTOM1%/, "custom_parameter_1")
|
||||
|
@ -88,7 +88,7 @@ function run_test()
|
|||
|
||||
// Replace extension update URL
|
||||
var origURL = null;
|
||||
try {
|
||||
try {
|
||||
origURL = prefs.getCharPref("extensions.update.url");
|
||||
}
|
||||
catch (e) {}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -77,9 +77,9 @@ interface nsIUpdatePatch : nsISupports
|
|||
* this file is not corrupt.
|
||||
*/
|
||||
attribute AString hashValue;
|
||||
|
||||
|
||||
/**
|
||||
* The size of this file, in bytes.
|
||||
* The size of this file, in bytes.
|
||||
*/
|
||||
attribute unsigned long size;
|
||||
|
||||
|
@ -91,7 +91,7 @@ interface nsIUpdatePatch : nsISupports
|
|||
/**
|
||||
* true if this patch is currently selected as the patch to be downloaded and
|
||||
* installed for this update transaction, false if another patch from this
|
||||
* update has been selected.
|
||||
* update has been selected.
|
||||
*/
|
||||
attribute boolean selected;
|
||||
|
||||
|
@ -108,13 +108,13 @@ interface nsIUpdatePatch : nsISupports
|
|||
* An interface that describes an object representing an available update to
|
||||
* the current application - this update may have several available patches
|
||||
* from which one must be selected to download and install, for example we
|
||||
* might select a binary difference patch first and attempt to apply that,
|
||||
* might select a binary difference patch first and attempt to apply that,
|
||||
* then if the application process fails fall back to downloading a complete
|
||||
* file-replace patch. This object also contains information about the update
|
||||
* that the front end and other application services can use to learn more
|
||||
* that the front end and other application services can use to learn more
|
||||
* about what is going on.
|
||||
*/
|
||||
[scriptable, uuid(8e5822a6-c5d4-4537-be0a-9c95ba13ea2f)]
|
||||
[scriptable, uuid(9d6a388b-2e0c-4d0e-9a60-5c9739a7ada5)]
|
||||
interface nsIUpdate : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -130,13 +130,18 @@ interface nsIUpdate : nsISupports
|
|||
attribute AString name;
|
||||
|
||||
/**
|
||||
* The Application version of this update.
|
||||
* The Application version of this update.
|
||||
*/
|
||||
attribute AString version;
|
||||
|
||||
/**
|
||||
* The Addon version of this update. Used by the Extension System to track
|
||||
* compatibility of installed addons with this update.
|
||||
* The Toolkit version of this update.
|
||||
*/
|
||||
attribute AString platformVersion;
|
||||
|
||||
/**
|
||||
* The Addon version of this update. Used by the Extension System to track
|
||||
* compatibility of installed addons with this update.
|
||||
*/
|
||||
attribute AString extensionVersion;
|
||||
|
||||
|
@ -144,12 +149,12 @@ interface nsIUpdate : nsISupports
|
|||
* The Build ID of this update. Used to determine a particular build, down
|
||||
* to the hour, minute and second of its creation. This allows the system
|
||||
* to differentiate between several nightly builds with the same |version|
|
||||
* for example.
|
||||
* for example.
|
||||
*/
|
||||
attribute AString buildID;
|
||||
|
||||
/**
|
||||
* The URL to a page which offers details about the content of this
|
||||
* The URL to a page which offers details about the content of this
|
||||
* update. Ideally, this page is not the release notes but some other page
|
||||
* that summarizes the differences between this update and the previous,
|
||||
* which also links to the release notes.
|
||||
|
@ -159,7 +164,7 @@ interface nsIUpdate : nsISupports
|
|||
/**
|
||||
* The URL to a HTML fragment that contains a license for this update. If
|
||||
* this is specified, the user is shown the license file after they choose
|
||||
* to install the update and they must agree to it before the download
|
||||
* to install the update and they must agree to it before the download
|
||||
* commences.
|
||||
*/
|
||||
attribute AString licenseURL;
|
||||
|
@ -182,9 +187,9 @@ interface nsIUpdate : nsISupports
|
|||
attribute boolean isCompleteUpdate;
|
||||
|
||||
/**
|
||||
* Whether or not the update is a security update or not. If this is true,
|
||||
* then we present more serious sounding user interface messages to the
|
||||
* user.
|
||||
* Whether or not the update is a security update or not. If this is true,
|
||||
* then we present more serious sounding user interface messages to the
|
||||
* user.
|
||||
*/
|
||||
attribute boolean isSecurityUpdate;
|
||||
|
||||
|
@ -229,7 +234,7 @@ interface nsIUpdate : nsISupports
|
|||
readonly attribute unsigned long patchCount;
|
||||
|
||||
/**
|
||||
* Retrieves a patch.
|
||||
* Retrieves a patch.
|
||||
* @param index
|
||||
* The index of the patch to retrieve.
|
||||
* @returns The nsIUpdatePatch at the specified index.
|
||||
|
@ -248,7 +253,7 @@ interface nsIUpdate : nsISupports
|
|||
/**
|
||||
* An interface describing an object that listens to the progress of an update
|
||||
* check operation. This object is notified as the check continues, finishes
|
||||
* and if it has an error.
|
||||
* and if it has an error.
|
||||
*/
|
||||
[scriptable, uuid(8cbceb6e-8e27-46f2-8808-444c6499f836)]
|
||||
interface nsIUpdateCheckListener : nsISupports
|
||||
|
@ -263,12 +268,12 @@ interface nsIUpdateCheckListener : nsISupports
|
|||
* @param totalSize
|
||||
* The total number of bytes that have to be downloaded
|
||||
*/
|
||||
void onProgress(in nsIXMLHttpRequest request,
|
||||
void onProgress(in nsIXMLHttpRequest request,
|
||||
in unsigned long position,
|
||||
in unsigned long totalSize);
|
||||
|
||||
/**
|
||||
* The update check was completed.
|
||||
* The update check was completed.
|
||||
* @param request
|
||||
* The nsIXMLHttpRequest handling the update check.
|
||||
* @param updates
|
||||
|
@ -276,16 +281,16 @@ interface nsIUpdateCheckListener : nsISupports
|
|||
* @param updateCount
|
||||
* The size of the |updates| array.
|
||||
*/
|
||||
void onCheckComplete(in nsIXMLHttpRequest request,
|
||||
void onCheckComplete(in nsIXMLHttpRequest request,
|
||||
[array, size_is(updateCount)] in nsIUpdate updates,
|
||||
in unsigned long updateCount);
|
||||
|
||||
/**
|
||||
* An error occurred while loading the remote update service file.
|
||||
* An error occurred while loading the remote update service file.
|
||||
* @param request
|
||||
* The nsIXMLHttpRequest handling the update check.
|
||||
* @param update
|
||||
* A nsIUpdate object that contains details about the
|
||||
* A nsIUpdate object that contains details about the
|
||||
* error in its |statusText| property.
|
||||
*/
|
||||
void onError(in nsIXMLHttpRequest request,
|
||||
|
@ -304,7 +309,7 @@ interface nsIUpdateChecker : nsISupports
|
|||
* An object implementing nsIUpdateCheckListener which is notified
|
||||
* of the results of an update check.
|
||||
* @param force
|
||||
* Forces the checker to check for updates, regardless of the
|
||||
* Forces the checker to check for updates, regardless of the
|
||||
* current value of the user's update settings. This is used by
|
||||
* any piece of UI that offers the user the imperative option to
|
||||
* check for updates now, regardless of their update settings.
|
||||
|
@ -316,7 +321,7 @@ interface nsIUpdateChecker : nsISupports
|
|||
/**
|
||||
* Constants for the |stopChecking| function that tell the Checker how long
|
||||
* to stop checking:
|
||||
*
|
||||
*
|
||||
* CURRENT_CHECK: Stops the current (active) check only
|
||||
* CURRENT_SESSION: Stops all checking for the current session
|
||||
* ANY_CHECKS: Stops all checking, any session from now on
|
||||
|
@ -336,7 +341,7 @@ interface nsIUpdateChecker : nsISupports
|
|||
|
||||
/**
|
||||
* An interface describing a global application service that handles performing
|
||||
* background update checks and provides utilities for selecting and
|
||||
* background update checks and provides utilities for selecting and
|
||||
* downloading update patches.
|
||||
*/
|
||||
[scriptable, uuid(9849c4bf-5197-4d22-baa8-e3b44a1703d2)]
|
||||
|
@ -358,8 +363,8 @@ interface nsIApplicationUpdateService : nsISupports
|
|||
in unsigned long updateCount);
|
||||
|
||||
/**
|
||||
* Adds a listener that receives progress and state information about the
|
||||
* update that is currently being downloaded, e.g. to update a user
|
||||
* Adds a listener that receives progress and state information about the
|
||||
* update that is currently being downloaded, e.g. to update a user
|
||||
* interface.
|
||||
* @param listener
|
||||
* An object implementing nsIRequestObserver and optionally
|
||||
|
@ -370,14 +375,14 @@ interface nsIApplicationUpdateService : nsISupports
|
|||
|
||||
/**
|
||||
* Removes a listener that is receiving progress and state information
|
||||
* about the update that is currently being downloaded.
|
||||
* about the update that is currently being downloaded.
|
||||
* @param listener
|
||||
* The listener object to remove.
|
||||
*/
|
||||
void removeDownloadListener(in nsIRequestObserver listener);
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
AString downloadUpdate(in nsIUpdate update, in boolean background);
|
||||
|
||||
|
@ -393,7 +398,7 @@ interface nsIApplicationUpdateService : nsISupports
|
|||
|
||||
/**
|
||||
* Whether or not the Update Service can download and install updates.
|
||||
* This is a function of whether or not the current user has access
|
||||
* This is a function of whether or not the current user has access
|
||||
* privileges to the install directory.
|
||||
*/
|
||||
readonly attribute boolean canUpdate;
|
||||
|
@ -401,7 +406,7 @@ interface nsIApplicationUpdateService : nsISupports
|
|||
|
||||
/**
|
||||
* An interface describing a global application service that maintains a list
|
||||
* of updates previously performed as well as the current active update.
|
||||
* of updates previously performed as well as the current active update.
|
||||
*/
|
||||
[scriptable, uuid(fede66a9-9f96-4507-a22a-775ee885577e)]
|
||||
interface nsIUpdateManager : nsISupports
|
||||
|
@ -415,7 +420,7 @@ interface nsIUpdateManager : nsISupports
|
|||
nsIUpdate getUpdateAt(in long index);
|
||||
|
||||
/**
|
||||
* Gets the total number of updates in the history list.
|
||||
* Gets the total number of updates in the history list.
|
||||
*/
|
||||
readonly attribute long updateCount;
|
||||
|
||||
|
@ -425,14 +430,14 @@ interface nsIUpdateManager : nsISupports
|
|||
attribute nsIUpdate activeUpdate;
|
||||
|
||||
/**
|
||||
* Saves all updates to disk.
|
||||
* Saves all updates to disk.
|
||||
*/
|
||||
void saveUpdates();
|
||||
};
|
||||
|
||||
/**
|
||||
* An interface describing an object that can show various kinds of Update
|
||||
* notification UI to the user.
|
||||
* An interface describing an object that can show various kinds of Update
|
||||
* notification UI to the user.
|
||||
*/
|
||||
[scriptable, uuid(22b00276-ec23-4034-a764-395da539b4be)]
|
||||
interface nsIUpdatePrompt : nsISupports
|
||||
|
@ -484,15 +489,15 @@ interface nsIUpdatePrompt : nsISupports
|
|||
};
|
||||
|
||||
/**
|
||||
* An interface describing a global application service that allows long
|
||||
* An interface describing a global application service that allows long
|
||||
* duration (e.g. 1-7 or more days, weeks or months) timers to be registered
|
||||
* and then fired.
|
||||
* and then fired.
|
||||
*/
|
||||
[scriptable, uuid(0765c92c-6145-4253-9db4-594d8023087e)]
|
||||
interface nsIUpdateTimerManager : nsISupports
|
||||
{
|
||||
/**
|
||||
* Register an interval with the timer manager. The timer manager
|
||||
* Register an interval with the timer manager. The timer manager
|
||||
* periodically checks to see if the interval has expired and if it has
|
||||
* calls the specified callback. This is persistent across application
|
||||
* restarts and can handle intervals of long durations.
|
||||
|
@ -504,7 +509,7 @@ interface nsIUpdateTimerManager : nsISupports
|
|||
* @param interval
|
||||
* The length of time, in seconds, of the interval
|
||||
*/
|
||||
void registerTimer(in AString id,
|
||||
in nsITimerCallback callback,
|
||||
void registerTimer(in AString id,
|
||||
in nsITimerCallback callback,
|
||||
in unsigned long interval);
|
||||
};
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче