Closed Bug 344523 Opened 18 years ago Closed 18 years ago

AddSearchProvider doesn't check if provider already installed

Categories

(Firefox :: Search, defect)

2.0 Branch
defect
Not set
normal

Tracking

()

VERIFIED FIXED
Firefox 2 beta2

People

(Reporter: john.p.baker, Assigned: Gavin)

References

()

Details

(Keywords: fixed1.8.1, late-l10n)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1b1) Gecko/20060710 Firefox/2.0b1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1b1) Gecko/20060710 Firefox/2.0b1

The Javascript window.external.AddSearchProvider doesn't check if
the provider is already installed.

Reproducible: Always

Steps to Reproduce:
1. Go to http://www.bristol.ac.uk/search/
2. click on "Add this Provider to Search Box"
3. click again on "Add this Provider to Search Box"

Actual Results:  
Get second prompt "Add a new engine ..."
If confirm adds a second file to searchplugins folder

Expected Results:  
Information that search engine already installed.

cf IE7 beta 3
Something that came to me while composing this bug, and have just tried...

In addition if you remove one of these multiple engines, and then restart
Firefox the 'removed' entry will appear to reappear [actually one of the
other copies will take its place]
(In reply to comment #1)
> In addition if you remove one of these multiple engines, and then restart
> Firefox the 'removed' entry will appear to reappear [actually one of the
> other copies will take its place]

Yes, that's because the engine is there, it just won't load because you can't load multiple engines with the same name.

How does IE determine whether an engine is already installed? Does it keep track of which site you added the engine from? Or does it just rely on the name?
(In reply to comment #2)
> How does IE determine whether an engine is already installed? Does it keep
> track of which site you added the engine from? Or does it just rely on the
> name?

It seems to use the ShortName - which is also the one that appears in the
AddSearchProvider dialogue box (Firefox doesn't include this).

This makes some sort of sense as it is the ShortName that stops the engine
appearing, on the drop down, more than once.
(In reply to comment #3)

> It seems to use the ShortName

Cancel this. It, at least, uses both the ShortName and the URL as it will
give the option to replace the old one if the URL changes - or even add
a second provider with the same name (it qualifies the second one with the
site that it was installed from eg |(www.bris.ac.uk) Bristol Uni.|
(In reply to comment #3)
> It seems to use the ShortName - which is also the one that appears in the
> AddSearchProvider dialogue box (Firefox doesn't include this).

It does now that bug 341668 is fixed (for beta 2) :)

(In reply to comment #4)
> Cancel this. It, at least, uses both the ShortName and the URL as it will
> give the option to replace the old one if the URL changes - or even add
> a second provider with the same name (it qualifies the second one with the
> site that it was installed from eg |(www.bris.ac.uk) Bristol Uni.|

Thanks for looking into this. We should definitely throw an error, at the very least, instead of silently failing.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking-firefox2?
OS: Windows 2000 → All
Hardware: PC → All
Target Milestone: --- → Firefox 2 beta2
Version: unspecified → 2.0 Branch
This just ensures that we don't silently fail, and that we don't leave engines that won't load in the profile. We should definitely improve this dialog to do smart replacing and allow renaming (once the renaming patch lands), but I don't think that's something that can be done in the Firefox 2 timeframe (it would involve a lot of string additions, at the very least).
Assignee: nobody → gavin.sharp
Status: NEW → ASSIGNED
Attachment #229674 - Flags: review?(mconnor)
Whiteboard: [patch-r?]
Flags: blocking-firefox2? → blocking-firefox2+
Comment on attachment 229674 [details] [diff] [review]
throw an error if the engine is already installed

nit:

if (foo)
  bar;

should have a newline after it
Attachment #229674 - Flags: review?(mconnor) → review+
Whiteboard: [patch-r?] → [checkin needed]
mozilla/browser/locales/en-US/chrome/browser/search.properties 	1.14
mozilla/browser/components/search/nsSearchService.js 	1.61
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: [checkin needed] → [need-a]
Comment on attachment 229674 [details] [diff] [review]
throw an error if the engine is already installed

This is another "don't fail silently and leave junk files in the user's profile dir" bug, and carries a low risk of regression. It adds one localizable string.
Attachment #229674 - Flags: approval1.8.1?
Comment on attachment 229674 [details] [diff] [review]
throw an error if the engine is already installed

a=drivers. Please land on the MOZILLA_1_8_BRANCH.
Attachment #229674 - Flags: approval1.8.1? → approval1.8.1+
Whiteboard: [need-a] → [checkin needed (1.8 branch)]
mozilla/browser/components/search/nsSearchService.js 	1.1.2.49
mozilla/browser/locales/en-US/chrome/browser/search.properties 	1.1.2.11
Keywords: fixed1.8.1
Whiteboard: [checkin needed (1.8 branch)]
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: