Bug 595573 - Always trim .xpi from the id and test GUID extensions, r=Mossop a= blocking-beta6

This commit is contained in:
Michael Wu 2010-09-11 23:47:53 -07:00
Родитель a2aa441dbf
Коммит 3b5e14dcb5
3 изменённых файлов: 76 добавлений и 10 удалений

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

@ -5909,22 +5909,24 @@ DirectoryInstallLocation.prototype = {
if (id == DIR_STAGE)
continue;
let directLoad = false;
if (entry.isFile() &&
id.substring(id.length - 4).toLowerCase() == ".xpi") {
directLoad = true;
id = id.substring(0, id.length - 4);
}
if (!gIDTest.test(id)) {
LOG("Ignoring file entry whose name is not a valid add-on ID: " +
entry.path);
continue;
}
if (entry.isFile()) {
if (id.substring(id.length - 4).toLowerCase() == ".xpi") {
id = id.substring(0, id.length - 4);
}
else {
newEntry = this._readDirectoryFromFile(entry);
if (!newEntry)
continue;
entry = newEntry;
}
if (entry.isFile() && !directLoad) {
newEntry = this._readDirectoryFromFile(entry);
if (!newEntry)
continue;
entry = newEntry;
}
this._IDToFileMap[id] = entry;

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

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<!-- An extension that is compatible with the XPCShell test suite -->
<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>{2f69dacd-03df-4150-a9f1-e8a7b2748829}</em:id>
<em:version>1.0</em:version>
<!-- Front End MetaData -->
<em:name>Test 1</em:name>
<em:description>Test Description</em:description>
<em:targetApplication>
<Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>1</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>

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

@ -0,0 +1,40 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// This tests if addons with UUID based ids install and stay installed
const profileDir = gProfD.clone();
profileDir.append("extensions");
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
startupManager();
run_test_1();
}
function run_test_1() {
installAllFiles([do_get_addon("test_bug595573")], function() {
restartManager();
AddonManager.getAddonByID("{2f69dacd-03df-4150-a9f1-e8a7b2748829}", function(a1) {
do_check_neq(a1, null);
do_check_true(isExtensionInAddonsList(profileDir, a1.id));
run_test_2();
});
});
}
function run_test_2() {
restartManager();
AddonManager.getAddonByID("{2f69dacd-03df-4150-a9f1-e8a7b2748829}", function(a1) {
do_check_neq(a1, null);
do_check_true(isExtensionInAddonsList(profileDir, a1.id));
do_test_finished();
});
}