Closed Bug 1559530 Opened 5 years ago Closed 4 years ago

Remove or refactor reInit

Categories

(Firefox :: Search, task, P3)

65 Branch
task
Points:
5

Tracking

()

RESOLVED FIXED
82 Branch
Iteration:
82.1 - Aug 24 - Sep 6
Tracking Status
firefox82 --- fixed

People

(Reporter: mixedpuppy, Assigned: standard8)

References

Details

Attachments

(3 files)

In bug 1556789 I fixed search.init to return the actual promise that is resolved/rejected during initialization. This fixed the ability to actually use then/catch on the promise.

reInit is a funky thing, but it can be fixed. Basically the primary item that is introduces is flushing the cache file. It then replicates search.reset and search.init.

reInit should become an async, returning a Promise in the IDL. It should then simply flush the cache, call reset, then return Init. This will reduce code duplication and make it possible to get rid of a bunch of observer code used to detect when reinit is done.

I'd actually consider adding a flush param to reset and have reset flush the cache. Then tests should call reset and init.

The priority flag is not set for this bug.
:daleharvey, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(dharvey)
Type: defect → enhancement
Flags: needinfo?(dharvey)
Priority: -- → P3
Depends on: 1612824

With the work currently ongoing to tidy up the search service, we'd are thinking about either removing or refactoring reInit. It has crept into production code, but really it shouldn't be necessary - we should be able to handle changes of configuration correctly, even if it is a big change.

If a test really needs to clean the search service out, then we should reconsider what we're actually testing, and why, and see if there's an alternative - if we really need to, then create a new search service object.

Severity: normal → N/A
Type: enhancement → task
Points: --- → 8
No longer depends on: 1556789
Summary: reInit needs refactoring → Remove or refactor reInit
Assignee: nobody → standard8
Iteration: --- → 82.1 - Aug 24 - Sep 6

test_json_cache_broken.js is a nicer test that doesn't need reInit and tests more, so remove the older test_require_engines_in_cache.js.

Depends on D88274

Depends on D88276

Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/38832c1185b8 Remove test_require_engines_in_cache.js as it is testing the same as test_json_cache_broken.js. r=daleharvey https://hg.mozilla.org/integration/autoland/rev/82a8305543e5 When changing the separatePrivateDefault preference, also reset the sort order. r=daleharvey https://hg.mozilla.org/integration/autoland/rev/84ab4021d403 Remove nsISearchService.reInit. r=daleharvey
Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/48c95b737c1b Remove test_require_engines_in_cache.js as it is testing the same as test_json_cache_broken.js. r=daleharvey https://hg.mozilla.org/integration/autoland/rev/36fdfab5156a When changing the separatePrivateDefault preference, also reset the sort order. r=daleharvey https://hg.mozilla.org/integration/autoland/rev/7101ff70c61f Remove nsISearchService.reInit. r=daleharvey
Points: 8 → 5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: