[Pkg-mozext-commits] [personasplus] 17/42: Don't DDOS AMO with favorites requests on Firefox 20.

David Prévot taffit at moszumanska.debian.org
Wed Feb 3 16:15:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository personasplus.

commit 73547a73414733b664261df1b35b18a4607cb846
Author: Kris Maglione <maglione.k at gmail.com>
Date:   Fri Mar 29 12:08:44 2013 -0700

    Don't DDOS AMO with favorites requests on Firefox 20.
---
 extension/locale/en-US/preferences.dtd |  2 +-
 extension/modules/service.js           | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/extension/locale/en-US/preferences.dtd b/extension/locale/en-US/preferences.dtd
index 2a6c5f6..73f6cee 100644
--- a/extension/locale/en-US/preferences.dtd
+++ b/extension/locale/en-US/preferences.dtd
@@ -5,4 +5,4 @@
 <!ENTITY useTextColor.label     "Use text color">
 <!ENTITY useAccentColor.label   "Use accent color">
 <!ENTITY advancedSettings.label "Advanced">
-<!ENTITY showCustomMenu.label   "Show Custom Persona in menu">
+<!ENTITY showCustomMenu.label   "Enable custom personas">
diff --git a/extension/modules/service.js b/extension/modules/service.js
index 9503885..5ac4e04 100644
--- a/extension/modules/service.js
+++ b/extension/modules/service.js
@@ -428,7 +428,7 @@ let PersonaService = {
   onFavoritesLoadComplete : function(aEvent) {
     let request = aEvent.target;
 
-    if (request.status != 200) {
+    if (request.status != 200 || request.getResponseHeader("Content-Type") != "application/json") {
       this._log.info("problem loading favorites from " + request.channel.name + ": " + request.status + " - " + request.statusText);
       this.favorites = null;
       return;
@@ -439,7 +439,7 @@ let PersonaService = {
         .addons.filter(function (a) a.theme);
     }
     catch(ex) {
-      Cu.reportError("error parsing favorites data");
+      this._log.debug("error parsing favorites data: " + request.responseText.slice(0, 100) + "...");
       return;
     }
 
@@ -1220,10 +1220,13 @@ let PersonaService = {
    * cookie, then the favorites are refreshed (if the user is signed in).
    * @param aCookie The cookie that has been added, changed or removed.
    */
-  onCookieChanged : function(aCookie) {
+  onCookieChanged : function(aCookie, aChange) {
     if (aCookie instanceof Ci.nsICookie) {
       if (aCookie.name == "sessionid" && (aCookie.host == this.addonsHost ||
                                           aCookie.host == "." + this.addonsHost)) {
+        if (aCookie.value == this._cookieValue)
+          return;
+        this._cookieValue = aCookie.value;
         this.refreshFavorites();
       }
     }
@@ -1232,6 +1235,7 @@ let PersonaService = {
         this.onCookieChanged(enum_.getNext());
     }
   },
+  _cookieValue: null,
 
   onQuitApplication: function() {
     Observers.remove("quit-application", this.onQuitApplication, this);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/personasplus.git



More information about the Pkg-mozext-commits mailing list