Bug 957881 - Get rid of recommended addons code. r=bnicholson
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Fri, 10 Jan 2014 17:18:14 -0800
changeset 162980 5ae12ca85cdc5821d4c5fe54c88e26e8de8927dc
parent 162979 e6fc7735a592c666ccf6fa47e93d055d6f81d663
child 162981 69a6c6c99c85ea48fcf1fb371e1f80b24acc7b49
push id25977
push userttaubert@mozilla.com
push dateSun, 12 Jan 2014 09:26:17 +0000
treeherdermozilla-central@b029e8d3e130 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs957881
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 957881 - Get rid of recommended addons code. r=bnicholson
mobile/android/app/Makefile.in
mobile/android/app/recommended-addons.json
mobile/android/components/AddonUpdateService.js
mobile/android/installer/package-manifest.in
toolkit/mozapps/installer/packager.mk
--- a/mobile/android/app/Makefile.in
+++ b/mobile/android/app/Makefile.in
@@ -1,16 +1,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 dist_dest = $(DIST)/$(APP_NAME).app
 
 PREF_JS_EXPORTS = $(srcdir)/mobile.js
-DIST_FILES = recommended-addons.json
 
 ifndef LIBXUL_SDK
 ifneq (Android,$(OS_TARGET))
 
 LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
 LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base
 LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/build
 LOCAL_INCLUDES += -I$(DEPTH)/build
deleted file mode 100644
--- a/mobile/android/app/recommended-addons.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-    "addons": [{
-        "id": "fullscreen@mbrubeck.limpet.net",
-        "name": "Full Screen",
-        "version": "3.4",
-        "iconURL": "https://addons.cdn.mozilla.net/img/uploads/addon_icons/252/252573-32.png?modified=1354183977",
-        "learnmoreURL": "https://addons.mozilla.org/en-US/android/addon/full-screen-252573/?src=api"
-    }, {
-        "id": "cloudviewer@starkravingfinkle.org",
-        "name": "Cloud Viewer",
-        "version": "2.1",
-        "iconURL": "https://addons.cdn.mozilla.net/img/uploads/addon_icons/295/295895-32.png?modified=1353947644",
-        "learnmoreURL": "https://addons.mozilla.org/en-US/android/addon/cloud-viewer/?src=api"
-    }]
-}
--- a/mobile/android/components/AddonUpdateService.js
+++ b/mobile/android/components/AddonUpdateService.js
@@ -63,18 +63,16 @@ AddonUpdateService.prototype = {
           data.data = JSON.stringify({ id: aAddon.id, name: aAddon.name });
           Services.obs.notifyObservers(data, "addon-update-started", null);
 
           let listener = new UpdateCheckListener();
           aAddon.findUpdates(listener, reason);
         }
       });
     });
-
-    RecommendedSearchResults.search();
   }
 };
 
 // -----------------------------------------------------------------------
 // Add-on update listener. Starts a download for any add-on with a viable
 // update waiting
 // -----------------------------------------------------------------------
 
@@ -108,76 +106,10 @@ UpdateCheckListener.prototype = {
 
     if (aError)
       this._status = "error";
 
     Services.obs.notifyObservers(data, "addon-update-ended", this._status);
   }
 };
 
-// -----------------------------------------------------------------------
-// RecommendedSearchResults fetches add-on data and saves it to a cache
-// -----------------------------------------------------------------------
-
-var RecommendedSearchResults = {
-  _getFile: function() {
-    let dirService = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
-    let file = dirService.get("ProfD", Ci.nsILocalFile);
-    file.append("recommended-addons.json");
-    return file;
-  },
-
-  _writeFile: function (aFile, aData) {
-    if (!aData)
-      return;
-
-    // Asynchronously copy the data to the file.
-    let array = new TextEncoder().encode(aData);
-    OS.File.writeAtomic(aFile.path, array, { tmpPath: aFile.path + ".tmp" }).then(function onSuccess() {
-      Services.obs.notifyObservers(null, "recommended-addons-cache-updated", "");
-    });
-  },
-  
-  searchSucceeded: function(aAddons, aAddonCount, aTotalResults) {
-    let self = this;
-
-    // Filter addons already installed
-    AddonManager.getAllAddons(function(aAllAddons) {
-      let addons = aAddons.filter(function(addon) {
-        for (let i = 0; i < aAllAddons.length; i++)
-          if (addon.id == aAllAddons[i].id)
-            return false;
-
-        return true;
-      });
-
-      let json = {
-        addons: []
-      };
-
-      addons.forEach(function(aAddon) {
-        json.addons.push({
-          id: aAddon.id,
-          name: aAddon.name,
-          version: aAddon.version,
-          learnmoreURL: aAddon.learnmoreURL,
-          iconURL: aAddon.iconURL
-        })
-      });
-
-      let file = self._getFile();
-      self._writeFile(file, JSON.stringify(json));
-    });
-  },
-  
-  searchFailed: function searchFailed() { },
-  
-  search: function() {
-    const kAddonsMaxDisplay = 2;
-
-    if (AddonRepository.isSearching)
-      AddonRepository.cancelSearch();
-    AddonRepository.retrieveRecommendedAddons(kAddonsMaxDisplay, RecommendedSearchResults);
-  }
-}
-
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AddonUpdateService]);
 
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -82,17 +82,16 @@
 
 @BINPATH@/AndroidManifest.xml
 @BINPATH@/resources.arsc
 @BINPATH@/package-name.txt
 @BINPATH@/classes.dex
 @BINPATH@/res/drawable
 @BINPATH@/res/drawable-hdpi
 @BINPATH@/res/layout
-@BINPATH@/recommended-addons.json
 @BINPATH@/distribution/*
 
 [browser]
 ; [Base Browser Files]
 #ifndef XP_UNIX
 @BINPATH@/@MOZ_APP_NAME@.exe
 #else
 @BINPATH@/@MOZ_APP_NAME@-bin
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -332,17 +332,16 @@ DIST_FILES += \
   package-name.txt \
   platform.ini \
   greprefs.js \
   browserconfig.properties \
   blocklist.xml \
   chrome.manifest \
   update.locale \
   removed-files \
-  recommended-addons.json \
   distribution \
   $(NULL)
 
 NON_DIST_FILES = \
   classes.dex \
   $(NULL)
 
 UPLOAD_EXTRA_FILES += gecko-unsigned-unaligned.apk