Bug 735998 - HTML entities in the latest tweet should be decoded before it is used as the topic of the timeline conversation, r=clokep.
authorFlorian Quèze <florian@queze.net>
Thu, 14 Jun 2012 16:03:54 +0200
changeset 10429 f00ab2e3c12d62cd6f759db0505dad0dd70c7a89
parent 10428 abcc437cc1f7e97581048ae094bb614b62136c5a
child 10430 47f05f31d03a4c2f538ee1a61be7f502d8e110fd
push id7890
push userflorian@queze.net
push dateThu, 14 Jun 2012 14:11:04 +0000
treeherdercomm-central@6be9b667699d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersclokep
bugs735998
Bug 735998 - HTML entities in the latest tweet should be decoded before it is used as the topic of the timeline conversation, r=clokep.
chat/protocols/twitter/twitter.js
--- a/chat/protocols/twitter/twitter.js
+++ b/chat/protocols/twitter/twitter.js
@@ -312,16 +312,22 @@ Conversation.prototype = {
     if (hasOwnProperty(this._participants, aNick))
       return;
 
     let chatBuddy = new ChatBuddy(aNick);
     this._participants[aNick] = chatBuddy;
     this.notifyObservers(new nsSimpleEnumerator([chatBuddy]),
                          "chat-buddy-add");
   },
+  setTopic: function(aTopic, aTopicSetter) {
+    const kEntities = {amp: "&", gt: ">", lt: "<"};
+    let topic =
+      aTopic.replace(/&([gl]t|amp);/g, function(str, entity) kEntities[entity]);
+    GenericConvChatPrototype.setTopic.call(this, topic, aTopicSetter);
+  },
   get name() this.nick + " timeline",
   get title() _("timeline", this.nick),
   get nick() "@" + this._account.name
 };
 
 function Account(aProtocol, aImAccount)
 {
   this._init(aProtocol, aImAccount);