Backed out changeset d0b03b763e5b (bug 702920)

This commit is contained in:
Tim Taubert 2012-01-19 12:04:23 +01:00
parent 996335a8e2
commit d3cd2f00e8
9 changed files with 4 additions and 166 deletions

View File

@ -640,6 +640,9 @@ var AddonManagerInternal = {
gStrictCompatibility = STRICT_COMPATIBILITY_DEFAULT;
}
// XXXunf Currently, this won't notify listeners that an addon's
// compatibility status has changed if the addon's appDisabled state
// doesn't change.
if (gStrictCompatibility != oldValue)
this.updateAddonAppDisabledStates();

View File

@ -3758,10 +3758,6 @@ var XPIProvider = {
let wasDisabled = isAddonDisabled(aAddon);
let isDisabled = aUserDisabled || aSoftDisabled || appDisabled;
// If appDisabled changes but the result of isAddonDisabled() doesn't,
// no onDisabling/onEnabling is sent - so send a onPropertyChanged.
let appDisabledChanged = aAddon.appDisabled != appDisabled;
// Update the properties in the database
XPIDatabase.setAddonProperties(aAddon, {
userDisabled: aUserDisabled,
@ -3769,12 +3765,6 @@ var XPIProvider = {
softDisabled: aSoftDisabled
});
if (appDisabledChanged) {
AddonManagerPrivate.callAddonListeners("onPropertyChanged",
aAddon,
["appDisabled"]);
}
// If the add-on is not visible or the add-on is not changing state then
// there is no need to do anything else
if (!aAddon.visible || (wasDisabled == isDisabled))

View File

@ -3032,9 +3032,6 @@ var gDetailView = {
let hideFindUpdates = AddonManager.shouldAutoUpdate(this._addon);
document.getElementById("detail-findUpdates-btn").hidden = hideFindUpdates;
}
if (aProperties.indexOf("appDisabled") != -1)
this.updateState();
},
onExternalInstall: function(aAddon, aExistingAddon, aNeedsRestart) {

View File

@ -1524,14 +1524,6 @@
]]></body>
</method>
<method name="onPropertyChanged">
<parameter name="aProperties"/>
<body><![CDATA[
if (aProperties.indexOf("appDisabled") != -1)
this._updateState();
]]></body>
</method>
<method name="onNoUpdateAvailable">
<body><![CDATA[
this._showStatus("none");

View File

@ -734,29 +734,3 @@ add_test(function() {
run_next_test();
});
});
// Check that onPropertyChanges for appDisabled updates the UI
add_test(function() {
info("Checking that onPropertyChanges for appDisabled updates the UI");
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(aAddon) {
aAddon.userDisabled = true;
aAddon.isCompatible = true;
aAddon.appDisabled = false;
open_details("addon1@tests.mozilla.org", "extension", function() {
is(get("detail-view").getAttribute("active"), "false", "Addon should not be marked as active");
is_element_hidden(get("detail-warning"), "Warning message should not be visible");
info("Making addon incompatible and appDisabled");
aAddon.isCompatible = false;
aAddon.appDisabled = true;
is(get("detail-view").getAttribute("active"), "false", "Addon should not be marked as active");
is_element_visible(get("detail-warning"), "Warning message should be visible");
is(get("detail-warning").textContent, "Test add-on replacement is incompatible with " + gApp + " " + gVersion + ".", "Warning message should be correct");
run_next_test();
});
});
});

View File

@ -679,32 +679,3 @@ add_test(function() {
});
});
});
// Check that onPropertyChanges for appDisabled updates the UI
add_test(function() {
info("Checking that onPropertyChanges for appDisabled updates the UI");
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(aAddon) {
aAddon.userDisabled = true;
aAddon.isCompatible = true;
aAddon.appDisabled = false;
gManagerWindow.loadView("addons://list/extension");
wait_for_view_load(gManagerWindow, function() {
var el = get_addon_element(gManagerWindow, "addon2@tests.mozilla.org");
is(el.getAttribute("active"), "false", "Addon should not be marked as active");
is_element_hidden(get_node(el, "warning"), "Warning message should not be visible");
info("Making addon incompatible and appDisabled");
aAddon.isCompatible = false;
aAddon.appDisabled = true;
is(el.getAttribute("active"), "false", "Addon should not be marked as active");
is_element_visible(get_node(el, "warning"), "Warning message should be visible");
is(get_node(el, "warning").textContent, "Test add-on 2 is incompatible with " + gApp + " " + gVersion + ".", "Warning message should be correct");
run_next_test();
});
});
});

View File

@ -667,10 +667,6 @@ MockProvider.prototype = {
addon._applyBackgroundUpdates = aAddonProp[prop];
continue;
}
if (prop == "appDisabled") {
addon._appDisabled = aAddonProp[prop];
continue;
}
addon[prop] = aAddonProp[prop];
}
if (!addon.optionsType && !!addon.optionsURL)
@ -947,7 +943,7 @@ function MockAddon(aId, aName, aType, aOperationsRequiringRestart) {
this.isCompatible = true;
this.providesUpdatesSecurely = true;
this.blocklistState = 0;
this._appDisabled = false;
this.appDisabled = false;
this._userDisabled = false;
this._applyBackgroundUpdates = AddonManager.AUTOUPDATE_ENABLE;
this.scope = AddonManager.SCOPE_PROFILE;
@ -970,24 +966,6 @@ MockAddon.prototype = {
return !this.appDisabled && !this._userDisabled;
},
get appDisabled() {
return this._appDisabled;
},
set appDisabled(val) {
if (val == this._appDisabled)
return val;
AddonManagerPrivate.callAddonListeners("onPropertyChanged", this, ["appDisabled"]);
var currentActive = this.shouldBeActive;
this._appDisabled = val;
var newActive = this.shouldBeActive;
this._updateActiveState(currentActive, newActive);
return val;
},
get userDisabled() {
return this._userDisabled;
},

View File

@ -1,66 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const profileDir = gProfD.clone();
profileDir.append("extensions");
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
writeInstallRDFForExtension({
id: "addon1@tests.mozilla.org",
version: "1.0",
name: "Test 1",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "0.1",
maxVersion: "0.2"
}]
}, profileDir);
startupManager();
AddonManager.strictCompatibility = false;
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(aAddon) {
do_check_neq(aAddon, null);
aAddon.userDisabled = true;
restartManager();
run_test_1();
});
}
function run_test_1() {
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(aAddon) {
do_check_neq(aAddon, null);
do_check_true(aAddon.userDisabled);
do_check_false(aAddon.isActive);
do_check_false(aAddon.appDisabled);
prepare_test({
"addon1@tests.mozilla.org": [
["onPropertyChanged", ["appDisabled"]]
]
}, [], run_test_2);
AddonManager.strictCompatibility = true;
});
}
function run_test_2() {
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(aAddon) {
do_check_neq(aAddon, null);
do_check_true(aAddon.userDisabled);
do_check_false(aAddon.isActive);
do_check_true(aAddon.appDisabled);
prepare_test({
"addon1@tests.mozilla.org": [
["onPropertyChanged", ["appDisabled"]]
]
}, [], do_test_finished);
AddonManager.strictCompatibility = false;
});
}

View File

@ -179,7 +179,6 @@ skip-if = os == "android"
[test_migrate4.js]
[test_migrate5.js]
[test_migrateAddonRepository.js]
[test_onPropertyChanged_appDisabled.js]
[test_permissions.js]
[test_plugins.js]
# Bug 676992: test consistently fails on Android