Bug 1340312: Stop passing installed add-ons data to discovery pane. r?aswan
MozReview-Commit-ID: Ej8gglwFFTp
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -2179,61 +2179,31 @@ var gDiscoverView = {
compatMode = "ignore";
else if (AddonManager.strictCompatibility)
compatMode = "strict";
var url = Services.prefs.getCharPref(PREF_DISCOVERURL);
url = url.replace("%COMPATIBILITY_MODE%", compatMode);
url = Services.urlFormatter.formatURL(url);
- let setURL = (aURL) => {
- try {
- this.homepageURL = Services.io.newURI(aURL);
- } catch (e) {
- this.showError();
- notifyInitialized();
- return;
- }
-
- this._browser.homePage = this.homepageURL.spec;
- this._browser.addProgressListener(this);
-
- if (this.loaded)
- this._loadURL(this.homepageURL.spec, false, notifyInitialized);
- else
- notifyInitialized();
- }
-
- if (Services.prefs.getBoolPref(PREF_GETADDONS_CACHE_ENABLED) == false) {
- setURL(url);
+ try {
+ this.homepageURL = Services.io.newURI(url);
+ } catch (e) {
+ this.showError();
+ notifyInitialized();
return;
}
- gPendingInitializations++;
- AddonManager.getAllAddons(function(aAddons) {
- var list = {};
- for (let addon of aAddons) {
- var prefName = PREF_GETADDONS_CACHE_ID_ENABLED.replace("%ID%",
- addon.id);
- try {
- if (!Services.prefs.getBoolPref(prefName))
- continue;
- } catch (e) { }
- list[addon.id] = {
- name: addon.name,
- version: addon.version,
- type: addon.type,
- userDisabled: addon.userDisabled,
- isCompatible: addon.isCompatible,
- isBlocklisted: addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED
- }
- }
-
- setURL(url + "#" + JSON.stringify(list));
- });
+ this._browser.homePage = this.homepageURL.spec;
+ this._browser.addProgressListener(this);
+
+ if (this.loaded)
+ this._loadURL(this.homepageURL.spec, false, notifyInitialized);
+ else
+ notifyInitialized();
},
destroy() {
try {
this._browser.removeProgressListener(this);
} catch (e) {
// Ignore the case when the listener wasn't already registered
}
--- a/toolkit/mozapps/extensions/test/browser/browser_discovery.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_discovery.js
@@ -97,62 +97,18 @@ function getHash(aBrowser) {
var pos = url.indexOf("#");
if (pos != -1)
return decodeURIComponent(url.substring(pos + 1));
return null;
}
function testHash(aBrowser, aTestAddonVisible, aCallback) {
var hash = getHash(aBrowser);
- isnot(hash, null, "There should be a hash");
- try {
- var data = JSON.parse(hash);
- } catch (e) {
- ok(false, "Hash should have been valid JSON: " + e);
- aCallback();
- return;
- }
- is(typeof data, "object", "Hash should be a JS object");
-
- // Ensure that at least the test add-ons are present
- if (aTestAddonVisible[0])
- ok("addon1@tests.mozilla.org" in data, "Test add-on 1 should be listed");
- else
- ok(!("addon1@tests.mozilla.org" in data), "Test add-on 1 should not be listed");
- if (aTestAddonVisible[1])
- ok("addon2@tests.mozilla.org" in data, "Test add-on 2 should be listed");
- else
- ok(!("addon2@tests.mozilla.org" in data), "Test add-on 2 should not be listed");
- if (aTestAddonVisible[2])
- ok("addon3@tests.mozilla.org" in data, "Test add-on 3 should be listed");
- else
- ok(!("addon3@tests.mozilla.org" in data), "Test add-on 3 should not be listed");
-
- // Test against all the add-ons the manager knows about since plugins and
- // app extensions may exist
- AddonManager.getAllAddons(function(aAddons) {
- for (let addon of aAddons) {
- if (!(addon.id in data)) {
- // Test add-ons will have shown an error if necessary above
- if (addon.id.substring(6) != "@tests.mozilla.org")
- ok(false, "Add-on " + addon.id + " was not included in the data");
- continue;
- }
-
- info("Testing data for add-on " + addon.id);
- var addonData = data[addon.id];
- is(addonData.name, addon.name, "Name should be correct");
- is(addonData.version, addon.version, "Version should be correct");
- is(addonData.type, addon.type, "Type should be correct");
- is(addonData.userDisabled, addon.userDisabled, "userDisabled should be correct");
- is(addonData.isBlocklisted, addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED, "blocklisted should be correct");
- is(addonData.isCompatible, addon.isCompatible, "isCompatible should be correct");
- }
- aCallback();
- });
+ is(hash, null, "There shouldn't be a hash");
+ aCallback();
}
function isLoading() {
var loading = gManagerWindow.document.getElementById("discover-view").selectedPanel ==
gManagerWindow.document.getElementById("discover-loading");
if (loading) {
is_element_visible(gManagerWindow.document.querySelector("#discover-loading .loading"),
"Loading message should be visible when its panel is the selected panel");