зеркало из https://github.com/mozilla/gecko-dev.git
Bug 713815 - Addons with compatibility overrides are still able to be installed. r=dtownsend
--HG-- extra : rebase_source : 535a75a745b3e1b9b9ccb5013f77b889d7283867
This commit is contained in:
Родитель
36c8b73fe5
Коммит
eabc3b3481
|
@ -6148,6 +6148,7 @@ AddonInstall.prototype = {
|
|||
if (aRepoAddon) {
|
||||
aAddon._repositoryAddon = aRepoAddon;
|
||||
aAddon.compatibilityOverrides = aRepoAddon.compatibilityOverrides;
|
||||
aAddon.appDisabled = !isUsableAddon(aAddon);
|
||||
aCallback();
|
||||
return;
|
||||
}
|
||||
|
@ -6159,6 +6160,7 @@ AddonInstall.prototype = {
|
|||
aAddon.compatibilityOverrides = aRepoAddon ?
|
||||
aRepoAddon.compatibilityOverrides :
|
||||
null;
|
||||
aAddon.appDisabled = !isUsableAddon(aAddon);
|
||||
aCallback();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- An extension that has a compatibility override making it incompatible. -->
|
||||
<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>addon6@tests.mozilla.org</em:id>
|
||||
<em:version>1.0</em:version>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>Addon Test 6</em:name>
|
||||
<em:description>Test Description</em:description>
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>xpcshell@tests.mozilla.org</em:id>
|
||||
<em:minVersion>1</em:minVersion>
|
||||
<em:maxVersion>1</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
</Description>
|
||||
</RDF>
|
|
@ -31,4 +31,23 @@
|
|||
<compatible_os>ALL</compatible_os>
|
||||
<install size="2">http://example.com/browser/toolkit/mozapps/extensions/test/browser/addons/browser_install1_2.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon_compatibility hosted="false">
|
||||
<guid>addon6@tests.mozilla.org</guid>
|
||||
<name>Addon Test 6</name>
|
||||
<version_ranges>
|
||||
<version_range type="incompatible">
|
||||
<min_version>1.0</min_version>
|
||||
<max_version>1.0</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<min_version>1.0</min_version>
|
||||
<max_version>1.0</max_version>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
</version_ranges>
|
||||
</addon_compatibility>
|
||||
</searchresults>
|
||||
|
|
|
@ -1678,7 +1678,52 @@ function check_test_28(install) {
|
|||
function finish_test_28(install) {
|
||||
prepare_test({}, [
|
||||
"onDownloadCancelled"
|
||||
], do_test_finished);
|
||||
], run_test_29);
|
||||
|
||||
install.cancel();
|
||||
}
|
||||
|
||||
// Tests that an install with a matching compatibility override has appDisabled
|
||||
// set correctly.
|
||||
function run_test_29() {
|
||||
Services.prefs.setBoolPref("extensions.getAddons.cache.enabled", true);
|
||||
|
||||
prepare_test({ }, [
|
||||
"onNewInstall"
|
||||
]);
|
||||
|
||||
let url = "http://localhost:4444/addons/test_install6.xpi";
|
||||
AddonManager.getInstallForURL(url, function(install) {
|
||||
ensure_test_completed();
|
||||
|
||||
do_check_neq(install, null);
|
||||
do_check_eq(install.version, "1.0");
|
||||
do_check_eq(install.name, "Addon Test 6");
|
||||
do_check_eq(install.state, AddonManager.STATE_AVAILABLE);
|
||||
|
||||
AddonManager.getInstallsByTypes(null, function(activeInstalls) {
|
||||
do_check_eq(activeInstalls.length, 1);
|
||||
do_check_eq(activeInstalls[0], install);
|
||||
|
||||
prepare_test({}, [
|
||||
"onDownloadStarted",
|
||||
"onDownloadEnded"
|
||||
], check_test_29);
|
||||
install.install();
|
||||
});
|
||||
}, "application/x-xpinstall", null, "Addon Test 6", null, "1.0");
|
||||
}
|
||||
|
||||
function check_test_29(install) {
|
||||
//ensure_test_completed();
|
||||
do_check_eq(install.state, AddonManager.STATE_DOWNLOADED);
|
||||
do_check_neq(install.addon, null);
|
||||
do_check_false(install.addon.isCompatible);
|
||||
do_check_true(install.addon.appDisabled);
|
||||
|
||||
prepare_test({}, [
|
||||
"onDownloadCancelled"
|
||||
], do_test_finished);
|
||||
install.cancel();
|
||||
return false;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче