diff --git a/toolkit/mozapps/extensions/AddonRepository.jsm b/toolkit/mozapps/extensions/AddonRepository.jsm
index f63d0c37fe95..b3cd5e8b6ea1 100644
--- a/toolkit/mozapps/extensions/AddonRepository.jsm
+++ b/toolkit/mozapps/extensions/AddonRepository.jsm
@@ -91,15 +91,20 @@ const PROP_MULTI = ["developers", "screenshots"]
const STRING_KEY_MAP = {
name: "name",
version: "version",
- summary: "description",
- description: "fullDescription",
- developer_comments: "developerComments",
- eula: "eula",
icon: "iconURL",
homepage: "homepageURL",
support: "supportURL"
};
+// A map between XML keys to AddonSearchResult keys for string values
+// that require parsing from HTML
+const HTML_KEY_MAP = {
+ summary: "description",
+ description: "fullDescription",
+ developer_comments: "developerComments",
+ eula: "eula"
+};
+
// A map between XML keys to AddonSearchResult keys for integer values
// that require no extra parsing from XML
const INTEGER_KEY_MAP = {
@@ -109,6 +114,23 @@ const INTEGER_KEY_MAP = {
};
+function convertHTMLToPlainText(html) {
+ var converter = Cc["@mozilla.org/widget/htmlformatconverter;1"].
+ createInstance(Ci.nsIFormatConverter);
+
+ var input = Cc["@mozilla.org/supports-string;1"].
+ createInstance(Ci.nsISupportsString);
+ input.data = html.replace("\n", "
", "g");
+
+ var output = {};
+ converter.convert("text/html", input, input.data.length, "text/unicode",
+ output, {});
+
+ if (output.value instanceof Ci.nsISupportsString)
+ return output.value.data;
+ return html;
+}
+
function AddonSearchResult(aId) {
this.id = aId;
}
@@ -787,6 +809,12 @@ var AddonRepository = {
continue;
}
+ // Handle case where the wanted string value is html located in text content
+ if (localName in HTML_KEY_MAP) {
+ addon[HTML_KEY_MAP[localName]] = convertHTMLToPlainText(this._getTextContent(node));
+ continue;
+ }
+
// Handle case where the wanted integer value is located in text content
if (localName in INTEGER_KEY_MAP) {
let value = parseInt(this._getTextContent(node));
diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/test_AddonRepository.xml b/toolkit/mozapps/extensions/test/xpcshell/data/test_AddonRepository.xml
index 6570631da13a..57e7f3e4092d 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_AddonRepository.xml
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_AddonRepository.xml
@@ -49,9 +49,10 @@
http://localhost:4444/developer2.html
- Test Summary 2
- Test Description 2
- Test Developer Comments 2
+ <h1>Test Summary 2</h1><p>paragraph</p>
+ Test Description 2<br>newline
+ Test Developer
+ Comments 2
Test EULA 2
http://localhost:4444/icon2.png
Public
@@ -128,7 +129,7 @@
Test Summary 3
- Test Description 3
+ Test Description 3<br><ul><li>List item 1<li>List item 2</ul>
Test Developer Comments 3
Test EULA 3
http://localhost:4444/icon3.png
diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/test_AddonRepository_cache.xml b/toolkit/mozapps/extensions/test/xpcshell/data/test_AddonRepository_cache.xml
index 40fa68664d2b..472e921a506f 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_AddonRepository_cache.xml
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_AddonRepository_cache.xml
@@ -19,10 +19,11 @@
http://localhost:4444/repo/1/secondDeveloper.html
- Repo Add-on 1 - Description
- Repo Add-on 1 - Full Description
+ Repo Add-on 1 - Description<br>Second line
+ <p>Repo Add-on 1 - Full Description & some extra</p>
Repo Add-on 1 - EULA
- Repo Add-on 1 - Developer Comments
+ Repo Add-on 1
+ Developer Comments
http://localhost:4444/repo/1/icon.png
Public
1
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
index cc1fee56d089..e8159e7da0a5 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
@@ -107,9 +107,9 @@ var SEARCH_RESULTS = [{
name: "Test Developer 2",
url: BASE_URL + "/developer2.html"
}],
- description: "Test Summary 2",
- fullDescription: "Test Description 2",
- developerComments: "Test Developer Comments 2",
+ description: "Test Summary 2\n\nparagraph",
+ fullDescription: "Test Description 2\nnewline",
+ developerComments: "Test Developer\nComments 2",
eula: "Test EULA 2",
iconURL: BASE_URL + "/icon2.png",
screenshots: [{
@@ -142,7 +142,7 @@ var SEARCH_RESULTS = [{
url: BASE_URL + "/developer2-3.html"
}],
description: "Test Summary 3",
- fullDescription: "Test Description 3",
+ fullDescription: "Test Description 3\n\n List item 1\n List item 2",
developerComments: "Test Developer Comments 3",
eula: "Test EULA 3",
iconURL: BASE_URL + "/icon3.png",
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache.js b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache.js
index ba84a9f48cca..20c27a236f96 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache.js
@@ -71,9 +71,9 @@ const REPOSITORY_ADDONS = [{
name: "Repo Add-on 1 - Second Developer",
url: BASE_URL + "/repo/1/secondDeveloper.html"
}],
- description: "Repo Add-on 1 - Description",
- fullDescription: "Repo Add-on 1 - Full Description",
- developerComments: "Repo Add-on 1 - Developer Comments",
+ description: "Repo Add-on 1 - Description\nSecond line",
+ fullDescription: "Repo Add-on 1 - Full Description & some extra",
+ developerComments: "Repo Add-on 1\nDeveloper Comments",
eula: "Repo Add-on 1 - EULA",
iconURL: BASE_URL + "/repo/1/icon.png",
homepageURL: BASE_URL + "/repo/1/homepage.html",
@@ -202,8 +202,8 @@ const WITH_CACHE = [{
contributors: [{ name: "XPI Add-on 1 - First Contributor" },
{ name: "XPI Add-on 1 - Second Contributor" }],
description: "XPI Add-on 1 - Description",
- fullDescription: "Repo Add-on 1 - Full Description",
- developerComments: "Repo Add-on 1 - Developer Comments",
+ fullDescription: "Repo Add-on 1 - Full Description & some extra",
+ developerComments: "Repo Add-on 1\nDeveloper Comments",
eula: "Repo Add-on 1 - EULA",
iconURL: BASE_URL + "/xpi/1/icon.png",
homepageURL: BASE_URL + "/xpi/1/homepage.html",
diff --git a/toolkit/themes/gnomestripe/mozapps/extensions/extensions.css b/toolkit/themes/gnomestripe/mozapps/extensions/extensions.css
index 3d0728308cca..81353a50dc8d 100644
--- a/toolkit/themes/gnomestripe/mozapps/extensions/extensions.css
+++ b/toolkit/themes/gnomestripe/mozapps/extensions/extensions.css
@@ -582,6 +582,7 @@
#detail-desc {
-moz-margin-start: 6px;
+ white-space: pre-wrap;
}
#detail-contributions {
diff --git a/toolkit/themes/pinstripe/mozapps/extensions/extensions.css b/toolkit/themes/pinstripe/mozapps/extensions/extensions.css
index b327dcaec136..6b12df45b98f 100644
--- a/toolkit/themes/pinstripe/mozapps/extensions/extensions.css
+++ b/toolkit/themes/pinstripe/mozapps/extensions/extensions.css
@@ -618,6 +618,7 @@
/* This is necessary to fix layout issues with multi-line descriptions, see
bug 592712*/
outline: solid transparent;
+ white-space: pre-wrap;
}
#detail-contributions {
diff --git a/toolkit/themes/winstripe/mozapps/extensions/extensions.css b/toolkit/themes/winstripe/mozapps/extensions/extensions.css
index 521edfb3d3e3..28d802d036f3 100644
--- a/toolkit/themes/winstripe/mozapps/extensions/extensions.css
+++ b/toolkit/themes/winstripe/mozapps/extensions/extensions.css
@@ -599,6 +599,7 @@
#detail-desc {
-moz-margin-start: 6px;
+ white-space: pre-wrap;
}
#detail-contributions {