Closed Bug 709589 Opened 13 years ago Closed 13 years ago

Some engine manager cleanup found by SeaMonkey reviews

Categories

(Firefox :: Search, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 13

People

(Reporter: kairo, Assigned: kairo)

References

Details

Attachments

(6 files, 1 obsolete file)

Splitting off the engine manager parts from bug 643172.
Assignee: nobody → kairo
Attached patch services, v1Splinter Review
Here's the first and probably largest part - Switching engine manager to using Services.jsm, and as it's closely connected, it also removes redundancy in removing the observer, putting it in a common destroy/onunload function, obsoleting the onCancel one.
Attachment #580760 - Flags: review?(gavin.sharp)
Attached patch engine.name, v1Splinter Review
This patch fixes the use of engine.name outside the loop where it's declared with a let. This is a generic bug in current engine manager, as there it currently must end up being undefined, the way I'm reading the code (and Neil agreed with that POV in the SeaMonkey reviews).
Attachment #580762 - Flags: review?(gavin.sharp)
Attached patch observer, v1Splinter Review
Here's a patch for the observer - only "engine-changed" needs to .invalidate() as .rowCountChanged() does the invalidate/update to the tree display anyhow (in an optimized way to only do it for the affected rows), calling .invalidate() there will just be more work with the same effect. This ends up being a slight perf fix. (Also, the "Not relevant" cases also can now exit the function normally, no need to early return there).
Attachment #580764 - Flags: review?(gavin.sharp)
Attached patch _cloneEngine, v1Splinter Review
This patch makes _cloneEngine easier to read and debug (and also makes the object init to be an object and not an array). When I read this function the first time, I had difficulty wrapping my head around what this intermediate variable was, in the patched version it's clear that it's a cloned object. Also, the function name now correlates with the method name it has in EngineStore.
Attachment #580765 - Flags: review?(gavin.sharp)
Attached patch onSelect, v1 (obsolete) — Splinter Review
This patch makes onSelect better readable, also avoiding another intermittent variable and using the nice fact that if we only have one engine left, it's both the first and last one in the list.
Attachment #580766 - Flags: review?(gavin.sharp)
Attached patch onSelect, v1Splinter Review
Actually, this is the correct patch for this (the original comment is correct).
Attachment #580766 - Attachment is obsolete: true
Attachment #580766 - Flags: review?(gavin.sharp)
Attachment #580767 - Flags: review?(gavin.sharp)
Attached patch nits, v1Splinter Review
OK, here's the last patch in this series, consisting of a number of nits - whitespace fixes, superfluous brackets, missing semicolons, superfluous "!important" markers, unneeded spacers, a better understandable button ID - and using the fact that we can use .currentIndex instead of re-calculating the position of the just-selected item another time.
Attachment #580769 - Flags: review?(gavin.sharp)
Attachment #580765 - Flags: review?(gavin.sharp) → review+
Attachment #580767 - Flags: review?(gavin.sharp) → review+
Attachment #580760 - Flags: review?(gavin.sharp) → review+
Attachment #580764 - Flags: review?(gavin.sharp) → review+
Comment on attachment 580762 [details] [diff] [review] engine.name, v1 This fixes the engine duplicate case, but doesn't properly handle the bookmark duplication case (dupName will be ""), so it's necessary but not sufficient. I guess maybe we need to have two different error messages ("used by 'Someengine'" vs. "used by a bookmark.").
Attachment #580762 - Flags: review?(gavin.sharp) → review-
Attachment #580769 - Flags: review?(gavin.sharp) → review+
Before landing, please make sure that all of these changes together don't break the engine manager with manual testing, if you haven't already. Thanks for doing this!
(In reply to Gavin Sharp (use gavin@gavinsharp.com for email) from comment #9) > Before landing, please make sure that all of these changes together don't > break the engine manager with manual testing, if you haven't already. I had done this before and did it again (including adding/resorting/keywording/removing engines) before pushing. I also pushed to try to be extra sure (and found something it doesn't like in the bug 643172 patches, still need to investigate that, but the ones here are fine). > Thanks for doing this! I just hope it will still be helpful, given that work to move the engine management into add-on manager has been picked up again (which is good in its own respect). ;-) http://hg.mozilla.org/integration/mozilla-inbound/rev/84becc09d904 http://hg.mozilla.org/integration/mozilla-inbound/rev/79cb693afd54 http://hg.mozilla.org/integration/mozilla-inbound/rev/3374fe9737a9 http://hg.mozilla.org/integration/mozilla-inbound/rev/c8ed809f6a9d http://hg.mozilla.org/integration/mozilla-inbound/rev/622f1d1e7c52
Let's leave the bug open as one patch didn't get the reviews to land right now. I'll look into that one as soon as I have some time.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: Firefox 12 → ---
Depends on: 719990
Blocks: 728508
Comment on attachment 580762 [details] [diff] [review] engine.name, v1 Reuben pointed out in bug 728508 that I misunderstood this code - there already are two different strings, and the alert prompt uses the right one depending on whether eduplicate is true. So this patch is fine!
Attachment #580762 - Flags: review- → review+
(sorry about that)
https://hg.mozilla.org/mozilla-central/rev/f21351397aa7 Robert, please close this if everything has landed.
Target Milestone: --- → Firefox 13
Yes, this one is fixed now (bug 643172 isn't, though).
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: