Bug 547543 - Trim whitespace on feed and feeditem titles. Also fix subscribe dialog link click. r=dbienvenu
authoralta88 <alta88@gmail.com>
Thu, 08 Mar 2012 08:37:02 -0700
changeset 11037 4c3e576941e834028da42718e6b69193fb553716
parent 11036 1e20849945982526299106832cfb78028d4ca385
child 11038 714c2c71f32367b79f6190a15179a18291325750
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbienvenu
bugs547543
Bug 547543 - Trim whitespace on feed and feeditem titles. Also fix subscribe dialog link click. r=dbienvenu
mailnews/extensions/newsblog/content/Feed.js
mailnews/extensions/newsblog/content/FeedItem.js
mailnews/extensions/newsblog/content/feed-subscriptions.js
--- a/mailnews/extensions/newsblog/content/Feed.js
+++ b/mailnews/extensions/newsblog/content/Feed.js
@@ -123,17 +123,18 @@ Feed.prototype =
 
     // Make sure the feed name doesn't have any line breaks, since we're going
     // to use it as the name of the folder in the filesystem.  This may not
     // be necessary, since Mozilla's mail code seems to handle other forbidden
     // characters in filenames and can probably handle these as well.
     name = name.replace(/[\n\r\t]+/g, " ");
 
     // Make sure the feed doesn't end in a period to work around bug 117840.
-    name = name.replace(/\.+$/, "");
+    // Remove leading/trailing spaces for bug 547543.
+    name = name.replace(/\.+$/, "").trim();
 
     return name;
   },
 
   download: function(aParseItems, aCallback) 
   { 
     this.downloadCallback = aCallback; // may be null 
 
--- a/mailnews/extensions/newsblog/content/FeedItem.js
+++ b/mailnews/extensions/newsblog/content/FeedItem.js
@@ -335,18 +335,20 @@ FeedItem.prototype =
     var title = this.title;
 
     // the subject may contain HTML entities.
     // Convert these to their unencoded state. i.e. &amp; becomes '&'
     title = Components.classes["@mozilla.org/feed-unescapehtml;1"]
                       .getService(Components.interfaces.nsIScriptableUnescapeHTML)
                       .unescape(title);
 
-    // Compress white space in the subject to make it look better.
-    title = title.replace(/[\t\r\n]+/g, " ");
+    // Compress white space in the subject to make it look better.  Trim
+    // leading/trailing spaces to prevent mbox header folding issue at just
+    // the right subject length.
+    title = title.replace(/[\t\r\n]+/g, " ").trim();
 
     this.title = this.mimeEncodeSubject(title, this.characterSet);
 
     // If the date looks like it's in W3C-DTF format, convert it into
     // an IETF standard date.  Otherwise assume it's in IETF format.
     if (this.mDate.search(/^\d\d\d\d/) != -1)
       this.mDate = new Date(this.mDate).toUTCString();
 
--- a/mailnews/extensions/newsblog/content/feed-subscriptions.js
+++ b/mailnews/extensions/newsblog/content/feed-subscriptions.js
@@ -892,17 +892,17 @@ var gFeedSubscriptionsWindow = {
     document.getElementById("removeFeed").disabled = disable;
     document.getElementById("editFeed").disabled = disable;
     document.getElementById("importOPML").disabled = !item || !isServer;
     document.getElementById("exportOPML").disabled = !item || !isServer;
   },
 
   onMouseDown: function (aEvent)
   {
-    if (aEvent.button != 0)
+    if (aEvent.button != 0 || aEvent.target.id == "validationText")
       return;
 
     this.clearStatusInfo();
   },
 
   setSummaryFocus: function ()
   {
     let item = this.mView.currentItem;