Bug 557269: Port old xpcshell tests to the new API. r=robstrong

--HG--
rename : toolkit/mozapps/extensions/test/unit/test_bug541420.js => toolkit/mozapps/extensions/test/xpcshell/test_bug541420.js
This commit is contained in:
Dave Townsend 2010-04-28 11:49:56 -07:00
Родитель 4ff4c00725
Коммит 2de337c47b
110 изменённых файлов: 1037 добавлений и 3966 удалений

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

@ -289,7 +289,7 @@ function parseRDFManifest(id, type, updateKey, request) {
function getRequiredProperty(ds, source, property) {
let value = getProperty(ds, source, property);
if (!value)
throw new Error("Missing required property " + property);
throw new Error("Update manifest is missing a required " + property + " property.");
return value;
}
@ -368,23 +368,35 @@ function parseRDFManifest(id, type, updateKey, request) {
let items = ctr.GetElements();
while (items.hasMoreElements()) {
let item = items.getNext().QueryInterface(Ci.nsIRDFResource);
let version = getRequiredProperty(ds, item, "version");
let version = getProperty(ds, item, "version");
if (!version) {
WARN("Update manifest is missing a required version property.");
continue;
}
LOG("Found an update entry for " + id + " version " + version);
let targetApps = ds.GetTargets(item, EM_R("targetApplication"), true);
while (targetApps.hasMoreElements()) {
let targetApp = targetApps.getNext().QueryInterface(Ci.nsIRDFResource);
let appEntry = {};
try {
appEntry.id = getRequiredProperty(ds, targetApp, "id");
appEntry.minVersion = getRequiredProperty(ds, targetApp, "minVersion");
appEntry.maxVersion = getRequiredProperty(ds, targetApp, "maxVersion");
}
catch (e) {
WARN(e);
continue;
}
let result = {
version: version,
updateURL: getProperty(ds, targetApp, "updateLink"),
updateHash: getProperty(ds, targetApp, "updateHash"),
updateInfoURL: getProperty(ds, targetApp, "updateInfoURL"),
targetApplications: [{
id: getRequiredProperty(ds, targetApp, "id"),
minVersion: getRequiredProperty(ds, targetApp, "minVersion"),
maxVersion: getRequiredProperty(ds, targetApp, "maxVersion"),
}]
targetApplications: [appEntry]
};
if (result.updateURL && checkSecurity &&

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

@ -84,6 +84,8 @@ const KEY_APP_SYSTEM_LOCAL = "app-system-local";
const KEY_APP_SYSTEM_SHARE = "app-system-share";
const KEY_APP_SYSTEM_USER = "app-system-user";
const CATEGORY_UPDATE_PARAMS = "extension-update-params";
const UNKNOWN_XPCOM_ABI = "unknownABI";
const PREFIX_ITEM_URI = "urn:mozilla:item:";
const XPI_PERMISSION = "install";
@ -361,6 +363,13 @@ function loadManifestFromRDF(uri, stream) {
if (addon.type == "theme" && !addon.internalName)
throw new Error("Themes must include an internalName property");
// Only extensions are allowed to provide an optionsURL or aboutURL. For all
// other types they are silently ignored
if (addon.type != "extension") {
addon.optionsURL = null;
addon.aboutURL = null;
}
addon.defaultLocale = readLocale(ds, root, true);
addon.locales = [];

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

@ -18,6 +18,7 @@
<!-- Front End MetaData -->
<em:name>Test theme</em:name>
<em:type>4</em:type>
<em:internalName>test/1.0</em:internalName>
<em:optionsURL>chrome://foo/content/bar.xul</em:optionsURL>
<em:aboutURL>chrome://foo/content/bar.xul</em:aboutURL>

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

@ -1,22 +0,0 @@
<?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>test_bug378216_1@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>Bug 378216 Test 1</em:name>
</Description>
</RDF>

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

@ -1,27 +0,0 @@
<?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>test_bug378216_10@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>Bug 378216 Test 10</em:name>
<em:updateURL>http://localhost:4444/test_bug378216.rdf</em:updateURL>
<em:updateKey>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDK426erD/H3XtsjvaB5+PJqbhj
Zc9EDI5OCJS8R3FIObJ9ZHJK1TXeaE7JWqt9WUmBWTEFvwS+FI9vWu8058N9CHhD
NyeP6i4LuUYjTURnn7Yw/IgzyIJ2oKsYa32RuxAyteqAWqPT/J63wBixIeCxmysf
awB/zH4KaPiY3vnrzQIDAQAB</em:updateKey>
</Description>
</RDF>

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

@ -1,27 +0,0 @@
<?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>test_bug378216_11@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>Bug 378216 Test 11</em:name>
<em:updateURL>http://localhost:4444/test_bug378216.rdf</em:updateURL>
<em:updateKey>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDK426erD/H3XtsjvaB5+PJqbhj
Zc9EDI5OCJS8R3FIObJ9ZHJK1TXeaE7JWqt9WUmBWTEFvwS+FI9vWu8058N9CHhD
NyeP6i4LuUYjTURnn7Yw/IgzyIJ2oKsYa32RuxAyteqAWqPT/J63wBixIeCxmysf
awB/zH4KaPiY3vnrzQIDAQAB</em:updateKey>
</Description>
</RDF>

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

@ -1,27 +0,0 @@
<?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>test_bug378216_12@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>Bug 378216 Test 12</em:name>
<em:updateURL>http://localhost:4444/test_bug378216.rdf</em:updateURL>
<em:updateKey>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDK426erD/H3XtsjvaB5+PJqbhj
Zc9EDI5OCJS8R3FIObJ9ZHJK1TXeaE7JWqt9WUmBWTEFvwS+FI9vWu8058N9CHhD
NyeP6i4LuUYjTURnn7Yw/IgzyIJ2oKsYa32RuxAyteqAWqPT/J63wBixIeCxmysf
awB/zH4KaPiY3vnrzQIDAQAB</em:updateKey>
</Description>
</RDF>

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

@ -1,27 +0,0 @@
<?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>test_bug378216_13@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>Bug 378216 Test 13</em:name>
<em:updateURL>http://localhost:4444/test_bug378216.rdf</em:updateURL>
<em:updateKey>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDK426erD/H3XtsjvaB5+PJqbhj
Zc9EDI5OCJS8R3FIObJ9ZHJK1TXeaE7JWqt9WUmBWTEFvwS+FI9vWu8058N9CHhD
NyeP6i4LuUYjTURnn7Yw/IgzyIJ2oKsYa32RuxAyteqAWqPT/J63wBixIeCxmysf
awB/zH4KaPiY3vnrzQIDAQAB</em:updateKey>
</Description>
</RDF>

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

@ -1,23 +0,0 @@
<?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>test_bug378216_2@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>Bug 378216 Test 2</em:name>
<em:updateURL>http://localhost:4444/test_bug378216.rdf</em:updateURL>
</Description>
</RDF>

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

@ -1,23 +0,0 @@
<?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>test_bug378216_3@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>Bug 378216 Test 3</em:name>
<em:updateURL>https://localhost:4444/test_bug378216_3/update.rdf</em:updateURL>
</Description>
</RDF>

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

@ -1,26 +0,0 @@
<?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>test_bug378216_4@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>Bug 378216 Test 4</em:name>
<em:updateKey>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDK426erD/H3XtsjvaB5+PJqbhj
Zc9EDI5OCJS8R3FIObJ9ZHJK1TXeaE7JWqt9WUmBWTEFvwS+FI9vWu8058N9CHhD
NyeP6i4LuUYjTURnn7Yw/IgzyIJ2oKsYa32RuxAyteqAWqPT/J63wBixIeCxmysf
awB/zH4KaPiY3vnrzQIDAQAB</em:updateKey>
</Description>
</RDF>

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

@ -1,27 +0,0 @@
<?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>test_bug378216_5@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>Bug 378216 Test 5</em:name>
<em:updateURL>http://localhost:4444/test_bug378216.rdf</em:updateURL>
<em:updateKey>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDK426erD/H3XtsjvaB5+PJqbhj
Zc9EDI5OCJS8R3FIObJ9ZHJK1TXeaE7JWqt9WUmBWTEFvwS+FI9vWu8058N9CHhD
NyeP6i4LuUYjTURnn7Yw/IgzyIJ2oKsYa32RuxAyteqAWqPT/J63wBixIeCxmysf
awB/zH4KaPiY3vnrzQIDAQAB</em:updateKey>
</Description>
</RDF>

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

@ -1,27 +0,0 @@
<?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>test_bug378216_6@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>Bug 378216 Test 6</em:name>
<em:updateURL>https://localhost:4444/test_bug378216_6/update.rdf</em:updateURL>
<em:updateKey>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDK426erD/H3XtsjvaB5+PJqbhj
Zc9EDI5OCJS8R3FIObJ9ZHJK1TXeaE7JWqt9WUmBWTEFvwS+FI9vWu8058N9CHhD
NyeP6i4LuUYjTURnn7Yw/IgzyIJ2oKsYa32RuxAyteqAWqPT/J63wBixIeCxmysf
awB/zH4KaPiY3vnrzQIDAQAB</em:updateKey>
</Description>
</RDF>

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

@ -1,27 +0,0 @@
<?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>test_bug378216_7@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>Bug 378216 Test 7</em:name>
<em:updateURL>http://localhost:4444/test_bug378216.rdf</em:updateURL>
<em:updateKey>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDK426erD/H3XtsjvaB5+PJqbhj
Zc9EDI5OCJS8R3FIObJ9ZHJK1TXeaE7JWqt9WUmBWTEFvwS+FI9vWu8058N9CHhD
NyeP6i4LuUYjTURnn7Yw/IgzyIJ2oKsYa32RuxAyteqAWqPT/J63wBixIeCxmysf
awB/zH4KaPiY3vnrzQIDAQAB</em:updateKey>
</Description>
</RDF>

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

@ -1,27 +0,0 @@
<?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>test_bug378216_8@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>Bug 378216 Test 8</em:name>
<em:updateURL>http://localhost:4444/test_bug378216.rdf</em:updateURL>
<em:updateKey>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDK426erD/H3XtsjvaB5+PJqbhj
Zc9EDI5OCJS8R3FIObJ9ZHJK1TXeaE7JWqt9WUmBWTEFvwS+FI9vWu8058N9CHhD
NyeP6i4LuUYjTURnn7Yw/IgzyIJ2oKsYa32RuxAyteqAWqPT/J63wBixIeCxmysf
awB/zH4KaPiY3vnrzQIDAQAB</em:updateKey>
</Description>
</RDF>

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

@ -1,27 +0,0 @@
<?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>test_bug378216_9@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>Bug 378216 Test 9</em:name>
<em:updateURL>http://localhost:4444/test_bug378216.rdf</em:updateURL>
<em:updateKey>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDK426erD/H3XtsjvaB5+PJqbhj
Zc9EDI5OCJS8R3FIObJ9ZHJK1TXeaE7JWqt9WUmBWTEFvwS+FI9vWu8058N9CHhD
NyeP6i4LuUYjTURnn7Yw/IgzyIJ2oKsYa32RuxAyteqAWqPT/J63wBixIeCxmysf
awB/zH4KaPiY3vnrzQIDAQAB</em:updateKey>
</Description>
</RDF>

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

@ -1,22 +0,0 @@
<?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>bug392180@tests.mozilla.org</em:id>
<em:version>1.0</em:version>
<em:targetApplication>
<Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>5</em:maxVersion>
</Description>
</em:targetApplication>
<em:name>Bug 392180</em:name>
<em:updateURL>http://localhost:4444/update.rdf?%UPDATE_TYPE%</em:updateURL>
</Description>
</RDF>

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

@ -1,25 +0,0 @@
<?xml version="1.0"?>
<!-- Compatible to install -->
<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>bug396129_a@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>2</em:maxVersion>
</Description>
</em:targetApplication>
<em:name>Bug 396129 Test A</em:name>
<em:updateURL>http://localhost:4444/data/test_bug396129.rdf</em:updateURL>
</Description>
</RDF>

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

@ -1,25 +0,0 @@
<?xml version="1.0"?>
<!-- Incompatible until an update check -->
<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>bug396129_a@tests.mozilla.org</em:id>
<em:version>2</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 396129 Test A</em:name>
<em:updateURL>http://localhost:4444/data/test_bug396129.rdf</em:updateURL>
</Description>
</RDF>

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

@ -1,25 +0,0 @@
<?xml version="1.0"?>
<!-- Compatible to install -->
<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>bug396129_b@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>2</em:maxVersion>
</Description>
</em:targetApplication>
<em:name>Bug 396129 Test B</em:name>
<em:updateURL>http://localhost:4444/data/test_bug396129.rdf</em:updateURL>
</Description>
</RDF>

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

@ -1,25 +0,0 @@
<?xml version="1.0"?>
<!-- Incompatible to install even after update check -->
<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>bug396129_b@tests.mozilla.org</em:id>
<em:version>2</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 396129 Test B</em:name>
<em:updateURL>http://localhost:4444/data/test_bug396129.rdf</em:updateURL>
</Description>
</RDF>

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

@ -1,25 +0,0 @@
<?xml version="1.0"?>
<!-- Compatible to install -->
<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>bug396129_c@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>2</em:maxVersion>
</Description>
</em:targetApplication>
<em:name>Bug 396129 Test C</em:name>
<em:updateURL>http://localhost:4444/data/test_bug396129.rdf</em:updateURL>
</Description>
</RDF>

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

@ -1,24 +0,0 @@
<?xml version="1.0"?>
<!-- Incompatible to install and no update rdf -->
<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>bug396129_c@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 396129 Test C</em:name>
</Description>
</RDF>

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

@ -1,25 +0,0 @@
<?xml version="1.0"?>
<!-- Compatible to install -->
<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>bug396129_d@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>2</em:maxVersion>
</Description>
</em:targetApplication>
<em:name>Bug 396129 Test D</em:name>
<em:updateURL>http://localhost:4444/data/test_bug396129.rdf</em:updateURL>
</Description>
</RDF>

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

@ -1,25 +0,0 @@
<?xml version="1.0"?>
<!-- Compatible to install -->
<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>bug396129_d@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>2</em:maxVersion>
</Description>
</em:targetApplication>
<em:name>Bug 396129 Test D</em:name>
<em:updateURL>http://localhost:4444/data/test_bug396129.rdf</em:updateURL>
</Description>
</RDF>

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

@ -1 +0,0 @@
This is an add-on with no install.rdf that should fail to install.

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

@ -1 +0,0 @@
This install.rdf is malformed.

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

@ -1,7 +0,0 @@
<?xml version="1.0"?>
<!-- This rdf is valid, but no install manifest resource -->
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
</RDF>

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

@ -1,19 +0,0 @@
<?xml version="1.0"?>
<!-- Invalid guid -->
<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>{invalid-guid}</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>Test for Bug 428341</em:name>
</Description>
</RDF>

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

@ -1,20 +0,0 @@
<?xml version="1.0"?>
<!-- Invalid platform -->
<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>bug428341_5@tests.mozilla.org</em:id>
<em:version>1</em:version>
<em:targetPlatform>Linux</em:targetPlatform>
<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>Test for Bug 428341</em:name>
</Description>
</RDF>

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

@ -1,20 +0,0 @@
<?xml version="1.0"?>
<!-- Has an insecure update url -->
<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>bug428341_6@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:updateURL>http://localhost</em:updateURL>
<em:name>Test for Bug 428341</em:name>
</Description>
</RDF>

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

@ -1,17 +0,0 @@
<?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>bug428341_7@tests.mozilla.org</em:id>
<em:version>1</em:version>
<em:targetApplication>
<Description>
<em:id>unknown@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>1</em:maxVersion>
</Description>
</em:targetApplication>
<em:name>Test for Bug 428341</em:name>
</Description>
</RDF>

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

@ -1,17 +0,0 @@
<?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>bug428341_8@tests.mozilla.org</em:id>
<em:version>1</em:version>
<em:targetApplication>
<Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>2</em:minVersion>
<em:maxVersion>2</em:maxVersion>
</Description>
</em:targetApplication>
<em:name>Test for Bug 428341</em:name>
</Description>
</RDF>

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

@ -1,17 +0,0 @@
<?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>bug428341_9@tests.mozilla.org</em:id>
<em:version>1</em:version>
<em:targetApplication>
<Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>2</em:minVersion>
<em:maxVersion>2</em:maxVersion>
</Description>
</em:targetApplication>
<em:name>Test for Bug 428341</em:name>
</Description>
</RDF>

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

@ -1 +0,0 @@
// Test add-on that attempts to use install.js to install.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

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

@ -1,197 +0,0 @@
<?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:test_bug378216_5@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>2.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>1</em:maxVersion>
<em:updateLink>http://localhost:4444/broken.xpi</em:updateLink>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:test_bug378216_7@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>2.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>2</em:maxVersion>
<em:updateLink>http://localhost:4444/broken.xpi</em:updateLink>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
<em:signature>MIGTMA0GCSqGSIb3DQEBBQUAA4GBAMO1O2gwSCCth1GwYMgscfaNakpN40PJfOWt
ub2HVdg8+OXMciF8d/9eVWm8eH/IxuxyZlmRZTs3O5tv9eWAY5uBCtqDf1WgTsGk
jrgZow1fITkZI7w0//C8eKdMLAtGueGfNs2IlTd5P/0KH/hf1rPc1wUqEqKCd4+L
BcVq13ad</em:signature>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:test_bug378216_8@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>2.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>1</em:maxVersion>
<em:updateLink>http://localhost:4444/broken.xpi</em:updateLink>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
<em:signature>MIGTMA0GCSqGSIb3DQEBBQUAA4GBAMH/33P/bn148mVkAB8i5X8c4LhY52E+MPUT
yKHGpowZnRLgL2O0dfpm+rljOBfKi51322PFrsc6VIFml6x4Lrb5foxSyB0Vs9pb
SEDFWUKquOQvceQ9iEx5Pe0VzrmUZgcQxd8ksSunWL4wJaBZ/evE5amFC6sw3pv/
fjt8p3GN</em:signature>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:test_bug378216_9@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>2.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>1</em:maxVersion>
<em:updateLink>http://localhost:4444/broken.xpi</em:updateLink>
<em:updateHash>sha1:78fc1d2887eda35b4ad2e3a0b60120ca271ce6e6</em:updateHash>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
<em:signature>MIGTMA0GCSqGSIb3DQEBBQUAA4GBAJ5Dv3Zd7/j5dLchCw9iO/cxPq8oOhOYD2M+
jUKvmHCyTBRIEaJrE4N7yVbRYk++ERIfyVepLivsVi4pBmF7JTdw0NaKUA0LiOoT
mRL8I7s5NPjCiiNcdqbncWyiZwIj1w1nkbWGTlH/gEjRW/LbvT4JAuec8yNFDa4S
X8mOMf7k</em:signature>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:test_bug378216_10@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>2.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>1</em:maxVersion>
<em:updateLink>https://localhost:4444/broken.xpi</em:updateLink>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
<em:signature>MIGTMA0GCSqGSIb3DQEBBQUAA4GBAGvf7XqqoTl5WofrNq55E7W+UttOEDXLB3Oi
XDiXe0i6njlozilseaUo1hgfQhhzN9gkyetP5tGBVcLRrVyliKpJmD6ABCVGW1lS
qS+SEw7gDHyHkvwKMyWKedpRGChqLYnnf+Y+CX3MWLZLkwPXMKdTYgN3Rx0lEnJk
37LSEMKE</em:signature>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:test_bug378216_11@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>2.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>1</em:maxVersion>
<em:updateLink>https://localhost:4444/broken.xpi</em:updateLink>
<em:updateHash>sha1:78fc1d2887eda35b4ad2e3a0b60120ca271ce6e6</em:updateHash>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
<em:signature>MIGTMA0GCSqGSIb3DQEBBQUAA4GBACMX/KReOGSJ8CMGRroH1v3Gjv/Qs/pqH+Ow
o+hCKWLUKx7hpJgVJkXXdAHW0U88NXlp1S2H0WqA7I/CdmNXJSPzzV/J4z1dZgXh
JbW6mqNb0pj6nIe7g8OLzSxDgBmO4DUP5DAmnmqciJLWQzN7OdbcwrWz6xPN5kZF
A90eF5zy</em:signature>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:test_bug378216_12@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>2.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>1</em:maxVersion>
<em:updateLink>http://localhost:4444/broken.xpi</em:updateLink>
<em:updateHash>md2:78fc1d2887eda35b4ad2e3a0b60120ca271ce6e6</em:updateHash>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
<em:signature>MIGTMA0GCSqGSIb3DQEBBQUAA4GBAJRfcFvHIWxVyycCw8IjNmEhabc2uqA1zQwp
5oKh3Y23hwIsQ6xy68Wtjte1NEYFRt5fWkbMXj9YQj6LpVbzBKiGATcrq6MycZKK
o5N22cWbrKKRweJezTyN4eLfQg21pG7r8mdfS0bIA28ZVFtQOmORejoUesEouCGy
eKYk9nS2</em:signature>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:test_bug378216_13@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>2.0</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>1</em:maxVersion>
<em:updateLink>https://localhost:4444/broken.xpi</em:updateLink>
<em:updateHash>md2:78fc1d2887eda35b4ad2e3a0b60120ca271ce6e6</em:updateHash>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
<em:signature>MIGTMA0GCSqGSIb3DQEBBQUAA4GBALQKwzLFr/VOw3gJvv/LCh3/PWDd9FqmFnX+
hJjBmCaUDtG7CXn1i0h8ed8IeRHpLLT7FCzVwU3bH9BUjdm8wc3ObtlNbd8go01a
CoXz50r3rYPcYz4WS+7/+lvrUqsuWd9Wj+q0NeCPiNaaro6/AolE2Qf5JFRL3lxY
lsKWAnVO</em:signature>
</RDF:Description>
</RDF:RDF>

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

@ -1,67 +0,0 @@
<?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:bug396129_a@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>2</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>2</em:maxVersion>
<em:updateLink>http://localhost:4444/addons/test_bug396129_a_2.xpi</em:updateLink>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:bug396129_b@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>2</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>1</em:maxVersion>
<em:updateLink>http://localhost:4444/addons/test_bug396129_b_2.xpi</em:updateLink>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:bug396129_d@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<RDF:li>
<RDF:Description>
<em:version>2</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>2</em:maxVersion>
<em:updateLink>http://localhost:4444/addons/test_bug396129_d_2.xpi</em:updateLink>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>
</RDF:RDF>

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

@ -1,20 +0,0 @@
<?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>bug424107@tests.mozilla.org</em:id>
<em:version>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 424107 test 1</em:name>
</Description>
</RDF>

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

@ -1,20 +0,0 @@
<?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>bug424107@tests.mozilla.org</em:id>
<em:version>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 424107 test 2</em:name>
</Description>
</RDF>

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

@ -1,22 +0,0 @@
<?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>bug486195@tests.mozilla.org</em:id>
<em:version>1.0</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>
<!-- Front End MetaData -->
<em:name>bug 486195 test</em:name>
</Description>
</RDF>

Двоичный файл не отображается.

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

@ -1,86 +0,0 @@
/* ***** 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@oxymoronical.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 *****
*/
const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS";
const PREF_SELECTED_LOCALE = "general.useragent.locale";
const ADDON = "test_bug257155";
const ID = "bug257155@tests.mozilla.org";
function run_test()
{
// Setup for test
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1");
gPrefs.setBoolPref(PREF_MATCH_OS_LOCALE, false);
gPrefs.setCharPref(PREF_SELECTED_LOCALE, "fr-FR");
// Install test add-on
startupEM();
gEM.installItemFromFile(do_get_addon(ADDON), NS_INSTALL_LOCATION_APPPROFILE);
var addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.name, "fr-FR Name");
restartEM();
addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.name, "fr-FR Name");
do_check_eq(getManifestProperty(ID, "description"), "fr-FR Description");
// Disable item
gEM.disableItem(ID);
restartEM();
addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.name, "fr-FR Name");
// Change locale
gPrefs.setCharPref(PREF_SELECTED_LOCALE, "de-DE");
addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.name, "de-DE Name");
do_check_eq(getManifestProperty(ID, "description"), "");
// Change to a locale not provided by the add-on
gPrefs.setCharPref(PREF_SELECTED_LOCALE, "nl-NL");
addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.name, "Fallback Name");
shutdownEM();
}

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

@ -1,458 +0,0 @@
/* ***** 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 *****
*/
// Disables security checking our updates which haven't been signed
gPrefs.setBoolPref("extensions.checkUpdateSecurity", false);
// 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 installListener = {
// nsIAddonInstallListener
onDownloadStarted: function(aAddon) {
// do nothing.
},
onDownloadEnded: function(aAddon) {
// do nothing.
},
onInstallStarted: function(aAddon) {
// do nothing.
},
onCompatibilityCheckStarted: function(aAddon) {
// do nothing.
},
onCompatibilityCheckEnded: function(aAddon, aStatus) {
// do nothing.
},
onInstallEnded: function(aAddon, aStatus) {
// do nothing.
},
onInstallsCompleted: function() {
next_test();
},
onDownloadProgress: 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_load_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) {
if (aItem == null)
do_throw("Addon " + aAddonsEntry.id + " wasn't detected");
if (aItem.version != aVersion)
do_throw("Addon " + aAddonsEntry.id + " was version " + aItem.version + " instead of " + aVersion);
} else {
if (aItem != null)
do_throw("Addon " + aAddonsEntry.id + " was detected");
}
}
/**
* Start the test by installing extensions.
*/
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "5", "1.9");
const dataDir = do_get_file("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");
for (var i = 0; i < ADDONS.length; i++) {
gEM.installItemFromFile(do_get_addon(ADDONS[i].addon),
NS_INSTALL_LOCATION_APPPROFILE);
}
dump("\n\n*** DONE INSTALLING NEW ITEMS\n\n");
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");
// checkListener 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");
// installListener 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, null);
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);
}
}
gEM.addInstallListener(installListener);
do_check_true(addonsArray.length > 0);
gEM.addDownloads(addonsArray, addonsArray.length, null);
}
/**
* 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]);
}
testserver.stop(do_test_finished);
}

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

@ -1,236 +0,0 @@
/* ***** 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@oxymoronical.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 *****
*/
/**
* Tests for update security restrictions.
*
* Install tests:
*
* Test updateKey updateURL expected
*-------------------------------------------
* 1 absent absent success
* 2 absent http failure
* 3 absent https success
* 4 present absent success
* 5 present http success
* 6 present https success
*
* Update tests:
*
* Test signature updateHash updateLink expected
*--------------------------------------------------------
* 5 absent absent http fail
* 7 broken absent http fail
* 8 correct absent http no update
* 9 correct sha1 http update
* 10 corrent absent https update
* 11 corrent sha1 https update
* 12 corrent md2 http no update
* 13 corrent md2 https update
*/
do_load_httpd_js();
var server;
// This allows the EM to attempt to display errors to the user without failing
var promptService = {
alert: function(aParent, aDialogTitle, aText) {
},
alertCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
},
confirm: function(aParent, aDialogTitle, aText) {
},
confirmCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
},
confirmEx: function(aParent, aDialogTitle, aText, aButtonFlags, aButton0Title, aButton1Title, aButton2Title, aCheckMsg, aCheckState) {
},
prompt: function(aParent, aDialogTitle, aText, aValue, aCheckMsg, aCheckState) {
},
promptUsernameAndPassword: function(aParent, aDialogTitle, aText, aUsername, aPassword, aCheckMsg, aCheckState) {
},
promptPassword: function(aParent, aDialogTitle, aText, aPassword, aCheckMsg, aCheckState) {
},
select: function(aParent, aDialogTitle, aText, aCount, aSelectList, aOutSelection) {
},
QueryInterface: function(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 (outer, iid) {
if (outer != null)
throw Components.results.NS_ERROR_NO_AGGREGATION;
return promptService.QueryInterface(iid);
}
};
var registrar = Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
registrar.registerFactory(Components.ID("{6cc9c9fe-bc0b-432b-a410-253ef8bcc699}"), "PromptService",
"@mozilla.org/embedcomp/prompt-service;1", PromptServiceFactory);
var updateListener = {
onUpdateStarted: function()
{
},
onUpdateEnded: function()
{
server.stop(do_test_finished);
},
onAddonUpdateStarted: function(addon)
{
},
onAddonUpdateEnded: function(addon, status)
{
var nsIAddonUpdateCheckListener = Components.interfaces.nsIAddonUpdateCheckListener;
switch (addon.id)
{
case "test_bug378216_5@tests.mozilla.org":
// Update has no signature
do_check_eq(status, nsIAddonUpdateCheckListener.STATUS_FAILURE);
break;
case "test_bug378216_7@tests.mozilla.org":
// Update has a signature that does not match
do_check_eq(status, nsIAddonUpdateCheckListener.STATUS_FAILURE);
break;
case "test_bug378216_8@tests.mozilla.org":
// Update has a signature but no secure update
do_check_eq(status, nsIAddonUpdateCheckListener.STATUS_NO_UPDATE);
break;
case "test_bug378216_9@tests.mozilla.org":
// Update has a signature and a hashed update
do_check_eq(status, nsIAddonUpdateCheckListener.STATUS_UPDATE);
do_check_eq(addon.version, "2.0");
break;
case "test_bug378216_10@tests.mozilla.org":
// Update has a signature and a https update
do_check_eq(status, nsIAddonUpdateCheckListener.STATUS_UPDATE);
do_check_eq(addon.version, "2.0");
break;
case "test_bug378216_11@tests.mozilla.org":
// Update has a signature and a hashed https update
do_check_eq(status, nsIAddonUpdateCheckListener.STATUS_UPDATE);
do_check_eq(addon.version, "2.0");
break;
case "test_bug378216_12@tests.mozilla.org":
// Update has a signature and an insecure hash against the update
do_check_eq(status, nsIAddonUpdateCheckListener.STATUS_NO_UPDATE);
break;
case "test_bug378216_13@tests.mozilla.org":
// The insecure hash doesn't matter if we have an https link
do_check_eq(status, nsIAddonUpdateCheckListener.STATUS_UPDATE);
do_check_eq(addon.version, "2.0");
break;
default:
do_throw("Update check for unknown "+addon.id);
}
}
}
function run_test()
{
// Setup for test
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1");
startupEM();
gEM.installItemFromFile(do_get_addon("test_bug378216_1"), NS_INSTALL_LOCATION_APPPROFILE);
gEM.installItemFromFile(do_get_addon("test_bug378216_2"), NS_INSTALL_LOCATION_APPPROFILE);
gEM.installItemFromFile(do_get_addon("test_bug378216_3"), NS_INSTALL_LOCATION_APPPROFILE);
gEM.installItemFromFile(do_get_addon("test_bug378216_4"), NS_INSTALL_LOCATION_APPPROFILE);
gEM.installItemFromFile(do_get_addon("test_bug378216_5"), NS_INSTALL_LOCATION_APPPROFILE);
gEM.installItemFromFile(do_get_addon("test_bug378216_6"), NS_INSTALL_LOCATION_APPPROFILE);
gEM.installItemFromFile(do_get_addon("test_bug378216_7"), NS_INSTALL_LOCATION_APPPROFILE);
gEM.installItemFromFile(do_get_addon("test_bug378216_8"), NS_INSTALL_LOCATION_APPPROFILE);
gEM.installItemFromFile(do_get_addon("test_bug378216_9"), NS_INSTALL_LOCATION_APPPROFILE);
gEM.installItemFromFile(do_get_addon("test_bug378216_10"), NS_INSTALL_LOCATION_APPPROFILE);
gEM.installItemFromFile(do_get_addon("test_bug378216_11"), NS_INSTALL_LOCATION_APPPROFILE);
gEM.installItemFromFile(do_get_addon("test_bug378216_12"), NS_INSTALL_LOCATION_APPPROFILE);
gEM.installItemFromFile(do_get_addon("test_bug378216_13"), NS_INSTALL_LOCATION_APPPROFILE);
restartEM();
do_check_neq(gEM.getItemForID("test_bug378216_1@tests.mozilla.org"), null);
// Test 2 has an insecure updateURL and no updateKey so should fail to install
do_check_eq(gEM.getItemForID("test_bug378216_2@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("test_bug378216_3@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("test_bug378216_4@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("test_bug378216_5@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("test_bug378216_6@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("test_bug378216_7@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("test_bug378216_8@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("test_bug378216_9@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("test_bug378216_10@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("test_bug378216_11@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("test_bug378216_12@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("test_bug378216_13@tests.mozilla.org"), null);
server = new nsHttpServer();
server.registerDirectory("/", do_get_file("data"));
server.start(4444);
var updates = [
gEM.getItemForID("test_bug378216_5@tests.mozilla.org"),
gEM.getItemForID("test_bug378216_7@tests.mozilla.org"),
gEM.getItemForID("test_bug378216_8@tests.mozilla.org"),
gEM.getItemForID("test_bug378216_9@tests.mozilla.org"),
gEM.getItemForID("test_bug378216_10@tests.mozilla.org"),
gEM.getItemForID("test_bug378216_11@tests.mozilla.org"),
gEM.getItemForID("test_bug378216_12@tests.mozilla.org"),
gEM.getItemForID("test_bug378216_13@tests.mozilla.org"),
];
gEM.update(updates, updates.length,
Components.interfaces.nsIExtensionManager.UPDATE_CHECK_NEWVERSION,
updateListener);
do_test_pending();
}

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

@ -1,142 +0,0 @@
/* ***** 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@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2009
* 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 *****
*/
const Cc = Components.classes;
const Ci = Components.interfaces;
const URI_XPINSTALL_CONFIRM_DIALOG = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";
// Finds the index of the given xpi in the dialogparamblock strings
function findXPI(dpb, name) {
for (var i = 0; i < 5; i++) {
if (dpb.GetString(i * 4 + 1).substr(-(name.length + 1)) == "/" + name)
return i * 4;
}
do_throw(name + " wasn't in the list");
return 0;
}
// Called to display the XPInstall dialog
var WindowWatcher = {
openWindow: function(parent, url, name, features, arguments) {
do_check_eq(url, URI_XPINSTALL_CONFIRM_DIALOG);
var dpb = arguments.QueryInterface(Ci.nsISupportsInterfacePointer)
.data.QueryInterface(Ci.nsIDialogParamBlock);
do_check_eq(dpb.GetInt(1), 20);
// Not defined what order they will be in so find them based on the filename
var unsigned = findXPI(dpb, "unsigned.xpi");
var signed = findXPI(dpb, "signed.xpi");
var untrusted = findXPI(dpb, "signed-untrusted.xpi");
var no_o = findXPI(dpb, "signed-no-o.xpi");
var no_cn = findXPI(dpb, "signed-no-cn.xpi");
// Test the names and certs are correct
do_check_eq(dpb.GetString(unsigned), "XPI Test");
do_check_eq(dpb.GetString(unsigned + 3), "");
do_check_eq(dpb.GetString(signed), "Signed XPI Test");
do_check_eq(dpb.GetString(signed + 3), "Object Signer");
do_check_eq(dpb.GetString(no_o), "Signed XPI Test (No Org)");
do_check_eq(dpb.GetString(no_o + 3), "Object Signer");
do_check_eq(dpb.GetString(no_cn), "Signed XPI Test (No Common Name)");
do_check_eq(dpb.GetString(no_cn + 3), "Mozilla Testing");
// XPIs signed by an unknown CA just appear to not be signed at all
do_check_eq(dpb.GetString(untrusted), "Signed XPI Test - Untrusted");
do_check_eq(dpb.GetString(untrusted + 3), "");
// Confirm the install
dpb.SetInt(0, 0);
},
QueryInterface: function(iid) {
if (iid.equals(Ci.nsIWindowWatcher)
|| iid.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
}
}
var WindowWatcherFactory = {
createInstance: function createInstance(outer, iid) {
if (outer != null)
throw Components.results.NS_ERROR_NO_AGGREGATION;
return WindowWatcher.QueryInterface(iid);
}
};
var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
registrar.registerFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"),
"Fake Window Watcher",
"@mozilla.org/embedcomp/window-watcher;1", WindowWatcherFactory);
function run_test()
{
// Setup for test
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1");
// Copy the certificate db to the profile
do_get_file("data/cert8.db").copyTo(gProfD, null);
do_get_file("data/key3.db").copyTo(gProfD, null);
do_get_file("data/secmod.db").copyTo(gProfD, null);
// Copy the test add-ons into the install location
var il = gProfD.clone();
il.append("extensions");
if (!il.exists())
il.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
do_get_file("data/unsigned.xpi").copyTo(il, null);
do_get_file("data/signed.xpi").copyTo(il, null);
do_get_file("data/signed-untrusted.xpi").copyTo(il, null);
do_get_file("data/signed-tampered.xpi").copyTo(il, null);
do_get_file("data/signed-no-o.xpi").copyTo(il, null);
do_get_file("data/signed-no-cn.xpi").copyTo(il, null);
// Starting the EM will detect and attempt to install the xpis
startupEM();
do_check_neq(gEM.getItemForID("signed-xpi@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("unsigned-xpi@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("untrusted-xpi@tests.mozilla.org"), null);
do_check_eq(gEM.getItemForID("tampered-xpi@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("signed-xpi-no-o@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("signed-xpi-no-cn@tests.mozilla.org"), null);
shutdownEM();
}

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

@ -1,64 +0,0 @@
/* ***** 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@oxymoronical.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 *****
*/
const ADDON = "test_bug257155";
const ID = "bug257155@tests.mozilla.org";
function run_test()
{
// Setup for test
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1");
startupEM();
// Install an extension
gEM.installItemFromFile(do_get_addon(ADDON), NS_INSTALL_LOCATION_APPPROFILE);
var addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.id, ID);
restartEM();
// Check after the restart
addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.id, ID);
// Dummy extension should not exist
addon = gEM.getItemForID("test-dummy-extension@mozilla.org");
do_check_eq(addon, null);
shutdownEM();
}

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

@ -1,148 +0,0 @@
/* ***** 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@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2009
* 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 *****
*/
// Disables security checking our updates which haven't been signed
gPrefs.setBoolPref("extensions.checkUpdateSecurity", false);
do_load_httpd_js();
var server;
var updateListener = {
onUpdateStarted: function() {
},
onUpdateEnded: function() {
gNext();
},
onAddonUpdateStarted: function(addon) {
},
onAddonUpdateEnded: function(addon, status) {
// No update rdf will get found so this should be a failure.
do_check_eq(status, Ci.nsIAddonUpdateCheckListener.STATUS_FAILURE);
}
}
var requestHandler = {
handle: function(metadata, response) {
var updateType = metadata.queryString;
do_check_eq(updateType, gType);
response.setStatusLine(metadata.httpVersion, 404, "Not Found");
}
}
var gAddon;
var gNext;
var gType;
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
startupEM();
gEM.installItemFromFile(do_get_addon("test_bug392180"), NS_INSTALL_LOCATION_APPPROFILE);
restartEM();
gAddon = gEM.getItemForID("bug392180@tests.mozilla.org");
do_check_neq(gAddon, null);
server = new nsHttpServer();
server.registerPathHandler("/update.rdf", requestHandler);
server.start(4444);
do_test_pending();
run_test_1();
}
function end_test() {
server.stop(do_test_finished);
}
function run_test_1() {
// UPDATE_TYPE_COMPATIBILITY | UPDATE_TYPE_NEWVERSION;
gType = 96;
gNext = run_test_2;
gEM.update([gAddon], 1, Ci.nsIExtensionManager.UPDATE_CHECK_NEWVERSION, updateListener);
}
function run_test_2() {
// UPDATE_TYPE_COMPATIBILITY;
gType = 32;
gNext = run_test_3;
gEM.update([gAddon], 1, Ci.nsIExtensionManager.UPDATE_CHECK_COMPATIBILITY, updateListener);
}
function run_test_3() {
// UPDATE_TYPE_COMPATIBILITY | UPDATE_TYPE_NEWVERSION | UPDATE_WHEN_USER_REQUESTED;
gType = 97;
gNext = run_test_4;
gEM.update([gAddon], 1, Ci.nsIExtensionManager.UPDATE_CHECK_NEWVERSION, updateListener,
Ci.nsIExtensionManager.UPDATE_WHEN_USER_REQUESTED);
}
function run_test_4() {
// UPDATE_TYPE_COMPATIBILITY | UPDATE_TYPE_NEWVERSION | UPDATE_WHEN_NEW_APP_DETECTED;
gType = 98;
gNext = run_test_5;
gEM.update([gAddon], 1, Ci.nsIExtensionManager.UPDATE_CHECK_NEWVERSION, updateListener,
Ci.nsIExtensionManager.UPDATE_WHEN_NEW_APP_DETECTED);
}
function run_test_5() {
// UPDATE_TYPE_COMPATIBILITY | UPDATE_WHEN_NEW_APP_INSTALLED;
gType = 35;
gNext = run_test_6;
gEM.update([gAddon], 1, Ci.nsIExtensionManager.UPDATE_CHECK_COMPATIBILITY, updateListener,
Ci.nsIExtensionManager.UPDATE_WHEN_NEW_APP_INSTALLED);
}
function run_test_6() {
// UPDATE_TYPE_COMPATIBILITY;
gType = 35;
gNext = end_test;
try {
gEM.update([gAddon], 1, Ci.nsIExtensionManager.UPDATE_CHECK_COMPATIBILITY, updateListener,
16);
do_throw("Should have thrown an exception");
}
catch (e) {
do_check_eq(e.result, Components.results.NS_ERROR_ILLEGAL_VALUE);
end_test();
}
}

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

@ -1,96 +0,0 @@
/* ***** 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 *****
*/
// Use the internal webserver for regular update pings
gPrefs.setCharPref("extensions.update.url", "http://localhost:4444/");
const checkListener = {
_onUpdateStartedCalled: false,
_onUpdateEndedCalled: false,
_onAddonUpdateStartedCount: 0,
_onAddonUpdateEndedCount: 0,
// nsIAddonUpdateCheckListener
onUpdateStarted: function onUpdateStarted() {
this._onUpdateStartedCalled = true;
},
// nsIAddonUpdateCheckListener
onUpdateEnded: function onUpdateEnded() {
this._onUpdateEndedCalled = true;
run_test_pt2();
},
// nsIAddonUpdateCheckListener
onAddonUpdateStarted: function onAddonUpdateStarted(aAddon) {
this._onAddonUpdateStartedCount++;
},
// nsIAddonUpdateCheckListener
onAddonUpdateEnded: function onAddonUpdateEnded(aAddon, aStatus) {
this._onAddonUpdateEndedCount++;
}
}
// Get the HTTP server.
do_load_httpd_js();
var testserver;
/**
* Run the test.
*/
function run_test() {
// Start the http server. Will return empty update info but that's ok
testserver = new nsHttpServer();
testserver.start(4444);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "5", "1.9");
startupEM();
const Ci = Components.interfaces;
gEM.update([], 0, Ci.nsIExtensionManager.UPDATE_SYNC_COMPATIBILITY, checkListener);
do_test_pending();
}
function run_test_pt2() {
dump("Checking onUpdateStarted\n");
do_check_true(checkListener._onUpdateStartedCalled);
dump("Checking onUpdateEnded\n");
do_check_true(checkListener._onUpdateEndedCalled);
do_check_eq(checkListener._onAddonUpdateStartedCount, checkListener._onAddonUpdateEndedCount);
testserver.stop(do_test_finished);
}

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

@ -1,345 +0,0 @@
/* ***** 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@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2008
* 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 *****
*/
// Disables security checking our updates which haven't been signed
gPrefs.setBoolPref("extensions.checkUpdateSecurity", false);
// Use the internal webserver for regular update pings, will just return an error
gPrefs.setCharPref("extensions.update.url", "http://localhost:4444/");
// Get the HTTP server.
do_load_httpd_js();
var testserver;
var next_state = null;
var needs_compatibility = false;
var next_test = null;
// This allows the EM to attempt to display errors to the user without failing
var promptService = {
alert: function(aParent, aDialogTitle, aText) {
},
alertCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
},
confirm: function(aParent, aDialogTitle, aText) {
},
confirmCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
},
confirmEx: function(aParent, aDialogTitle, aText, aButtonFlags, aButton0Title, aButton1Title, aButton2Title, aCheckMsg, aCheckState) {
},
prompt: function(aParent, aDialogTitle, aText, aValue, aCheckMsg, aCheckState) {
},
promptUsernameAndPassword: function(aParent, aDialogTitle, aText, aUsername, aPassword, aCheckMsg, aCheckState) {
},
promptPassword: function(aParent, aDialogTitle, aText, aPassword, aCheckMsg, aCheckState) {
},
select: function(aParent, aDialogTitle, aText, aCount, aSelectList, aOutSelection) {
},
QueryInterface: function(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 (outer, iid) {
if (outer != null)
throw Components.results.NS_ERROR_NO_AGGREGATION;
return promptService.QueryInterface(iid);
}
};
var registrar = Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
registrar.registerFactory(Components.ID("{6cc9c9fe-bc0b-432b-a410-253ef8bcc699}"), "PromptService",
"@mozilla.org/embedcomp/prompt-service;1", PromptServiceFactory);
// nsIAddonUpdateCheckListener
var updateListener = {
onUpdateStarted: function onUpdateStarted() {
},
onUpdateEnded: function onUpdateEnded() {
},
onAddonUpdateStarted: function onAddonUpdateStarted(aAddon) {
},
onAddonUpdateEnded: function onAddonUpdateEnded(aAddon, aStatus) {
if (next_test)
next_test(aAddon, aStatus);
}
}
// nsIAddonInstallListener
var installListener = {
onDownloadStarted: function(aAddon) {
do_check_eq(next_state, "onDownloadStarted");
dump(next_state+"\n");
next_state = "onDownloadEnded";
},
onDownloadEnded: function(aAddon) {
do_check_eq(next_state, "onDownloadEnded");
dump(next_state+"\n");
next_state = "onInstallStarted";
},
onInstallStarted: function(aAddon) {
do_check_eq(next_state, "onInstallStarted");
dump(next_state+"\n");
if (needs_compatibility)
next_state = "onCompatibilityCheckStarted";
else
next_state = "onInstallEnded";
},
onCompatibilityCheckStarted: function(aAddon) {
do_check_eq(next_state, "onCompatibilityCheckStarted");
dump(next_state+"\n");
next_state = "onCompatibilityCheckEnded";
},
onCompatibilityCheckEnded: function(aAddon, aStatus) {
do_check_eq(next_state, "onCompatibilityCheckEnded");
dump(next_state+"\n");
next_state = "onInstallEnded";
},
onInstallEnded: function(aAddon, aStatus) {
do_check_eq(next_state, "onInstallEnded");
dump(next_state+"\n");
next_state = "onInstallsCompleted";
},
onInstallsCompleted: function() {
do_check_eq(next_state, "onInstallsCompleted");
dump(next_state+"\n");
next_state = null;
if (next_test)
next_test();
},
onDownloadProgress: function onProgress(aAddon, aValue, aMaxValue) {
}
}
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "1.9");
const dataDir = do_get_file("data");
const addonsDir = do_get_addon("test_bug396129_a_1").parent;
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver.registerDirectory("/addons/", addonsDir);
testserver.registerDirectory("/data/", dataDir);
testserver.start(4444);
startupEM();
gEM.addInstallListener(installListener);
run_install_test();
}
function run_install_test() {
// All the v1 extensions should install synchronously
needs_compatibility = false;
var addons = ["test_bug396129_a_1", "test_bug396129_b_1", "test_bug396129_c_1", "test_bug396129_d_1"];
for (var i = 0; i < addons.length; i++) {
next_state = "onInstallStarted";
gEM.installItemFromFile(do_get_addon(addons[i]), NS_INSTALL_LOCATION_APPPROFILE);
do_check_eq(next_state, null);
}
restartEM();
var item = gEM.getItemForID("bug396129_a@tests.mozilla.org");
do_check_neq(item, null);
next_test = updatecheck_a;
gEM.update([item], 1, Components.interfaces.nsIExtensionManager.UPDATE_CHECK_NEWVERSION, updateListener);
do_test_pending();
}
function updatecheck_a(addon, status) {
do_check_eq(status, Components.interfaces.nsIAddonUpdateCheckListener.STATUS_UPDATE);
do_check_eq(addon.version, 2);
next_test = updated_a;
needs_compatibility = true;
next_state = "onDownloadStarted";
gEM.addDownloads([addon], 1, null);
}
function updated_a() {
do_check_eq(next_state, null);
var item = gEM.getItemForID("bug396129_d@tests.mozilla.org");
do_check_neq(item, null);
next_test = updatecheck_d;
gEM.update([item], 1, Components.interfaces.nsIExtensionManager.UPDATE_CHECK_NEWVERSION, updateListener);
}
function updatecheck_d(addon, status) {
do_check_eq(status, Components.interfaces.nsIAddonUpdateCheckListener.STATUS_UPDATE);
do_check_eq(addon.version, 2);
next_test = updated_d;
needs_compatibility = false;
next_state = "onDownloadStarted";
gEM.addDownloads([addon], 1, null);
}
function updated_d() {
do_check_eq(next_state, null);
restartEM();
gEM.uninstallItem("bug396129_a@tests.mozilla.org");
gEM.uninstallItem("bug396129_b@tests.mozilla.org");
gEM.uninstallItem("bug396129_c@tests.mozilla.org");
gEM.uninstallItem("bug396129_d@tests.mozilla.org");
restartEM();
do_check_eq(gEM.getItemForID("bug396129_a@tests.mozilla.org"), null);
do_check_eq(gEM.getItemForID("bug396129_b@tests.mozilla.org"), null);
do_check_eq(gEM.getItemForID("bug396129_c@tests.mozilla.org"), null);
do_check_eq(gEM.getItemForID("bug396129_d@tests.mozilla.org"), null);
next_state = "onInstallStarted";
needs_compatibility = true;
next_test = installed_a;
gEM.installItemFromFile(do_get_addon("test_bug396129_a_2"), NS_INSTALL_LOCATION_APPPROFILE);
}
function installed_a() {
do_check_eq(next_state, null);
restartEM();
// Should have been made compatible by the update information.
do_check_neq(gEM.getItemForID("bug396129_a@tests.mozilla.org"), null);
gEM.uninstallItem("bug396129_a@tests.mozilla.org");
restartEM();
do_check_eq(gEM.getItemForID("bug396129_a@tests.mozilla.org"), null);
next_state = "onInstallStarted";
needs_compatibility = true;
next_test = installed_b;
gEM.installItemFromFile(do_get_addon("test_bug396129_b_2"), NS_INSTALL_LOCATION_APPPROFILE);
}
function installed_b() {
do_check_eq(next_state, null);
restartEM();
// Should have failed compatibility check.
do_check_eq(gEM.getItemForID("bug396129_b@tests.mozilla.org"), null);
next_state = "onInstallStarted";
needs_compatibility = true;
next_test = installed_c;
gEM.installItemFromFile(do_get_addon("test_bug396129_c_2"), NS_INSTALL_LOCATION_APPPROFILE);
}
function installed_c() {
do_check_eq(next_state, null);
restartEM();
// Should have failed compatibility check.
do_check_eq(gEM.getItemForID("bug396129_c@tests.mozilla.org"), null);
var item = Components.classes["@mozilla.org/updates/item;1"]
.createInstance(Components.interfaces.nsIUpdateItem);
item.init("bug396129_b@tests.mozilla.org", "", NS_INSTALL_LOCATION_APPPROFILE,
"", "", "", " http://localhost:4444/addons/test_bug396129_b_2.xpi",
"", "", "", "", 2, "");
next_state = "onDownloadStarted";
needs_compatibility = true;
next_test = downloaded_b;
gEM.addDownloads([item], 1, null);
}
function downloaded_b() {
do_check_eq(next_state, null);
restartEM();
// Should have failed compatibility check.
do_check_eq(gEM.getItemForID("bug396129_b@tests.mozilla.org"), null);
var item = Components.classes["@mozilla.org/updates/item;1"]
.createInstance(Components.interfaces.nsIUpdateItem);
item.init("bug396129_c@tests.mozilla.org", "", NS_INSTALL_LOCATION_APPPROFILE,
"", "", "", " http://localhost:4444/addons/test_bug396129_c_2.xpi",
"", "", "", "", 2, "");
next_state = "onDownloadStarted";
needs_compatibility = true;
next_test = downloaded_c;
gEM.addDownloads([item], 1, null);
}
function downloaded_c() {
do_check_eq(next_state, null);
restartEM();
// Should have failed compatibility check.
do_check_eq(gEM.getItemForID("bug396129_c@tests.mozilla.org"), null);
test_complete();
}
function test_complete() {
testserver.stop(do_test_finished);
}

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

@ -1,73 +0,0 @@
/* ***** 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@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2008
* 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 *****
*/
function run_test()
{
// Copy an initial add-on into the profile.
var extension = gProfD.clone()
extension.append("extensions");
extension.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
extension.append("bug424107@tests.mozilla.org");
extension.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
var sourcerdf = do_get_file("data/test_bug424107_1.rdf");
sourcerdf.copyTo(extension, "install.rdf");
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "5", "1.9");
startupEM();
var addon = gEM.getItemForID("bug424107@tests.mozilla.org");
do_check_neq(addon, null);
do_check_eq(addon.version, 1);
// Uninstall
extension.remove(true);
restartEM();
addon = gEM.getItemForID("bug424107@tests.mozilla.org");
do_check_eq(addon, null);
// Install a new version
extension.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
sourcerdf = do_get_file("data/test_bug424107_2.rdf");
sourcerdf.copyTo(extension, "install.rdf");
restartEM();
addon = gEM.getItemForID("bug424107@tests.mozilla.org");
do_check_neq(addon, null);
do_check_eq(addon.version, 2);
}

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

@ -1,268 +0,0 @@
/* ***** 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@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2008
* 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 *****
*/
// Use the internal webserver for regular update pings, will just return an error
gPrefs.setCharPref("extensions.update.url", "http://localhost:4444/");
do_load_httpd_js();
var testserver;
// This allows the EM to attempt to display errors to the user without failing
var promptService = {
alert: function(aParent, aDialogTitle, aText) {
},
alertCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
},
confirm: function(aParent, aDialogTitle, aText) {
},
confirmCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
},
confirmEx: function(aParent, aDialogTitle, aText, aButtonFlags, aButton0Title, aButton1Title, aButton2Title, aCheckMsg, aCheckState) {
},
prompt: function(aParent, aDialogTitle, aText, aValue, aCheckMsg, aCheckState) {
},
promptUsernameAndPassword: function(aParent, aDialogTitle, aText, aUsername, aPassword, aCheckMsg, aCheckState) {
},
promptPassword: function(aParent, aDialogTitle, aText, aPassword, aCheckMsg, aCheckState) {
},
select: function(aParent, aDialogTitle, aText, aCount, aSelectList, aOutSelection) {
},
QueryInterface: function(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 (outer, iid) {
if (outer != null)
throw Components.results.NS_ERROR_NO_AGGREGATION;
return promptService.QueryInterface(iid);
}
};
var registrar = Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
registrar.registerFactory(Components.ID("{6cc9c9fe-bc0b-432b-a410-253ef8bcc699}"), "PromptService",
"@mozilla.org/embedcomp/prompt-service;1", PromptServiceFactory);
var gNextState = null;
var gIndex = null;
var ADDONS = [
{
id: null,
addon: "test_bug428341_1",
error: -8,
checksCompatibility: false
},
{
id: null,
addon: "test_bug428341_2",
error: -8,
checksCompatibility: false
},
{
id: null,
addon: "test_bug428341_3",
error: -8,
checksCompatibility: false
},
{
id: "{invalid-guid}",
addon: "test_bug428341_4",
error: -2,
checksCompatibility: false
},
{
id: "bug428341_5@tests.mozilla.org",
addon: "test_bug428341_5",
error: -5,
checksCompatibility: false
},
{
id: "bug428341_6@tests.mozilla.org",
addon: "test_bug428341_6",
error: -7,
checksCompatibility: false
},
{
id: "bug428341_7@tests.mozilla.org",
addon: "test_bug428341_7",
error: -3,
checksCompatibility: false
},
{
id: "bug428341_8@tests.mozilla.org",
addon: "test_bug428341_8",
error: -3,
checksCompatibility: true
},
{
id: "bug428341_9@tests.mozilla.org",
addon: "test_bug428341_9",
error: -3,
checksCompatibility: true
}
];
// nsIAddonInstallListener
var installListener = {
onDownloadStarted: function(aAddon) {
do_throw("onDownloadStarted should not be called for a direct install");
},
onDownloadEnded: function(aAddon) {
do_throw("onDownloadEnded should not be called for a direct install");
},
onInstallStarted: function(aAddon) {
var state = "onInstallStarted";
if (gNextState != state) {
do_throw("Encountered invalid state installing add-on " + ADDONS[gIndex].addon +
". Saw " + state + " but expected " + gNextState);
}
dump("Seen " + state + " for add-on " + ADDONS[gIndex].addon + "\n");
if (ADDONS[gIndex].checksCompatibility)
gNextState = "onCompatibilityCheckStarted";
else
gNextState = "onInstallEnded";
},
onCompatibilityCheckStarted: function(aAddon) {
var state = "onCompatibilityCheckStarted";
if (gNextState != state) {
do_throw("Encountered invalid state installing add-on " + ADDONS[gIndex].addon +
". Saw " + state + " but expected " + gNextState);
}
dump("Seen " + state + " for add-on " + ADDONS[gIndex].addon + "\n");
gNextState = "onCompatibilityCheckEnded";
},
onCompatibilityCheckEnded: function(aAddon, aStatus) {
var state = "onCompatibilityCheckEnded";
if (gNextState != state) {
do_throw("Encountered invalid state installing add-on " + ADDONS[gIndex].addon +
". Saw " + state + " but expected " + gNextState);
}
dump("Seen " + state + " for add-on " + ADDONS[gIndex].addon + "\n");
gNextState = "onInstallEnded";
},
onInstallEnded: function(aAddon, aStatus) {
var state = "onInstallEnded";
if (gNextState != state) {
do_throw("Encountered invalid state installing add-on " + ADDONS[gIndex].addon +
". Saw " + state + " but expected " + gNextState);
}
if (ADDONS[gIndex].id && ADDONS[gIndex].id != aAddon.id)
do_throw("Add-on " + ADDONS[gIndex].addon + " had an incorrect id " + aAddon.id);
if (aStatus != ADDONS[gIndex].error)
do_throw("Add-on " + ADDONS[gIndex].addon + " returned incorrect status " + aStatus + ".");
dump("Seen " + state + " for add-on " + ADDONS[gIndex].addon + "\n");
gNextState = "onInstallsCompleted";
},
onInstallsCompleted: function() {
var state = "onInstallsCompleted";
if (gNextState != state) {
do_throw("Encountered invalid state installing add-on " + ADDONS[gIndex].addon +
". Saw " + state + " but expected " + gNextState);
}
dump("Seen " + state + " for add-on " + ADDONS[gIndex].addon + "\n");
gNextState = null;
gIndex++;
installNextAddon();
},
onDownloadProgress: function onProgress(aAddon, aValue, aMaxValue) {
do_throw("onDownloadProgress should not be called for a direct install");
}
}
function installNextAddon() {
if (gIndex >= ADDONS.length) {
testserver.stop(do_test_finished);
return;
}
gNextState = "onInstallStarted";
try {
dump("Installing add-on " + ADDONS[gIndex].addon + "\n");
gEM.installItemFromFile(do_get_addon(ADDONS[gIndex].addon),
NS_INSTALL_LOCATION_APPPROFILE);
}
catch (e) {
do_throw("Exception installing add-on " + ADDONS[gIndex].addon + " " + e);
}
}
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
startupEM();
gEM.addInstallListener(installListener);
gIndex = 0;
do_test_pending();
// Create and configure the HTTP server.
testserver = new nsHttpServer();
testserver.start(4444);
installNextAddon();
}

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

@ -1,157 +0,0 @@
/* ***** 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@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2009
* 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 *****
*/
// Disables security checking our updates which haven't been signed
gPrefs.setBoolPref("extensions.checkUpdateSecurity", false);
// This allows the EM to attempt to display errors to the user without failing
var promptService = {
alert: function(aParent, aDialogTitle, aText) {
},
alertCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
},
confirm: function(aParent, aDialogTitle, aText) {
},
confirmCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
},
confirmEx: function(aParent, aDialogTitle, aText, aButtonFlags, aButton0Title, aButton1Title, aButton2Title, aCheckMsg, aCheckState) {
},
prompt: function(aParent, aDialogTitle, aText, aValue, aCheckMsg, aCheckState) {
},
promptUsernameAndPassword: function(aParent, aDialogTitle, aText, aUsername, aPassword, aCheckMsg, aCheckState) {
},
promptPassword: function(aParent, aDialogTitle, aText, aPassword, aCheckMsg, aCheckState) {
},
select: function(aParent, aDialogTitle, aText, aCount, aSelectList, aOutSelection) {
},
QueryInterface: function(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 (outer, iid) {
if (outer != null)
throw Components.results.NS_ERROR_NO_AGGREGATION;
return promptService.QueryInterface(iid);
}
};
var registrar = Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
registrar.registerFactory(Components.ID("{6cc9c9fe-bc0b-432b-a410-253ef8bcc699}"),
"PromptService",
"@mozilla.org/embedcomp/prompt-service;1", PromptServiceFactory);
var ADDONS = [
"test_bug470377_1",
"test_bug470377_2",
"test_bug470377_3",
"test_bug470377_4",
"test_bug470377_5",
];
var InstallListener = {
onDownloadStarted: function(aAddon) {
},
onDownloadProgress: function onProgress(aAddon, aValue, aMaxValue) {
},
onDownloadEnded: function(aAddon) {
},
onInstallStarted: function(aAddon) {
},
onCompatibilityCheckStarted: function(aAddon) {
if (aAddon.id == "bug470377_1@tests.mozilla.org")
do_throw("Shouldn't perform a compatibility check for test_bug470377_1");
},
onCompatibilityCheckEnded: function(aAddon, aStatus) {
},
onInstallEnded: function(aAddon, aStatus) {
},
onInstallsCompleted: function() {
if (ADDONS.length == 0) {
do_execute_soon(check_test);
return;
}
gEM.installItemFromFile(do_get_addon(ADDONS.shift()), NS_INSTALL_LOCATION_APPPROFILE);
}
};
do_load_httpd_js();
var server;
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
server = new nsHttpServer();
server.registerDirectory("/", do_get_file("data/test_bug470377"));
server.start(4444);
do_test_pending();
startupEM();
gEM.addInstallListener(InstallListener);
gEM.installItemFromFile(do_get_addon(ADDONS.shift()), NS_INSTALL_LOCATION_APPPROFILE);
}
function check_test() {
restartEM();
do_check_eq(gEM.getItemForID("bug470377_1@tests.mozilla.org"), null);
do_check_eq(gEM.getItemForID("bug470377_2@tests.mozilla.org"), null);
do_check_eq(gEM.getItemForID("bug470377_3@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("bug470377_4@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("bug470377_5@tests.mozilla.org"), null);
do_test_finished();
}

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

@ -1,158 +0,0 @@
/* ***** 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@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2009
* 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 *****
*/
// Disables security checking our updates which haven't been signed
gPrefs.setBoolPref("extensions.checkUpdateSecurity", false);
// Disables compatibility checking
gPrefs.setBoolPref("extensions.checkCompatibility.2", false);
// This allows the EM to attempt to display errors to the user without failing
var promptService = {
alert: function(aParent, aDialogTitle, aText) {
},
alertCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
},
confirm: function(aParent, aDialogTitle, aText) {
},
confirmCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) {
},
confirmEx: function(aParent, aDialogTitle, aText, aButtonFlags, aButton0Title, aButton1Title, aButton2Title, aCheckMsg, aCheckState) {
},
prompt: function(aParent, aDialogTitle, aText, aValue, aCheckMsg, aCheckState) {
},
promptUsernameAndPassword: function(aParent, aDialogTitle, aText, aUsername, aPassword, aCheckMsg, aCheckState) {
},
promptPassword: function(aParent, aDialogTitle, aText, aPassword, aCheckMsg, aCheckState) {
},
select: function(aParent, aDialogTitle, aText, aCount, aSelectList, aOutSelection) {
},
QueryInterface: function(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 (outer, iid) {
if (outer != null)
throw Components.results.NS_ERROR_NO_AGGREGATION;
return promptService.QueryInterface(iid);
}
};
var registrar = Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
registrar.registerFactory(Components.ID("{6cc9c9fe-bc0b-432b-a410-253ef8bcc699}"),
"PromptService",
"@mozilla.org/embedcomp/prompt-service;1", PromptServiceFactory);
var ADDONS = [
"test_bug470377_1",
"test_bug470377_2",
"test_bug470377_3",
"test_bug470377_4",
"test_bug470377_5",
];
var InstallListener = {
onDownloadStarted: function(aAddon) {
},
onDownloadProgress: function onProgress(aAddon, aValue, aMaxValue) {
},
onDownloadEnded: function(aAddon) {
},
onInstallStarted: function(aAddon) {
},
onCompatibilityCheckStarted: function(aAddon) {
do_throw("Shouldn't perform any compatibility checks but did for " + aAddon.id);
},
onCompatibilityCheckEnded: function(aAddon, aStatus) {
},
onInstallEnded: function(aAddon, aStatus) {
},
onInstallsCompleted: function() {
if (ADDONS.length == 0) {
do_execute_soon(check_test);
return;
}
gEM.installItemFromFile(do_get_addon(ADDONS.shift()), NS_INSTALL_LOCATION_APPPROFILE);
}
};
do_load_httpd_js();
var server;
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
server = new nsHttpServer();
server.registerDirectory("/", do_get_file("data/test_bug470377"));
server.start(4444);
do_test_pending();
startupEM();
gEM.addInstallListener(InstallListener);
gEM.installItemFromFile(do_get_addon(ADDONS.shift()), NS_INSTALL_LOCATION_APPPROFILE);
}
function check_test() {
restartEM();
do_check_eq(gEM.getItemForID("bug470377_1@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("bug470377_2@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("bug470377_3@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("bug470377_4@tests.mozilla.org"), null);
do_check_neq(gEM.getItemForID("bug470377_5@tests.mozilla.org"), null);
do_test_finished();
}

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

@ -1,94 +0,0 @@
/* ***** 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@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2009
* 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 *****
*/
var installListenerA = {};
var installListenerB = {};
var installListenerC = {};
var installListenerD = {};
var installListenerE = {};
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "1.9");
startupEM();
// Add some listeners
do_check_eq(gEM.addInstallListener(installListenerA), 0);
do_check_eq(gEM.addInstallListener(installListenerB), 1);
do_check_eq(gEM.addInstallListener(installListenerC), 2);
// Now stack is ABC
// Should get back the same id if adding the same listener twice
do_check_eq(gEM.addInstallListener(installListenerA), 0);
do_check_eq(gEM.addInstallListener(installListenerB), 1);
do_check_eq(gEM.addInstallListener(installListenerC), 2);
// Stack is still ABC
// Removing a listener shouldn't affect the id of the others
gEM.removeInstallListenerAt(0);
do_check_eq(gEM.addInstallListener(installListenerB), 1);
do_check_eq(gEM.addInstallListener(installListenerC), 2);
// Stack is .BC
// Adding a new listener should still give a higher id than previously
do_check_eq(gEM.addInstallListener(installListenerD), 3);
// Stack is .BCD
// Removing and re-adding the highest listener should give the same result.
gEM.removeInstallListenerAt(3);
do_check_eq(gEM.addInstallListener(installListenerE), 3);
// Stack is .BCE
do_check_eq(gEM.addInstallListener(installListenerD), 4);
gEM.removeInstallListenerAt(3);
do_check_eq(gEM.addInstallListener(installListenerE), 5);
// Stack is .BC.DE
// Stack should shorten down to the last listener
gEM.removeInstallListenerAt(4);
gEM.removeInstallListenerAt(5);
do_check_eq(gEM.addInstallListener(installListenerD), 3);
// Stack is .BCD
// Stack should get down to 0
gEM.removeInstallListenerAt(1);
gEM.removeInstallListenerAt(2);
gEM.removeInstallListenerAt(3);
do_check_eq(gEM.addInstallListener(installListenerE), 0);
gEM.removeInstallListenerAt(0);
// Stack is empty
}

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

@ -1,130 +0,0 @@
/* ***** 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@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2009
* 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 *****
*/
const Cc = Components.classes;
const Ci = Components.interfaces;
const ID = "bug486195@tests.mozilla.org";
const REGKEY = "SOFTWARE\\Mozilla\\XPCShell\\Extensions";
function run_test()
{
if (!("nsIWindowsRegKey" in Ci))
return;
var extension = do_get_file("data/test_bug486195");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
// --- Modified nsIWindowsRegKey implementation ---
/**
* This is a mock nsIWindowsRegistry implementation. It only implements the
* methods that the extension manager requires.
*/
function MockWindowsRegKey() {
}
MockWindowsRegKey.prototype = {
// --- Overridden nsISupports interface functions ---
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWindowsRegKey]),
// --- Overridden nsIWindowsRegKey interface functions ---
open: function(aRootKey, aRelPath, aMode) {
if (aRootKey != Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE)
throw Components.results.NS_ERROR_FAILURE;
if (aRelPath != REGKEY)
throw Components.results.NS_ERROR_FAILURE;
},
close: function() {
},
get valueCount() {
return 1;
},
getValueName: function(aIndex) {
if (aIndex == 0)
return ID;
throw Components.results.NS_ERROR_FAILURE;
},
readStringValue: function(aName) {
if (aName == ID)
return extension.path;
throw Components.results.NS_ERROR_FAILURE;
}
};
var factory = {
createInstance: function(aOuter, aIid) {
if (aOuter != null)
throw Cr.NS_ERROR_NO_AGGREGATION;
var key = new MockWindowsRegKey();
return key.QueryInterface(aIid);
}
};
Components.manager.QueryInterface(Ci.nsIComponentRegistrar)
.registerFactory(Components.ID("{0478de5b-0f38-4edb-851d-4c99f1ed8eba}"),
"Mock Windows Registry Implementation",
"@mozilla.org/windows-registry-key;1", factory);
// Setup for test
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1");
// Install test add-on
startupEM();
var addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
var installLocation = gEM.getInstallLocation(ID);
var path = installLocation.getItemLocation(ID);
do_check_eq(extension.path, path.path);
path.append("install.rdf");
path = installLocation.getItemLocation(ID);
do_check_eq(extension.path, path.path);
shutdownEM();
Components.manager.unregisterFactory(Components.ID("{0478de5b-0f38-4edb-851d-4c99f1ed8eba}"),
factory);
}

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

@ -1,62 +0,0 @@
/* ***** 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@oxymoronical.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2009
* 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 *****
*/
const ID = "{972ce4c6-7e08-4474-a285-3208198ce6fd}";
function run_test()
{
// Setup for test
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1");
startupEM();
var addon = gEM.getItemForID(ID);
// Some applications don't have the default theme defined
if (!addon)
return;
var iconURL = getManifestProperty(ID, "iconURL");
var location = gEM.getInstallLocation(ID);
var file = location.getItemFile(ID, "icon.png");
var ioservice = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var uri = ioservice.newURI(iconURL, null, null);
uri.QueryInterface(Components.interfaces.nsIFileURL);
do_check_true(uri.file.equals(file));
shutdownEM();
}

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

@ -262,17 +262,32 @@ function isExtensionInAddonsList(dir, id) {
return isItemInAddonsList("extensions", dir, id);
}
/**
* Escapes any occurances of &, ", < or > with XML entities.
*
* @param str
* The string to escape
* @return The escaped string
*/
function escapeXML(str) {
return str.toString()
.replace(/&/g, "&amp;")
.replace(/"/g, "&quot;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
}
function writeLocaleStrings(data) {
let rdf = "";
["name", "description", "creator", "homepageURL"].forEach(function(prop) {
if (prop in data)
rdf += "<em:" + prop + ">" + data[prop] + "</em:" + prop + ">\n";
rdf += "<em:" + prop + ">" + escapeXML(data[prop]) + "</em:" + prop + ">\n";
});
["developer", "translator", "contributor"].forEach(function(prop) {
if (prop in data) {
data[prop].forEach(function(value) {
rdf += "<em:" + prop + ">" + value + "</em:" + prop + ">\n";
rdf += "<em:" + prop + ">" + escapeXML(value) + "</em:" + prop + ">\n";
});
}
});
@ -300,7 +315,7 @@ function writeInstallRDFToDir(data, dir) {
["id", "version", "type", "internalName", "updateURL", "updateKey",
"optionsURL", "aboutURL", "iconURL"].forEach(function(prop) {
if (prop in data)
rdf += "<em:" + prop + ">" + data[prop] + "</em:" + prop + ">\n";
rdf += "<em:" + prop + ">" + escapeXML(data[prop]) + "</em:" + prop + ">\n";
});
rdf += writeLocaleStrings(data);
@ -310,7 +325,7 @@ function writeInstallRDFToDir(data, dir) {
rdf += "<em:targetApplication><Description>\n";
["id", "minVersion", "maxVersion"].forEach(function(prop) {
if (prop in app)
rdf += "<em:" + prop + ">" + app[prop] + "</em:" + prop + ">\n";
rdf += "<em:" + prop + ">" + escapeXML(app[prop]) + "</em:" + prop + ">\n";
});
rdf += "</Description></em:targetApplication>\n";
});
@ -540,6 +555,74 @@ function ensure_test_completed() {
do_check_eq(gExpectedInstalls.length, 0);
}
/**
* A helper method to install an array of AddonInstall to completion and then
* call a provided callback.
*
* @param installs
* The array of AddonInstalls to install
* @param callback
* The callback to call when all installs have finished
*/
function completeAllInstalls(installs, callback) {
if (count == 0) {
callback();
return;
}
let count = installs.length;
function installCompleted(install) {
install.removeListener(listener);
if (--count == 0)
callback();
}
let listener = {
onDownloadFailed: installCompleted,
onDownloadCancelled: installCompleted,
onInstallFailed: installCompleted,
onInstallCancelled: installCompleted,
onInstallEnded: installCompleted
};
installs.forEach(function(install) {
install.addListener(listener);
install.install();
});
}
/**
* A helper method to install an array of files and call a callback after the
* installs are completed.
*
* @param files
* The array of files to install
* @param callback
* The callback to call when all installs have finished
* @param ignoreIncompatible
* Optional parameter to ignore add-ons that are incompatible in
* aome way with the application
*/
function installAllFiles(files, callback, ignoreIncompatible) {
let count = files.length;
let installs = [];
files.forEach(function(file) {
AddonManager.getInstallForFile(file, function(install) {
if (!install)
do_throw("No AddonInstall created for " + file.path);
if (!ignoreIncompatible || !install.addon.appDisabled)
installs.push(install);
if (--count == 0)
completeAllInstalls(installs, callback);
});
});
}
if ("nsIWindowsRegKey" in AM_Ci) {
var MockRegistry = {
LOCAL_MACHINE: {},

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

@ -18,6 +18,9 @@ function dummy(id) {
}
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
startupManager();
var temp = {};
Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", temp);
do_check_eq(typeof temp.LightweightThemeManager, "object");

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

@ -0,0 +1,242 @@
/* ***** 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 *****
*/
// Disables security checking our updates which haven't been signed
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
// Update check listener.
const checkListener = {
pendingCount: 0,
onUpdateAvailable: function onUpdateAvailable(aAddon, aInstall) {
for (var i = 0; i < ADDONS.length; i++) {
if (ADDONS[i].id == aAddon.id) {
ADDONS[i].newInstall = aInstall;
return;
}
}
},
onUpdateFinished: function onUpdateFinished() {
if (--this.pendingCount == 0)
next_test();
}
}
// Get the HTTP server.
do_load_httpd_js();
var testserver;
var ADDONS = [
// XPCShell
{
id: "bug299716-a@tests.mozilla.org",
addon: "test_bug299716_a_1",
installed: true,
item: null,
newInstall: null
},
// Toolkit
{
id: "bug299716-b@tests.mozilla.org",
addon: "test_bug299716_b_1",
installed: true,
item: null,
newInstall: null
},
// XPCShell + Toolkit
{
id: "bug299716-c@tests.mozilla.org",
addon: "test_bug299716_c_1",
installed: true,
item: null,
newInstall: null
},
// XPCShell (Toolkit invalid)
{
id: "bug299716-d@tests.mozilla.org",
addon: "test_bug299716_d_1",
installed: true,
item: null,
newInstall: null
},
// Toolkit (XPCShell invalid)
{
id: "bug299716-e@tests.mozilla.org",
addon: "test_bug299716_e_1",
installed: false,
item: null,
newInstall: null,
failedAppName: "XPCShell"
},
// None (XPCShell, Toolkit invalid)
{
id: "bug299716-f@tests.mozilla.org",
addon: "test_bug299716_f_1",
installed: false,
item: null,
newInstall: null,
failedAppName: "XPCShell"
},
// None (Toolkit invalid)
{
id: "bug299716-g@tests.mozilla.org",
addon: "test_bug299716_g_1",
installed: false,
item: null,
newInstall: null,
failedAppName: "Toolkit"
},
];
var next_test = function() {};
function do_check_item(aItem, aVersion, aAddonsEntry) {
if (aAddonsEntry.installed) {
if (aItem == null)
do_throw("Addon " + aAddonsEntry.id + " wasn't detected");
if (aItem.version != aVersion)
do_throw("Addon " + aAddonsEntry.id + " was version " + aItem.version + " instead of " + aVersion);
} else {
if (aItem != null)
do_throw("Addon " + aAddonsEntry.id + " was detected");
}
}
/**
* Start the test by installing extensions.
*/
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "5", "1.9");
const dataDir = do_get_file("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.
startupManager();
dump("\n\n*** INSTALLING NEW ITEMS\n\n");
installAllFiles([do_get_addon(a.addon) for each (a in ADDONS)], run_test_pt2,
true);
}
/**
* Check the versions of all items, and ask the extension manager to find updates.
*/
function run_test_pt2() {
dump("\n\n*** DONE INSTALLING NEW ITEMS\n\n");
dump("\n\n*** RESTARTING EXTENSION MANAGER\n\n");
restartManager();
AddonManager.getAddons([a.id for each (a in ADDONS)], function(items) {
dump("\n\n*** REQUESTING UPDATE\n\n");
// checkListener will call run_test_pt3().
next_test = run_test_pt3;
// Try to update the items.
for (var i = 0; i < ADDONS.length; i++) {
var item = items[i];
do_check_item(item, "0.1", ADDONS[i]);
if (item) {
checkListener.pendingCount++;
ADDONS[i].item = item;
item.findUpdates(checkListener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
}
}
});
}
/**
* Install new items for each enabled extension.
*/
function run_test_pt3() {
// Install the new items.
dump("\n\n*** UPDATING ITEMS\n\n");
completeAllInstalls([a.newInstall for each(a in ADDONS) if (a.newInstall)],
run_test_pt4);
}
/**
* Check the final version of each extension.
*/
function run_test_pt4() {
dump("\n\n*** RESTARTING EXTENSION MANAGER\n\n");
restartManager();
dump("\n\n*** FINAL CHECKS\n\n");
AddonManager.getAddons([a.id for each (a in ADDONS)], function(items) {
for (var i = 0; i < ADDONS.length; i++) {
var item = items[i];
do_check_item(item, "0.2", ADDONS[i]);
}
testserver.stop(do_test_finished);
});
}

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

@ -37,33 +37,7 @@
*/
// Disables security checking our updates which haven't been signed
gPrefs.setBoolPref("extensions.checkUpdateSecurity", false);
// 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);
testserver.stop(do_test_finished);
},
// nsIAddonUpdateCheckListener
onAddonUpdateStarted: function onAddonUpdateStarted(aAddon) {
},
// nsIAddonUpdateCheckListener
onAddonUpdateEnded: function onAddonUpdateEnded(aAddon, aStatus) {
}
}
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
// Get the HTTP server.
do_load_httpd_js();
@ -75,7 +49,9 @@ var ADDON = {
};
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "1.9");
const dataDir = do_get_file("data");
const addonsDir = do_get_addon(ADDON.addon).parent;
@ -86,22 +62,22 @@ function run_test() {
testserver.registerDirectory("/data/", dataDir);
testserver.start(4444);
startupEM();
startupManager();
// Should just install.
gEM.installItemFromFile(do_get_addon(ADDON.addon),
NS_INSTALL_LOCATION_APPPROFILE);
restartEM();
installAllFiles([do_get_addon(ADDON.addon)], function() {
restartManager();
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);
AddonManager.getAddon(ADDON.id, function(item) {
do_check_eq(item.version, 0.1);
do_check_false(item.isCompatible);
do_test_pending();
item.findUpdates({
onUpdateFinished: function(addon) {
do_check_false(item.isCompatible);
gEM.update([item], 1,
Components.interfaces.nsIExtensionManager.UPDATE_SYNC_COMPATIBILITY,
checkListener);
testserver.stop(do_test_finished);
}
}, AddonManager.UPDATE_WHEN_USER_REQUESTED);
});
});
}

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

@ -37,15 +37,14 @@
*/
// Disables security checking our updates which haven't been signed
gPrefs.setBoolPref("extensions.checkUpdateSecurity", false);
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
// Get the HTTP server.
do_load_httpd_js();
var testserver;
var next_test = null;
var gItemsNotCheck = [];
var gItemsNotChecked =[];
var ADDONS = [ {id: "bug324121_1@tests.mozilla.org",
addon: "test_bug324121_1",
@ -77,69 +76,88 @@ var ADDONS = [ {id: "bug324121_1@tests.mozilla.org",
// nsIAddonUpdateCheckListener
var updateListener = {
onUpdateStarted: function onUpdateStarted() {
},
pendingCount: 0,
onUpdateEnded: function onUpdateEnded() {
// Verify that all items that should be checked have been checked.
do_check_eq(gItemsNotCheck.length, 0);
test_complete();
},
onAddonUpdateStarted: function onAddonUpdateStarted(aAddon) {
},
onAddonUpdateEnded: function onAddonUpdateEnded(aAddon, aStatus) {
var nsIAddonUpdateCheckListener = Ci.nsIAddonUpdateCheckListener;
switch (aAddon.id)
{
onUpdateAvailable: function onAddonUpdateEnded(aAddon) {
switch (aAddon.id) {
// add-on disabled - should not happen
case "bug324121_1@tests.mozilla.org":
// add-on disabled - should not happen
do_throw("Update check for disabled add-on " + aAddon.id);
break;
case "bug324121_2@tests.mozilla.org":
// app id compatible update available
do_check_eq(aStatus, nsIAddonUpdateCheckListener.STATUS_UPDATE);
break;
case "bug324121_3@tests.mozilla.org":
// app id incompatible update available
do_check_eq(aStatus, nsIAddonUpdateCheckListener.STATUS_NO_UPDATE);
break;
case "bug324121_4@tests.mozilla.org":
// update rdf not found
do_check_eq(aStatus, nsIAddonUpdateCheckListener.STATUS_FAILURE);
break;
// app id already compatible - should not happen
case "bug324121_5@tests.mozilla.org":
// app id already compatible - should not happen
do_throw("Update check for compatible add-on " + aAddon.id);
break;
case "bug324121_6@tests.mozilla.org":
// toolkit id compatible update available
do_check_eq(aStatus, nsIAddonUpdateCheckListener.STATUS_UPDATE);
break;
case "bug324121_7@tests.mozilla.org":
// toolkit id incompatible update available
do_check_eq(aStatus, nsIAddonUpdateCheckListener.STATUS_NO_UPDATE);
break;
case "bug324121_8@tests.mozilla.org":
// update rdf not found
do_check_eq(aStatus, nsIAddonUpdateCheckListener.STATUS_FAILURE);
break;
// toolkit id already compatible - should not happen
case "bug324121_9@tests.mozilla.org":
// toolkit id already compatible - should not happen
do_throw("Update check for compatible add-on " + aAddon.id);
do_throw("Should not have seen an update check for " + aAddon.id);
break;
// app id incompatible update available
case "bug324121_3@tests.mozilla.org":
// update rdf not found
case "bug324121_4@tests.mozilla.org":
// toolkit id incompatible update available
case "bug324121_7@tests.mozilla.org":
// update rdf not found
case "bug324121_8@tests.mozilla.org":
do_throw("Should be no update available for " + aAddon.id);
break;
// Updates available
case "bug324121_2@tests.mozilla.org":
case "bug324121_6@tests.mozilla.org":
break;
default:
do_throw("Update check for unknown " + aAddon.id);
}
// pos should always be >= 0 so just let this throw if this fails
var pos = gItemsNotCheck.indexOf(aAddon.id);
gItemsNotCheck.splice(pos, 1);
var pos = gItemsNotChecked.indexOf(aAddon.id);
gItemsNotChecked.splice(pos, 1);
},
onNoUpdateAvailable: function onNoUpdateAvailable(aAddon) {
switch (aAddon.id) {
// add-on disabled - should not happen
case "bug324121_1@tests.mozilla.org":
// app id already compatible - should not happen
case "bug324121_5@tests.mozilla.org":
// toolkit id already compatible - should not happen
case "bug324121_9@tests.mozilla.org":
do_throw("Should not have seen an update check for " + aAddon.id);
break;
// app id incompatible update available
case "bug324121_3@tests.mozilla.org":
// update rdf not found
case "bug324121_4@tests.mozilla.org":
// toolkit id incompatible update available
case "bug324121_7@tests.mozilla.org":
// update rdf not found
case "bug324121_8@tests.mozilla.org":
break;
// Updates available
case "bug324121_2@tests.mozilla.org":
case "bug324121_6@tests.mozilla.org":
do_throw("Should be an update available for " + aAddon.id);
break;
default:
do_throw("Update check for unknown " + aAddon.id);
}
// pos should always be >= 0 so just let this throw if this fails
var pos = gItemsNotChecked.indexOf(aAddon.id);
gItemsNotChecked.splice(pos, 1);
},
onUpdateFinished: function onUpdateFinished(aAddon) {
if (--this.pendingCount == 0)
test_complete();
}
};
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
const dataDir = do_get_file("data");
@ -149,40 +167,44 @@ function run_test() {
testserver.registerDirectory("/data/", dataDir);
testserver.start(4444);
startupEM();
startupManager();
var addons = ["test_bug324121_1"];
for (var k in ADDONS)
gEM.installItemFromFile(do_get_addon(ADDONS[k].addon),
NS_INSTALL_LOCATION_APPPROFILE);
installAllFiles([do_get_addon(a.addon) for each (a in ADDONS)], function() {
restartManager();
AddonManager.getAddon(ADDONS[0].id, function(addon) {
addon.userDisabled = true;
restartManager();
restartEM();
gEM.disableItem(ADDONS[0].id);
restartEM();
AddonManager.getAddonsByTypes(["extension"], function(installedItems) {
var items = [];
var items = gEM.getIncompatibleItemList("3", "3", Ci.nsIUpdateItem.TYPE_ANY,
false);
for (let k = 0; k < ADDONS.length; k++) {
for (let i = 0; i < installedItems.length; i++) {
if (ADDONS[k].id != installedItems[i].id)
continue;
if (installedItems[i].userDisabled)
continue;
// Verify only items incompatible with the next app version are returned
for (var k in ADDONS) {
var found = false;
for (var i = 0; i < items.length; ++i) {
if (ADDONS[k].id == items[i].id) {
gItemsNotCheck.push(items[i].id);
found = true;
break;
}
}
do_check_true(ADDONS[k].shouldCheck == found);
}
if (ADDONS[k].shouldCheck == installedItems[i].isCompatibleWith("3", "3")) {
do_throw(installedItems[i].id + " had the wrong compatibility: " +
installedItems[i].isCompatibleWith("3", "3"));
}
gEM.update(items, items.length, Ci.nsIExtensionManager.UPDATE_NOTIFY_NEWVERSION,
updateListener, Ci.nsIExtensionManager.UPDATE_WHEN_USER_REQUESTED,
"3", "3");
do_test_pending();
if (ADDONS[k].shouldCheck) {
gItemsNotChecked.push(ADDONS[k].id);
updateListener.pendingCount++;
installedItems[i].findUpdates(updateListener,
AddonManager.UPDATE_WHEN_USER_REQUESTED,
"3", "3");
}
}
}
});
});
});
}
function test_complete() {
do_check_eq(gItemsNotChecked.length, 0);
testserver.stop(do_test_finished);
}

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

@ -40,7 +40,7 @@ const PREF_MATCH_OS_LOCALE = "intl.locale.matchOS";
const PREF_SELECTED_LOCALE = "general.useragent.locale";
// Disables security checking our updates which haven't been signed
gPrefs.setBoolPref("extensions.checkUpdateSecurity", false);
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
do_load_httpd_js();
@ -62,7 +62,7 @@ var EXPECTED = [
id: "bug335238_2@tests.mozilla.org",
version: "28at",
maxAppVersion: "7",
status: "userDisabled,needsDependencies",
status: "userDisabled",
appId: "xpcshell@tests.mozilla.org",
appVersion: "1",
appOs: "XPCShell",
@ -82,23 +82,15 @@ var ADDONS = [
var server;
var updateListener = {
onUpdateStarted: function()
{
pendingCount: 0,
onUpdateAvailable: function(aAddon) {
do_throw("Should not have seen an update for " + aAddon.id);
},
onUpdateEnded: function()
{
server.stop(do_test_finished);
},
onAddonUpdateStarted: function(addon)
{
},
onAddonUpdateEnded: function(addon, status)
{
// No update rdf will get found so this should be a failure.
do_check_eq(status, Ci.nsIAddonUpdateCheckListener.STATUS_FAILURE);
onUpdateFinished: function() {
if (--this.pendingCount == 0)
server.stop(do_test_finished);
}
}
@ -119,33 +111,31 @@ var requestHandler = {
}
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
gPrefs.setBoolPref(PREF_MATCH_OS_LOCALE, false);
gPrefs.setCharPref(PREF_SELECTED_LOCALE, "en-US");
startupEM();
for (var k in ADDONS)
gEM.installItemFromFile(do_get_addon(ADDONS[k].addon),
NS_INSTALL_LOCATION_APPPROFILE);
restartEM();
gEM.disableItem(ADDONS[1].id);
restartEM();
var updates = [];
for (var k in ADDONS) {
do_check_neq(gEM.getInstallLocation(ADDONS[k].id), null);
var addon = gEM.getItemForID(ADDONS[k].id);
updates.push(addon);
}
server = new nsHttpServer();
server.registerPathHandler("/0", requestHandler);
server.registerPathHandler("/1", requestHandler);
server.start(4444);
gEM.update(updates, updates.length, false, updateListener);
do_test_pending();
Services.prefs.setBoolPref(PREF_MATCH_OS_LOCALE, false);
Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "en-US");
startupManager();
installAllFiles([do_get_addon(a.addon) for each (a in ADDONS)], function() {
restartManager();
AddonManager.getAddon(ADDONS[1].id, function(addon) {
addon.userDisabled = true;
restartManager();
AddonManager.getAddons([a.id for each (a in ADDONS)], function(installedItems) {
installedItems.forEach(function(item) {
updateListener.pendingCount++;
item.findUpdates(updateListener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
});
});
});
});
}

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

@ -45,20 +45,24 @@ const ID = "bug371495@tests.mozilla.org";
function run_test()
{
// Setup for test
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1");
// Install test add-on
startupEM();
gEM.installItemFromFile(do_get_addon(ADDON), NS_INSTALL_LOCATION_APPPROFILE);
var addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.name, "Test theme");
restartEM();
startupManager();
installAllFiles([do_get_addon(ADDON)], function() {
AddonManager.getAddon(ID, function(addon) {
do_check_neq(addon, null);
do_check_eq(addon.name, "Test theme");
restartManager();
addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(getManifestProperty(ID, "optionsURL"), "");
do_check_eq(getManifestProperty(ID, "aboutURL"), "");
AddonManager.getAddon(ID, function(addon) {
do_check_neq(addon, null);
do_check_eq(addon.optionsURL, null);
do_check_eq(addon.aboutURL, null);
shutdownEM();
do_test_finished();
});
});
});
}

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

@ -50,9 +50,9 @@ var observer = {
function initTest()
{
do_test_pending();
// Setup extension manager
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
startupEM();
// Register our parameter handlers
gComponentRegistrar.registerFactory(CLASS_ID, "Test component", CONTRACT_ID, paramHandlerFactory);
@ -61,40 +61,74 @@ function initTest()
// Register observer to get notified when URLs are requested
gObserverService.addObserver(observer, "http-on-modify-request", false);
// Install a test extension into the profile
let dir = gProfD.clone();
dir.append("extensions");
dir.append("test@mozilla.org");
writeInstallRDFToDir({
id: "test@mozilla.org",
version: "1.0",
name: "Test extension",
updateURL: gTestURL,
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}],
}, dir);
startupManager();
}
function shutdownTest()
{
shutdownEM();
shutdownManager();
gComponentRegistrar.unregisterFactory(CLASS_ID, paramHandlerFactory);
gCategoryManager.deleteCategoryEntry("extension-update-params", "CUSTOM1", false);
gCategoryManager.deleteCategoryEntry("extension-update-params", "CUSTOM2", false);
gObserverService.removeObserver(observer, "http-on-modify-request");
do_test_finished();
}
function run_test()
{
initTest();
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, null, item.TYPE_EXTENSION, "xpcshell@tests.mozilla.org");
gExpectedURL = gTestURL.replace(/%ITEM_ID%/, item.id)
gExpectedURL = gTestURL.replace(/%ITEM_ID%/, "test@mozilla.org")
.replace(/%CUSTOM1%/, "custom_parameter_1")
.replace(/%CUSTOM2%/, "custom_parameter_2");
// Replace extension update URL
gPrefs.setCharPref("extensions.update.url", gTestURL);
AddonManager.getAddon("test@mozilla.org", function(item) {
// Initiate update
item.findUpdates({
onNoCompatibilityUpdateAvailable: function(addon) {
do_throw("Should not have seen no compatibility update");
},
// Initiate update
gEM.update([item], 1, Ci.nsIExtensionManager.UPDATE_SYNC_COMPATIBILITY, null);
onUpdateAvailable: function(addon, install) {
ensure_test_completed();
do_check_true(gSeenExpectedURL);
do_check_eq(addon, a1);
do_check_eq(install.name, addon.name);
do_check_eq(install.version, "2.0");
do_check_eq(install.state, AddonManager.STATE_AVAILABLE);
do_check_eq(install.existingAddon, addon);
gPrefs.clearUserPref("extensions.update.url");
prepare_test({}, [
"onDownloadStarted",
"onDownloadEnded",
], check_test_1);
install.install();
},
shutdownTest();
onUpdateFinished: function(addon) {
do_check_true(gSeenExpectedURL);
shutdownTest();
}
}, AddonManager.UPDATE_WHEN_USER_REQUESTED);
});
}

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

@ -37,7 +37,7 @@
*/
// Disables security checking our updates which haven't been signed
gPrefs.setBoolPref("extensions.checkUpdateSecurity", false);
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
do_load_httpd_js();
var server;
@ -45,56 +45,45 @@ var server;
// nsIAddonUpdateCheckListener implementation
var updateListener = {
_count: 0,
onUpdateStarted: function onUpdateStarted()
{
onUpdateAvailable: function onAddonUpdateEnded(aAddon, aInstall) {
do_check_eq(aInstall.version, 10);
},
onUpdateEnded: function onUpdateEnded()
{
do_check_eq(this._count, 2);
server.stop(do_test_finished);
onNoUpdateAvailable: function onNoUpdateAvailable(aAddon) {
do_throw("Expected an available update for " + aAddon.id);
},
onAddonUpdateStarted: function onAddonUpdateStarted(aAddon)
{
onUpdateFinished: function onUpdateFinished() {
if (++this._count == 2)
server.stop(do_test_finished);
},
onAddonUpdateEnded: function onAddonUpdateEnded(aAddon, aStatus)
{
this._count++;
do_check_eq(aStatus, Components.interfaces.nsIAddonUpdateCheckListener.STATUS_UPDATE);
do_check_eq(aAddon.version, 10);
}
}
function run_test()
{
// Setup for test
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
startupEM();
gEM.installItemFromFile(do_get_addon("test_bug394300_1"), NS_INSTALL_LOCATION_APPPROFILE);
gEM.installItemFromFile(do_get_addon("test_bug394300_2"), NS_INSTALL_LOCATION_APPPROFILE);
restartEM();
var updates = [
gEM.getItemForID("bug394300_1@tests.mozilla.org"),
gEM.getItemForID("bug394300_2@tests.mozilla.org")
];
do_check_neq(updates[0], null);
do_check_neq(updates[1], null);
server = new nsHttpServer();
server.registerDirectory("/", do_get_file("data"));
server.start(4444);
do_test_pending();
gEM.update(updates, updates.length,
Components.interfaces.nsIExtensionManager.UPDATE_CHECK_NEWVERSION,
updateListener);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
startupManager();
installAllFiles([do_get_addon("test_bug394300_1"),
do_get_addon("test_bug394300_2")], function() {
restartManager();
AddonManager.getAddons(["bug394300_1@tests.mozilla.org",
"bug394300_2@tests.mozilla.org"], function(updates) {
do_check_neq(updates[0], null);
do_check_neq(updates[1], null);
server = new nsHttpServer();
server.registerDirectory("/", do_get_file("data"));
server.start(4444);
updates[0].findUpdates(updateListener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
updates[1].findUpdates(updateListener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
});
});
}

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

@ -45,65 +45,106 @@ const ID = "bug397778@tests.mozilla.org";
function run_test()
{
// Setup for test
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1");
gPrefs.setBoolPref(PREF_MATCH_OS_LOCALE, false);
gPrefs.setCharPref(PREF_SELECTED_LOCALE, "fr-FR");
Services.prefs.setBoolPref(PREF_MATCH_OS_LOCALE, false);
Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "fr-FR");
// Install test add-on
startupEM();
gEM.installItemFromFile(do_get_addon(ADDON), NS_INSTALL_LOCATION_APPPROFILE);
var addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.name, "fr Name");
restartEM();
startupManager();
installAllFiles([do_get_addon(ADDON)], function() {
restartManager();
addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.name, "fr Name");
do_check_eq(getManifestProperty(ID, "description"), "fr Description");
// Disable item
gEM.disableItem(ID);
restartEM();
addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.name, "fr Name");
run_test_1();
});
}
function run_test_1() {
AddonManager.getAddon(ID, function(addon) {
do_check_neq(addon, null);
do_check_eq(addon.name, "fr Name");
do_check_eq(addon.description, "fr Description");
// Disable item
addon.userDisabled = true;
restartManager();
AddonManager.getAddon(ID, function(newAddon) {
do_check_neq(newAddon, null);
do_check_eq(newAddon.name, "fr Name");
run_test_2();
});
});
}
function run_test_2() {
// Change locale. The more specific de-DE is the best match
gPrefs.setCharPref(PREF_SELECTED_LOCALE, "de");
addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.name, "de-DE Name");
do_check_eq(getManifestProperty(ID, "description"), "");
Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "de");
restartManager();
AddonManager.getAddon(ID, function(addon) {
do_check_neq(addon, null);
do_check_eq(addon.name, "de-DE Name");
do_check_eq(addon.description, null);
run_test_3();
});
}
function run_test_3() {
// Change locale. Locale case should have no effect
gPrefs.setCharPref(PREF_SELECTED_LOCALE, "DE-de");
addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.name, "de-DE Name");
do_check_eq(getManifestProperty(ID, "description"), "");
Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "DE-de");
restartManager();
AddonManager.getAddon(ID, function(addon) {
do_check_neq(addon, null);
do_check_eq(addon.name, "de-DE Name");
do_check_eq(addon.description, null);
run_test_4();
});
}
function run_test_4() {
// Change locale. es-ES should closely match
gPrefs.setCharPref(PREF_SELECTED_LOCALE, "es-AR");
addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.name, "es-ES Name");
do_check_eq(getManifestProperty(ID, "description"), "es-ES Description");
Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "es-AR");
restartManager();
AddonManager.getAddon(ID, function(addon) {
do_check_neq(addon, null);
do_check_eq(addon.name, "es-ES Name");
do_check_eq(addon.description, "es-ES Description");
run_test_5();
});
}
function run_test_5() {
// Change locale. Either zh-CN or zh-TW could match
gPrefs.setCharPref(PREF_SELECTED_LOCALE, "zh");
addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
if (addon.name != "zh-TW Name" && addon.name != "zh-CN Name")
do_throw("zh matched to " + addon.name);
Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "zh");
restartManager();
AddonManager.getAddon(ID, function(addon) {
do_check_neq(addon, null);
if (addon.name != "zh-TW Name" && addon.name != "zh-CN Name")
do_throw("zh matched to " + addon.name);
run_test_6();
});
}
function run_test_6() {
// Unknown locale should try to match against en-US as well. Of en,en-GB
// en should match as being less specific
gPrefs.setCharPref(PREF_SELECTED_LOCALE, "nl-NL");
addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.name, "en Name");
do_check_eq(getManifestProperty(ID, "description"), "en Description");
shutdownEM();
Services.prefs.setCharPref(PREF_SELECTED_LOCALE, "nl-NL");
restartManager();
AddonManager.getAddon(ID, function(addon) {
do_check_neq(addon, null);
do_check_eq(addon.name, "en Name");
do_check_eq(addon.description, "en Description");
do_test_finished();
});
}

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

