Closed Bug 571547 Opened 14 years ago Closed 13 years ago

HTML in add-on summary/descriptions

Categories

(addons.mozilla.org Graveyard :: Public Pages, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: tchung, Unassigned)

References

()

Details

(Whiteboard: [AddonsRewriteTestday])

Attachments

(1 file)

When installing the themes on firefoxcup site, the descriptions aren't being rendered properly in the new addons manager.

See screenshot

Repro:
1) install nightly build: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.3a6pre) Gecko/20100611 Minefield/3.7a6pre
2) install a firefox cup theme from the URL
3) open addons manager, and verify descriptions aren't rendered

Expected:
- descriptions rendered properly
Status: UNCONFIRMED → NEW
Ever confirmed: true
As far as Dave mentioned on IRC we don't wanna do that due to possible security holes.

It is also present in older builds like Firefox 3.6 inside the about addon dialog. So it's not a regression.
OS: Mac OS X → All
Hardware: x86 → All
Summary: Addons Manager isn't rendering simple text in theme descriptions → Addons Manager isn't rendering html content in theme descriptions
Whiteboard: [AddonsRewriteTestday][AddonsRewrite] → [AddonsRewriteTestday]
Version: Trunk → 1.9.2 Branch
The bug is that the Firefox cup personas shouldn't contain html in their descriptions.
Component: Add-ons Manager → Public Pages
Product: Toolkit → addons.mozilla.org
QA Contact: add-ons.manager → web-ui
Summary: Addons Manager isn't rendering html content in theme descriptions → Firefox Cup personas should not contain html in their descriptions
Version: 1.9.2 Branch → unspecified
Mossop: AMO allows links in add-on summaries and limited HTML in descriptions.  Is that a problem for the add-ons manager?
Summary: Firefox Cup personas should not contain html in their descriptions → HTML in add-on summary/descriptions
(In reply to comment #3)
> Mossop: AMO allows links in add-on summaries and limited HTML in descriptions. 
> Is that a problem for the add-ons manager?

There are two different bugs here. This bug was originally about how html was included in the persona install object. Another bug is that the API is returning html in the description fields, the add-ons manager has never supported that.
It would be nice if the Add-ons Manager would strip out the stuff it doesn't like so that we don't have to limit the information provided through our API for all its consumers, but I suppose we can default to stripping HTML unless some flag is passed.

The release notes service should still provide HTML but I don't think that's part of the API.
(In reply to comment #5)
> It would be nice if the Add-ons Manager would strip out the stuff it doesn't
> like so that we don't have to limit the information provided through our API
> for all its consumers, but I suppose we can default to stripping HTML unless
> some flag is passed.

This isn't good.  The consumer should be modifying data if it needs modified.
True, but we also changed the way the API works by allowing HTML. I don't think it's the Add-ons Manager's job to make all the input it gets pretty. If people want to throw in HTML or XML or bbcode they can, but it doesn't mean it should have to recognize all that and strip it out. Since we are the ones that started allowing that for our purposes, I think this is our bug, not theirs.
(In reply to comment #6)
> (In reply to comment #5)
> > It would be nice if the Add-ons Manager would strip out the stuff it doesn't
> > like so that we don't have to limit the information provided through our API
> > for all its consumers, but I suppose we can default to stripping HTML unless
> > some flag is passed.
> 
> This isn't good.  The consumer should be modifying data if it needs modified.

In general I agree, but we never have done it this way around for the life of the API, nor do we have code immediately available in the client right now to be able to do this easily but I understand that AMO does.
(In reply to comment #7)
> True, but we also changed the way the API works by allowing HTML. I don't think
> it's the Add-ons Manager's job to make all the input it gets pretty. If people
> want to throw in HTML or XML or bbcode they can, but it doesn't mean it should
> have to recognize all that and strip it out. Since we are the ones that started
> allowing that for our purposes, I think this is our bug, not theirs.

We're going to have different flags to strip out html, xml, or bbcode?  If people put it in, we send it out.  We shouldn't care if bbcode shows up in the API or the add-on manager.

> In general I agree, but we never have done it this way around for the life of
> the API, nor do we have code immediately available in the client right now to
> be able to do this easily but I understand that AMO does.

How much work is it to change on your end?  I wouldn't call it "easy" on our end either, and if it takes a little extra time to do it right, I'd rather do that.
(In reply to comment #9)
> > In general I agree, but we never have done it this way around for the life of
> > the API, nor do we have code immediately available in the client right now to
> > be able to do this easily but I understand that AMO does.
> 
> How much work is it to change on your end?  I wouldn't call it "easy" on our
> end either, and if it takes a little extra time to do it right, I'd rather do
> that.

I guess it depends what level you want to go to. Stripping out anything between < and > characters is pretty simple. Actually rendering the html is extremely difficult. A middle ground of trying to do something sane with the html tags is also difficult. Ironically we don't have any sane way to parse html fragments in the client so we'd have to find some code that does that, that has a good license and that we can trust and integrate it into the API handling code.
I have talked to Ben Bucksch and he mentioned the nsPlainTextSerializer class, which could be used to transform HTML content into plain text. Here is an example test:

http://mxr.mozilla.org/mozilla-central/source/content/base/test/TestPlainTextSerializer.cpp

Would that help us?
Wil Clouser, whether a field contains plaintext or HTML or bbcode or XML is very much part of its definition. You need to nail that down, otherwise the consumer can't properly process it (how is it to know whether it's plaintext or bbcode or HTML?).
If the field used to return plaintext, you need to continue to return plaintext.

You can also define it as HTML - then the client has the problem of processing it. Apparently that is a problem here, so chose well. Either way, if you define as plaintext or HTML, it won't be bbcode, then.

whimboo asked me. There is a HTML to TXT converter in Gecko - it's called nsPlainTextSerializer. It's used both for Thunderbird mail send as well as copy&paste in Firefox. You could use it, but its use is not entirely trivial.
You can see its use in
http://mxr.mozilla.org/comm-central/source/mozilla/parser/htmlparser/tests/outsinks/Convert.cpp#111 (function HTML2text())
I don't know of any JS user in the tree, off-hand.
(In reply to comment #11)
> I have talked to Ben Bucksch and he mentioned the nsPlainTextSerializer class,
> which could be used to transform HTML content into plain text. Here is an
> example test:
> 
> http://mxr.mozilla.org/mozilla-central/source/content/base/test/TestPlainTextSerializer.cpp
> 
> Would that help us?

Huh, not come across this before. It looks like we might be able to construct something useful out of it though on the surface it may not be easy since it looks like it can't be accessed from JavaScript.
I've filed bug 595280 to make the current add-ons manager able to cope with this, however it's unlikely to be something that we backport so I suggest API versions < 1.5 should strip the HTML out appropriately.
(In reply to comment #15)
> I've filed bug 595280 to make the current add-ons manager able to cope with
> this, however it's unlikely to be something that we backport so I suggest API
> versions < 1.5 should strip the HTML out appropriately.

Filed bug 595339.
See Also: → 595339
The two bugs mentioned in comments 15 and 16 are closed, so....I guess this is fixed?
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: