Add APIs to manage search engines for the web search bar/location bar

NEW
Assigned to

Status

()

Toolkit
WebExtensions: Frontend
P3
normal
a year ago
2 days ago

People

(Reporter: YUKI "Piro" Hiroshi, Assigned: kev)

Tracking

(Blocks: 3 bugs)

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox49 affected)

Details

(Whiteboard: triaged)

(Reporter)

Description

a year ago
For enterprise use, needless default search engines are expected to be disabled, and sometimes custom search engines are needed to be installed by default. Currently we need to control search engines via nsIBrowserSearchService from an addon to do it. After WebExtensions, I need something to alter the feature.

Of course, non-WebExtensions solution (new secret preferences to do it, or new configuration entries in distribution.ini) will also help me.
Blocks: 720362

Updated

a year ago
Whiteboard: [design-decision-needed]triaged
(Reporter)

Comment 1

a year ago
I think the API can be appear like APIs to control tabs, like:

chrome.searchengines.query() // list search engines
chrome.searchengines.get() // get one engine
chrome.searchengines.install() // add new search engine
chrome.searchengines.create() // add new search engine from scratch without XML file - I think this will help us to generate search engines with different parameters easily (for example, different trees in dxr.mozilla.org)
Blocks: 1215059
Summary: Add APIs to manage search engines in the web search bar/location bar → Add APIs to manage search engines for the web search bar/location bar

Updated

10 months ago
Component: WebExtensions: Untriaged → WebExtensions: Frontend
Priority: -- → P3
I tried to port https://addons.mozilla.org/en-US/firefox/addon/add-to-search-bar/ to a WebExtension but this bug is a blocker for it.

Comment 3

8 months ago
Hello, my Search Buttons Bar extension requires API to query user's Search engines. As a WebExtension I didn't find any working solutions to achieve it. I'm currently using the nsIBrowserSearchService.

https://addons.mozilla.org/addon/searchbuttonsbar/

Updated

8 months ago
Flags: needinfo?(kev)
To be discussed at Dec. 13, 2016 WE triage meeting. 

Agenda: https://docs.google.com/document/d/1S1QrBK1hrulE7dlLiQzjMupHUUSwDYRYAOXiqtMHe-k/edit#
(Assignee)

Comment 5

8 months ago
I don't see this as a high priority currently, but agree search services need review, and should include the search team. Search is frequently targeted by browser hijackers, and the policy around search needs to be reviewed, updated, and surfaced in the product. Off the top I don't see querying and/or using existing search services to present challenges, but there do need to be better user controls in place for any kind of modification outside that. This may also be impacted by work on platform, search, front-end, and other components, and it makes sense to get more input.

I'll add this to my backlog, and will try to get a rough proposal out before the holidays start in earnest.
Flags: needinfo?(kev)

Comment 6

8 months ago
As Qwant partnering closely with Mozilla, we are looking for this bug to move forward. Our current extension is not compatible with Electrolysis and this bug is missing for us to migrate our extension to WebExtensions. Any chance to prioritize this as high ?

Updated

8 months ago
webextensions: --- → ?

Updated

6 months ago
Assignee: nobody → kev

Comment 7

6 months ago
I drafted something here: https://gist.github.com/nt1m/cad0b5afb35785d051785a51a4f6cf98

Updated

5 months ago
Duplicate of this bug: 1276817

Comment 9

5 months ago
I there, I also require a WebExtensions API to access the browser's search engines (I use nsIBrowserSearchService currently), so this would make it possible to port my add-on. I'm the developer of Swift Selection Search:
https://addons.mozilla.org/en-US/firefox/addon/swift-selection-search
Could it be possible to add the ability to clear the search bar text on the API ?

Comment 11

5 months ago
Shouldn't 

chrome.searchengines.setDefault() // set one engine as default

be part of the API

Comment 12

5 months ago
(In reply to Tobias Mueller from comment #11)
> Shouldn't 
> 
> chrome.searchengines.setDefault() // set one engine as default
> 
> be part of the API

There's Bug 1301315 for this.

Comment 13

5 months ago
(In reply to Tim Nguyen :ntim from comment #12)
> There's Bug 1301315 for this.
Afaik this bug handles setting via manifest file only.
What about if an extension wants manage search engines? Or provide a setting to change the default?
(In reply to Tobias Mueller from comment #13)
> Or provide a setting to change the default?

Is the UI in the Firefox preferences not enough to set the default? I don't expect users to need to change their default engines frequently.
(Assignee)

Comment 15

5 months ago
The UI in Firefox makes it very simple for the user to change defaults. At this time, we don't plan on adding the capability to set the search default via an extension with the WebExtensions API. 


(In reply to Tobias Mueller from comment #13)
> (In reply to Tim Nguyen :ntim from comment #12)
> > There's Bug 1301315 for this.
> Afaik this bug handles setting via manifest file only.
> What about if an extension wants manage search engines? Or provide a setting
> to change the default?
Will there be an API to get all the details (icon, prefix URL and search engine name) for the current (default) search engine?
(Assignee)

Comment 17

5 months ago
See bug 1301315 for query details. 

(In reply to Geoffrey De Belie (Smile4ever) from comment #16)
> Will there be an API to get all the details (icon, prefix URL and search
> engine name) for the current (default) search engine?

Updated

5 months ago
webextensions: ? → ---
Getting the default search engine would help with an extension wishing to cleanly assign the search provider itself in it's own container, as per: https://github.com/mozilla/testpilot-containers/issues/434

Updated

3 months ago
Whiteboard: [design-decision-needed]triaged → triaged

Updated

3 months ago
See Also: → bug 1352598

Updated

18 days ago
Blocks: 1311472
I'm totally new to developing ffx extensions and I wanted to create a web extension that uses the search engines from the search bar. I encountered a lot of trouble trying stuff from the MDN only to finally discover that you can't import nsIBrowserSearchService when using the WebExtensions API. I'm surprised to see that this has been a pending issue for a year now despite being very blocking for many extension developers. Can somebody please explain what is holding back firefox developers from unblocking the situation? Is the issue technical or political? I've been a encouraging donator for the further development of firefox, but this is a bit disappointing!
(In reply to Olivier de Broqueville from comment #19)
> I'm totally new to developing ffx extensions and I wanted to create a web
> extension that uses the search engines from the search bar. 

I think you want bug 1352598.

>Can somebody please explain what is holding back firefox developers from unblocking the situation?

Changing the search engines (unlike just querying them, see the linked bug) is controversial because changing the default search engine is one of the most common hijacking attacks against browsers.
(In reply to Gian-Carlo Pascutto [:gcp] from comment #20)
> Changing the search engines (unlike just querying them, see the linked bug)
> is controversial because changing the default search engine is one of the
> most common hijacking attacks against browsers.

Thank you for your explanation, Gian-Carlo. Personally, I'm not looking for a way to modify the default search engine. I wanted to create a contextual search extension, which integrates with Firefox's search bar. Right-clicking on selected text in a web page would present a user with a contextual menu listing all the search engines he or she uses in the search bar. Unfortunately, with WebExtensions, I currently have no way of reading the list of search engines available in the search bar. For the mean time, I've resorted to creating a pre-specified list of search engines a user has to choose from, but I understand some users would preferably define their own search engines.
You need to log in before you can comment on or make changes to this bug.