@ -42,20 +42,19 @@ const ID = "bug425657@tests.mozilla.org";
function run_test()
{
// Setup for test
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1");
// Install test add-on
startupEM();
gEM.installItemFromFile(do_get_addon(ADDON), NS_INSTALL_LOCATION_APPPROFILE);
var addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.name, "Deutsches W\u00f6rterbuch");
restartEM();
startupManager();
installAllFiles([do_get_addon(ADDON)], function() {
restartManager();
AddonManager.getAddon(ID, function(addon) {
do_check_neq(addon, null);
do_check_eq(addon.name, "Deutsches W\u00f6rterbuch");
do_check_eq(addon.name.length, 20);
addon = gEM.getItemForID(ID);
do_check_neq(addon, null);
do_check_eq(addon.name, "Deutsches W\u00f6rterbuch");
do_check_eq(addon.name.length, 20);
shutdownEM();
do_test_finished();
});
});
}

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

@ -152,12 +152,12 @@ function run_test() {
do_test_pending();
// This should have no effect as the blocklist is disabled
gPrefs.setCharPref(PREF_BLOCKLIST_URL, "http://localhost:4444/1");
gPrefs.setBoolPref(PREF_BLOCKLIST_ENABLED, false);
Services.prefs.setCharPref(PREF_BLOCKLIST_URL, "http://localhost:4444/1");
Services.prefs.setBoolPref(PREF_BLOCKLIST_ENABLED, false);
timerService.fireTimer(BLOCKLIST_TIMER);
// Some values have to be on the default branch to work
var defaults = gPrefs.QueryInterface(Components.interfaces.nsIPrefService)
var defaults = Services.prefs.QueryInterface(Components.interfaces.nsIPrefService)
.getDefaultBranch(null);
defaults.setCharPref(PREF_APP_UPDATE_CHANNEL, "updatechannel");
defaults.setCharPref(PREF_APP_DISTRIBUTION, "distribution");
@ -165,10 +165,10 @@ function run_test() {
defaults.setCharPref(PREF_GENERAL_USERAGENT_LOCALE, "locale");
// This should correctly escape everything
gPrefs.setCharPref(PREF_BLOCKLIST_URL, "http://localhost:4444/2?" +
Services.prefs.setCharPref(PREF_BLOCKLIST_URL, "http://localhost:4444/2?" +
"%APP_ID%&%APP_VERSION%&%PRODUCT%&%VERSION%&%BUILD_ID%&" +
"%BUILD_TARGET%&%LOCALE%&%CHANNEL%&" +
"%OS_VERSION%&%PLATFORM_VERSION%&%DISTRIBUTION%&%DISTRIBUTION_VERSION%");
gPrefs.setBoolPref(PREF_BLOCKLIST_ENABLED, true);
Services.prefs.setBoolPref(PREF_BLOCKLIST_ENABLED, true);
timerService.fireTimer(BLOCKLIST_TIMER);
}

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

@ -55,8 +55,8 @@ var dirProvider2 = {
throw Components.results.NS_ERROR_NO_INTERFACE;
}
};
gDirSvc.QueryInterface(Components.interfaces.nsIDirectoryService)
.registerProvider(dirProvider2);
Services.dirsvc.QueryInterface(Components.interfaces.nsIDirectoryService)
.registerProvider(dirProvider2);
function run_test()
{
@ -67,6 +67,6 @@ function run_test()
// Setup for test
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1");
startupEM();
startupManager();
do_check_false(log.exists());
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше