Bug 433371: Upgrading from Ubuntu Firefox 3.0b5 to Mozilla Firefox 3.0

breaks add-on installation.
This commit is contained in:
dtownsend%oxymoronical.com 2008-05-23 08:50:00 +00:00
Родитель 7303bb957e
Коммит 98836a231e
4 изменённых файлов: 53 добавлений и 3 удалений

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

@ -8073,7 +8073,7 @@ ExtensionsDataSource.prototype = {
if (id in this.visibleItems && this.visibleItems[id]) {
var oldLocation = InstallLocations.get(this.visibleItems[id]);
var newLocation = InstallLocations.get(locationKey);
if (forceReplace || newLocation.priority < oldLocation.priority)
if (forceReplace || !oldLocation || newLocation.priority < oldLocation.priority)
this.visibleItems[id] = locationKey;
}
else
@ -8177,6 +8177,8 @@ ExtensionsDataSource.prototype = {
_getThemeImageURL: function(item, fileName, fallbackURL) {
var id = stripPrefix(item.Value, PREFIX_ITEM_URI);
var installLocation = this._em.getInstallLocation(id);
if (!installLocation)
return fallbackURL;
var file = installLocation.getItemFile(id, fileName)
if (file.exists())
return gRDF.GetResource(getURLSpecFromFile(file));

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

@ -42,9 +42,23 @@
</RDF:Description>
</em:targetApplication>
</RDF:Description>
<RDF:Description RDF:about="urn:mozilla:item:bug356370_4@tests.mozilla.org">
<em:installLocation>invalid</em:installLocation>
<em:version>1</em:version>
<em:name>Bug 356370 test 4</em:name>
<em:type NC:parseType="Integer">4</em:type>
<em:targetApplication>
<RDF:Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>1</em:maxVersion>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
<RDF:Seq RDF:about="urn:mozilla:item:root">
<RDF:li RDF:resource="urn:mozilla:item:bug356370_1@tests.mozilla.org"/>
<RDF:li RDF:resource="urn:mozilla:item:bug356370_2@tests.mozilla.org"/>
<RDF:li RDF:resource="urn:mozilla:item:bug356370_3@tests.mozilla.org"/>
<RDF:li RDF:resource="urn:mozilla:item:bug356370_4@tests.mozilla.org"/>
</RDF:Seq>
</RDF: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>bug356370_4@tests.mozilla.org</em:id>
<em:version>1</em:version>
<em:targetApplication>
<Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>1</em:maxVersion>
</Description>
</em:targetApplication>
<em:name>Bug 356370 test 4</em:name>
<em:type NC:parseType="Integer">4</em:type>
</Description>
</RDF>

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

@ -44,10 +44,12 @@ function write_cache_line(stream, location, id, mtime) {
/**
* This copies two extensions, a default extensions datasource into the profile
* It also manufactures an extensions.cache file with invalid items.
* There are 3 test extensions:
* There are 4 test extensions:
* bug356370_1@tests.mozilla.org exists in app-profile and an unused version is in invalid-lo
* bug356370_2@tests.mozilla.org exists in invalid-hi and an unusd version is in app-profile
* bug356370_2@tests.mozilla.org exists in invalid-hi and an unused version is in app-profile
* bug356370_3@tests.mozilla.org exists in invalid
* bug356370_4@tests.mozilla.org is a theme existing in invalid and a new install
* will be detected in app-profile
*
* After startup only the first two should exist in the correct install location
* and installing extensions should be successful.
@ -85,10 +87,18 @@ function setup_profile() {
write_cache_line(foStream, "app-profile", "bug356370_2@tests.mozilla.org",
addon.lastModifiedTime);
addon = gProfD.clone();
addon.append("extensions");
addon.append("bug356370_4@tests.mozilla.org");
source = do_get_file("toolkit/mozapps/extensions/test/unit/data/test_bug356370_4.rdf");
addon.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
source.copyTo(addon, "install.rdf");
// Write out a set of invalid entries
write_cache_line(foStream, "invalid-lo", "bug356370_1@tests.mozilla.org", 0);
write_cache_line(foStream, "invalid-hi", "bug356370_2@tests.mozilla.org", 0);
write_cache_line(foStream, "invalid", "bug356370_3@tests.mozilla.org", 0);
write_cache_line(foStream, "invalid", "bug356370_4@tests.mozilla.org", 0);
foStream.close();
}
@ -105,6 +115,8 @@ function run_test() {
// This should still be disabled
do_check_eq(getManifestProperty("bug356370_2@tests.mozilla.org", "isDisabled"), "true");
do_check_eq(gEM.getItemForID("bug356370_3@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("bug356370_4@tests.mozilla.org"), null);
do_check_eq(getManifestProperty("bug356370_4@tests.mozilla.org", "installLocation"), "app-profile");
gEM.installItemFromFile(do_get_addon("test_bug257155"), NS_INSTALL_LOCATION_APPPROFILE);
do_check_neq(gEM.getItemForID("bug257155@tests.mozilla.org"), null);
@ -114,4 +126,5 @@ function run_test() {
do_check_neq(gEM.getItemForID("bug356370_1@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("bug356370_2@tests.mozilla.org"), null);
do_check_eq(gEM.getItemForID("bug356370_3@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("bug356370_4@tests.mozilla.org"), null);
}