Closed
Bug 587691
Opened 15 years ago
Closed 14 years ago
need a way to get the default engine, even if it is hidden
Categories
(Firefox :: Search, defect)
Firefox
Search
Tracking
()
RESOLVED
FIXED
Firefox 4.0b5
Tracking | Status | |
---|---|---|
blocking2.0 | --- | beta5+ |
People
(Reporter: Gavin, Assigned: Gavin)
Details
(Whiteboard: [has reviewed patch])
Attachments
(1 file, 3 obsolete files)
3.24 KB,
patch
|
Details | Diff | Splinter Review |
For the functionality added in bug 586821, we want to always use the default engine, even if it's hidden.
Assignee | ||
Updated•15 years ago
|
blocking2.0: --- → beta5+
Assignee | ||
Comment 1•15 years ago
|
||
One option is to change the defaultEngine getter to just always return the original default, even it if is hidden. That would mean context menu search would continue using that engine even though it "doesn't exist". It might also break other people's expectations.
Another option is to add some extra property, but I have no idea what we'd call it.
Assignee | ||
Updated•15 years ago
|
Assignee: nobody → gavin.sharp
Assignee | ||
Comment 2•14 years ago
|
||
Attachment #468070 -
Flags: review?
Assignee | ||
Updated•14 years ago
|
Attachment #468070 -
Flags: review? → review?(rflint)
Assignee | ||
Comment 3•14 years ago
|
||
Attachment #468070 -
Attachment is obsolete: true
Attachment #468385 -
Flags: review?(rflint)
Attachment #468070 -
Flags: review?(rflint)
Assignee | ||
Comment 4•14 years ago
|
||
I'm not super pleased that we baked the "or fall back to the first visible engine" logic into the search service rather than in the frontend, because it kind of ties our hands a bit.
This patch just adds the additional property (originalDefaultEngine), and updates the docs to match, which I think is the simplest and safest choice at this point, even though it's sucky to have both "defaultEngine" and "originalDefaultEngine" properties...
Comment 5•14 years ago
|
||
Comment on attachment 468385 [details] [diff] [review]
patch
>+ /**
>+ * The original default engine. This differs from the "defaultEngine"
>+ * attribute in that it always returns a given build's default engine,
>+ * regardless of whether it is hidden. May be null if there are no visible
>+ * search engines.
>+ */
>+ readonly attribute nsISearchEngine originalDefaultEngine;
can it really be null if there are no visible engines? the phrase "if there are no visible search engines" looks conflicting with "regardless of whether it is hidden" and the default engine pref should always exist.
>diff --git a/toolkit/components/search/nsSearchService.js b/toolkit/components/search/nsSearchService.js
>+ get originalDefaultEngine() {
>+ const defPref = BROWSER_SEARCH_PREF + "defaultenginename";
>+ return this.getEngineByName(getLocalizedPref(defPref, ""));
>+ },
looks like this could cache the value or we expect it to change during runtime? (the old code was looking like trying to cache it, but wrongly), even if the pref can be changed it's unlikely someone would do it and expect immediate effect.
Assignee | ||
Comment 6•14 years ago
|
||
(In reply to comment #5)
> can it really be null if there are no visible engines?
Well, it can be null if there are no installed engines, but I think the search service doesn't handle that case very well, so probably not worth covering that case here - I'll adjust the comment.
> looks like this could cache the value or we expect it to change during
> runtime?
Yeah, it could be cached. And this file could use Services.jsm and XPCOMUtils lazy getters, too - but search service doesn't have a test suite at the moment, so I really want to be conservative and avoid unnecessary changes. I'll file a followup.
Assignee | ||
Comment 7•14 years ago
|
||
Attachment #468385 -
Attachment is obsolete: true
Attachment #468768 -
Flags: review?(rflint)
Attachment #468385 -
Flags: review?(rflint)
Updated•14 years ago
|
Attachment #468768 -
Flags: review?(rflint) → review+
Assignee | ||
Comment 8•14 years ago
|
||
Attachment #468768 -
Attachment is obsolete: true
Updated•14 years ago
|
Whiteboard: [has reviewed patch]
Comment 9•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Assignee | ||
Updated•14 years ago
|
Target Milestone: --- → Firefox 4.0b5
You need to log in
before you can comment on or make changes to this bug.
Description
•