зеркало из https://github.com/mozilla/pjs.git
Bug 576089: updateInfoURI is not exposed and needs to be passed through to the resulting Addon. r=robstrong
This commit is contained in:
Родитель
d9aae93095
Коммит
b66eecdcc2
|
@ -3770,8 +3770,8 @@ var XPIDatabase = {
|
|||
* An optional icon for the add-on
|
||||
* @param aVersion
|
||||
* An optional version for the add-on
|
||||
* @param aInfoURL
|
||||
* An optional URL of release notes for the add-on
|
||||
* @param aReleaseNotesURI
|
||||
* An optional nsIURI of release notes for the add-on
|
||||
* @param aExistingAddon
|
||||
* The add-on this install will update if known
|
||||
* @param aLoadGroup
|
||||
|
@ -3780,10 +3780,12 @@ var XPIDatabase = {
|
|||
* or the add-on does not contain an valid install manifest
|
||||
*/
|
||||
function AddonInstall(aCallback, aInstallLocation, aUrl, aHash, aName, aType,
|
||||
aIconURL, aVersion, aInfoURL, aExistingAddon, aLoadGroup) {
|
||||
aIconURL, aVersion, aReleaseNotesURI, aExistingAddon,
|
||||
aLoadGroup) {
|
||||
this.wrapper = new AddonInstallWrapper(this);
|
||||
this.installLocation = aInstallLocation;
|
||||
this.sourceURI = aUrl;
|
||||
this.releaseNotesURI = aReleaseNotesURI;
|
||||
this.hash = aHash;
|
||||
this.loadGroup = aLoadGroup;
|
||||
this.listeners = [];
|
||||
|
@ -3891,7 +3893,7 @@ AddonInstall.prototype = {
|
|||
type: null,
|
||||
version: null,
|
||||
iconURL: null,
|
||||
infoURL: null,
|
||||
releaseNotesURI: null,
|
||||
sourceURI: null,
|
||||
file: null,
|
||||
certificate: null,
|
||||
|
@ -4035,6 +4037,8 @@ AddonInstall.prototype = {
|
|||
|
||||
this.addon = loadManifestFromZipReader(zipreader);
|
||||
this.addon.sourceURI = this.sourceURI.spec;
|
||||
if (this.releaseNotesURI)
|
||||
this.addon.releaseNotesURI = this.releaseNotesURI.spec;
|
||||
this.addon._install = this;
|
||||
|
||||
this.name = this.addon.selectedLocale.name;
|
||||
|
@ -4540,12 +4544,17 @@ AddonInstall.createDownload = function(aCallback, aUri, aHash, aName, aIconURL,
|
|||
*/
|
||||
AddonInstall.createUpdate = function(aCallback, aAddon, aUpdate) {
|
||||
let url = NetUtil.newURI(aUpdate.updateURL);
|
||||
let infoURL = null;
|
||||
if (aUpdate.updateInfoURL)
|
||||
infoURL = escapeAddonURI(aAddon, aUpdate.updateInfoURL);
|
||||
let releaseNotesURI = null;
|
||||
try {
|
||||
if (aUpdate.updateInfoURL)
|
||||
releaseNotesURI = NetUtil.newURI(escapeAddonURI(aAddon, aUpdate.updateInfoURL));
|
||||
}
|
||||
catch (e) {
|
||||
// If the releaseNotesURI cannot be parsed then just ignore it.
|
||||
}
|
||||
new AddonInstall(aCallback, aAddon._installLocation, url, aUpdate.updateHash,
|
||||
aAddon.selectedLocale.name, aAddon.type,
|
||||
aAddon.iconURL, aUpdate.version, infoURL, aAddon);
|
||||
aAddon.iconURL, aUpdate.version, releaseNotesURI, aAddon);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -4555,7 +4564,7 @@ AddonInstall.createUpdate = function(aCallback, aAddon, aUpdate) {
|
|||
* The AddonInstall to create a wrapper for
|
||||
*/
|
||||
function AddonInstallWrapper(aInstall) {
|
||||
["name", "type", "version", "iconURL", "infoURL", "file", "state", "error",
|
||||
["name", "type", "version", "iconURL", "releaseNotesURI", "file", "state", "error",
|
||||
"progress", "maxProgress", "certificate", "certName"].forEach(function(aProp) {
|
||||
this.__defineGetter__(aProp, function() aInstall[aProp]);
|
||||
}, this);
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
<em:minVersion>1</em:minVersion>
|
||||
<em:maxVersion>1</em:maxVersion>
|
||||
<em:updateLink>http://localhost:4444/addons/test_update.xpi</em:updateLink>
|
||||
<em:updateInfoURL>http://example.com/updateInfo.xhtml</em:updateInfoURL>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
</Description>
|
||||
|
|
|
@ -88,6 +88,7 @@ function run_test_1() {
|
|||
do_check_neq(a1, null);
|
||||
do_check_eq(a1.version, "1.0");
|
||||
do_check_true(a1.applyBackgroundUpdates);
|
||||
do_check_eq(a1.releaseNotesURI, null);
|
||||
a1.applyBackgroundUpdates = false;
|
||||
|
||||
prepare_test({}, [
|
||||
|
@ -107,6 +108,7 @@ function run_test_1() {
|
|||
do_check_eq(install.version, "2.0");
|
||||
do_check_eq(install.state, AddonManager.STATE_AVAILABLE);
|
||||
do_check_eq(install.existingAddon, addon);
|
||||
do_check_eq(install.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
|
||||
|
||||
prepare_test({}, [
|
||||
"onDownloadStarted",
|
||||
|
@ -161,6 +163,8 @@ function check_test_2() {
|
|||
do_check_eq(a1.version, "2.0");
|
||||
do_check_true(isExtensionInAddonsList(profileDir, a1.id));
|
||||
do_check_false(a1.applyBackgroundUpdates);
|
||||
do_check_eq(a1.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
|
||||
|
||||
a1.uninstall();
|
||||
restartManager(0);
|
||||
|
||||
|
@ -343,6 +347,7 @@ function check_test_6(install) {
|
|||
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) {
|
||||
do_check_neq(a1, null);
|
||||
do_check_eq(a1.version, "2.0");
|
||||
do_check_eq(a1.releaseNotesURI.spec, "http://example.com/updateInfo.xhtml");
|
||||
a1.uninstall();
|
||||
restartManager(0);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче