Closed Bug 562765 Opened 14 years ago Closed 14 years ago

Searching for add-ons doesn't show results when there is no description set for an add-on

Categories

(Toolkit :: Add-ons Manager, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla1.9.3a5

People

(Reporter: whimboo, Assigned: robert.strong.bugs)

References

Details

(Whiteboard: [rewrite])

Attachments

(1 file, 1 obsolete file)

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.3a5pre) Gecko/20100427 Minefield/3.7a5pre

If you start a search in the top bar for add-on types other than extensions no result is returned. We should support searching for all kinds of add-ons.
Er, can you double check this? It's never been restricted to just extensions. I just tested by searching for flash and got the Flash plugin as a result.
When I search for flash (it is installed) I get no results and the following in the error console
Warning: WARN addons.manager: Exception calling callback: TypeError: aStr is null
btw: if I search for an installed extension it does display in the results but I see that same error. Searching for a plugin or a theme has so far failed each time. I have also seen the following in the error console
Warning: reference to undefined property aTheme[prop]
Source File: file:///C:/Program%20Files%20(x86)/Minefield/modules/LightweightThemeManager.jsm
Line: 398
(In reply to comment #3)
> btw: if I search for an installed extension it does display in the results but
> I see that same error. Searching for a plugin or a theme has so far failed each
> time. I have also seen the following in the error console
> Warning: reference to undefined property aTheme[prop]
> Source File:
> file:///C:/Program%20Files%20(x86)/Minefield/modules/LightweightThemeManager.jsm
> Line: 398

Filed bug 562848 for this - which will fix that warning, but may also fix this bug too.
That isn't the cause :(
This appears to be caused by extensions that don't have a description.
(In reply to comment #6)
> This appears to be caused by extensions that don't have a description.

Yea, that was my thinking. As in, the description property is null or undefined - right? I'd consider that an API bug, since description isn't an optional property.
The following returns null
function getRDFValue(aLiteral) {
  if (aLiteral instanceof Ci.nsIRDFLiteral)
    return aLiteral.Value;
  if (aLiteral instanceof Ci.nsIRDFResource)
    return aLiteral.Value;
  if (aLiteral instanceof Ci.nsIRDFInt)
    return aLiteral.Value;
  return null;
}

and causes this since there is no description in the install.rdf... previously the code returned undefined.
I suspect description should be made optional (extensions have been doing this since there were ) should be handled in the same way this type of extension was created) and it should be handled in the same way as a missing homepageURL which I see is handled properly and is part of this same group in XPIProvider.jsm.
(In reply to comment #9)
> I suspect description should be made optional (extensions have been doing this
> since there were )
since there were this type of extension
(In reply to comment #9)
> I suspect description should be made optional

To me, optional means a provider doesn't have to implement it for its Addon objects (because of either technical restrictions, or it just doesn't make sense to implement it for a given addon type). But in this case, its implemented, but there's just lack of data - so an empty string should be supplied.
What if it is an optional integer or some other type? I personally think optional properties within a provider should return that the property doesn't exist (e.g. null). It looks like this is already handled when the homepageURL doesn't exist and could be handled in the same way.
Attached patch patch rev1 (obsolete) (deleted) — Splinter Review
Assignee: nobody → robert.bugzilla
Status: NEW → ASSIGNED
Attachment #442623 - Flags: review?(bmcbride)
Comment on attachment 442623 [details] [diff] [review]
patch rev1

also fixes bug 562848... when a light weight theme doesn't have a description it returns undefined and ends up with undefined as the description.

Blair, I pretty strongly think that the backend shouldn't return an empty string for an optional property that doesn't exist... are you ok with this?
Attachment #442623 - Flags: review?(dtownsend)
btw: I could more easily split out the properties... kind of late.
Comment on attachment 442623 [details] [diff] [review]
patch rev1

going to fix this up
Attachment #442623 - Attachment is obsolete: true
Attachment #442623 - Flags: review?(dtownsend)
Attachment #442623 - Flags: review?(bmcbride)
Attached patch patch rev2 (deleted) — Splinter Review
Attachment #442626 - Flags: review?(bmcbride)
Attachment #442626 - Flags: review?(dtownsend)
Summary: Searching for add-ons should support all types of add-ons → Searching for add-ons doesn't show results when there is no description set for an add-on
Priority: -- → P1
Attachment #442626 - Flags: review?(bmcbride) → review+
(In reply to comment #11)
> (In reply to comment #9)
> > I suspect description should be made optional
> 
> To me, optional means a provider doesn't have to implement it for its Addon
> objects (because of either technical restrictions, or it just doesn't make
> sense to implement it for a given addon type). But in this case, its
> implemented, but there's just lack of data - so an empty string should be
> supplied.

To me an optional property is one where either the provider need not implement it at all (and so it is not defined on the Addon instance) or the property's value may be null (or I suppose undefined too). In this case I think it was a mistake to say that description is a required property since we have never required that extensions have one so this looks like the correct fix to me.
Attachment #442626 - Flags: review?(dtownsend)
(In reply to comment #14)
> Blair, I pretty strongly think that the backend shouldn't return an empty
> string for an optional property that doesn't exist... are you ok with this?

For optional properties, yes that makes sense. And making description an optional property (comment 18) also sounds good. If description were to stay a required property and possibly be null/undefined, then I'd be uncomfortable.
In regards to providers, I think it would be a "good thing" to standardize whether a provider should return null or undefined for a value that isn't present and to throw when a required value the value isn't present which I believe it already.
http://hg.mozilla.org/projects/addonsmgr/rev/44975b9df5b1

(In reply to comment #20)
> In regards to providers, I think it would be a "good thing" to standardize
> whether a provider should return null or undefined for a value that isn't
> present and to throw when a required value the value isn't present which I
> believe it already.

Agreed. Though, I don't think any of the providers currently throw in that case (its unfortunate that its up to the provider to ensure that).
Whiteboard: [rewrite] → [rewrite][fixed-in-addonsmgr]
Whiteboard: [rewrite][fixed-in-addonsmgr] → [rewrite][fixed-in-addonsmgr][needs-landing]
http://hg.mozilla.org/mozilla-central/rev/42101b017a4b
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Whiteboard: [rewrite][fixed-in-addonsmgr][needs-landing] → [rewrite]
Target Milestone: --- → mozilla1.9.3a5
Verified fixed with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.3a5pre) Gecko/20100517 Minefield/3.7a5pre (.NET CLR 3.5.30729) ID:20100517035949

Can we do something here with automated tests regarding the missing availability of different types of add-ons on the testing machines. I think a Litmus test is a must have.
Status: RESOLVED → VERIFIED
Flags: in-testsuite?
Flags: in-litmus?
It's likely difficult to cover this specific case with an automated test, Blair what do you think?
(In reply to comment #24)
> It's likely difficult to cover this specific case with an automated test, Blair
> what do you think?

Agreed.
Flags: in-testsuite? → in-testsuite-
When we are talking about the description, which one is causing this problem?  The one under <em:name>, right? Dave, when I would create a sample XPI, is there a way to make that extension compatible with any future version of Firefox? Setting maxVersion to something like 100 or is there a better approach?
You could use Clean Fox or any persona that is missing a description and combine this with the litmus test for bug 562848. With Clean Fox it will not show up in the search results for "Clean" without this fix and will with this fix.
(In reply to comment #26)
> When we are talking about the description, which one is causing this problem? 
> The one under <em:name>, right? Dave, when I would create a sample XPI, is
> there a way to make that extension compatible with any future version of
> Firefox? Setting maxVersion to something like 100 or is there a better
> approach?

The one in <em:description> was the problem here.
Want to try automating this after all.
Flags: in-testsuite- → in-testsuite?
Verified fixed with Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.3a6pre) Gecko/20100611 Minefield/3.7a6pre

Thanks Blair, I will unflag in-litmus for now. If you can't automate it, I will add a Mozmill test instead.
Flags: in-litmus? → in-litmus-
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: