Closed Bug 1637744 Opened 5 years ago Closed 4 years ago

Review SearchService.getEngineParams, move into SearchEngine

Categories

(Firefox :: Search, task, P3)

task
Points:
5

Tracking

()

RESOLVED FIXED
Firefox 80
Iteration:
80.1 - June 29 - July 12
Tracking Status
firefox80 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(3 files, 3 obsolete files)

SearchService.getEngineParams is currently listed on the idl although it is not used outside the search service:

https://searchfox.org/mozilla-central/search?q=getEngineParams&path=&case=false&regexp=false

We should definitely make it non-public.

Additionally, we should review its uses. AFAICT it is only ever used before a call to SearchEngine._initFromMetadata or SearchEngine._updateFromMetadata.

The function of getEngineParams is to take the a WebExtension's search engine details and translate them into a different format for the *FromMetadata functions.

I think we should just merge getEngineParams across into _initFromMetadata and avoid the overhead and complication of the extra translation.

Depends on: 1642300
Assignee: nobody → standard8
Iteration: --- → 79.2 - June 15 - June 28
Depends on: 1647359

The clones appear to be so that access for the tree view in preferences is quick. However, they don't need to clone the entire engine object - they just need three fields.

Additionally, this fixes reloading icons which was attempting to use 'uri' but that isn't defined, and so icons would fail to load if preferences was opened when a search engine is added.

Depends on D80472

Depends on D80496

Comment on attachment 9158245 [details]
Bug 1637744 - Preferences should only clone the parts of the search engine objects that it actually needs. r?jaws!

Revision D80496 was moved to bug 1647359. Setting attachment 9158245 [details] to obsolete.

Attachment #9158245 - Attachment is obsolete: true

Comment on attachment 9158246 [details]
Bug 1637744 - Change definitions in SearchEngine to be classes. r?daleharvey!

Revision D80497 was moved to bug 1647359. Setting attachment 9158246 [details] to obsolete.

Attachment #9158246 - Attachment is obsolete: true

Comment on attachment 9158247 [details]
Bug 1637744 - Move SearchEngine fields to start of class for better clarity and documentation. r?daleharvey!

Revision D80498 was moved to bug 1647359. Setting attachment 9158247 [details] to obsolete.

Attachment #9158247 - Attachment is obsolete: true
Iteration: 79.2 - June 15 - June 28 → 80.1 - June 29 - July 12
Points: 3 → 5
Blocks: 1649186
Depends on: 1649426
Blocks: 1650756

The main aim here is to move the call to getEngineParams that currently happens before addEngineWithDetails. This is moved into addEngineWithDetails, so that it is next to where the search engine is actually created. This gets ready for the next step which will be to merge getEngineParams with the SearchEngine initWithMetadata and associated calls.

The side effects are that we need a specific function for policy engines to use, and that we now have only tests using addEngineWithDetails.

These cover some gaps in coverage for the existing getEngineParams.

Depends on D82348

Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4a3af68e0ae1 Create a new function for adding search engines, and a separate function for policy engines. r=daleharvey https://hg.mozilla.org/integration/autoland/rev/3a9439b6ba13 Add more tests to cover various search engine parameter options. r=daleharvey https://hg.mozilla.org/integration/autoland/rev/a9a5f77ddc68 Merge getEngineParams into functions in SearchEngine. r=daleharvey
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 80
Regressions: 1730218
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: