Closed Bug 472943 Opened 15 years ago Closed 15 years ago

Two confusable preferences, "browser.urlbar.search.sources" and "browser.urlbar.default.behavior", should be unified.

Categories

(Toolkit :: Places, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: yuki, Assigned: Mardak)

References

()

Details

(Keywords: fixed1.9.1, Whiteboard: fixed by bug 471903)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1b3pre) Gecko/20090109 Shiretoko/3.1b3pre
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.1b3pre) Gecko/20090109 Shiretoko/3.1b3pre

There are two confusable preferences: "browser.urlbar.search.sources" and "browser.urlbar.default.behavior". "search.sources" means to expand search sources, "default.behavior" means to restrict search sources. Their purposes are just same, but their policies are opposite. This is very troublesome.

"browser.urlbar.search.sources" should be obsolete and "browser.urlbar.default.behavior" should absorb "sources"'s job.

 * There are already some flags: 1=restrict to history, 2=restrict to
   bookmarks, 4=restrict to tags, and 32=restrict to typed pages.
   (0=no restriction)
   A new flag, 64=reject any result, can work like as 
   "browser.urlbar.search.sources=0".
 * We can add an new option "typed pages" to the menulist of
   "When using the location bar, suggest:".


Reproducible: Always
Well, originally it was just default.behavior, but firefox 3.1's prefs ui only wanted something to handle search "nothing, history, bookmarks, both", so search.sources was added to keep the logic for handling pref updates to search.sources.

I'm for getting rid of search.sources, and adding an extra bit for "turn off search" is easy enough.

What happens to dropdowns bound to a pref if the pref gives it an unexpected value? <menulist preference=...> <menuitem label="Nothing" value="64"/> and the pref is say... 65.
(In reply to comment #1)
> What happens to dropdowns bound to a pref if the pref gives it an unexpected
> value? <menulist preference=...> <menuitem label="Nothing" value="64"/> and the
> pref is say... 65.

I think "onsyncfrompreference" and "onsynctopreference" can do it.
https://developer.mozilla.org/en/Preferences_System/New_attributes
For example...
-------------------
const NOTHING = 64;
const RESTRICT_HISTORY = 1;
const RESTRICT_BOOKMARKS = 2;

<menulist id="menulist"
  preference="browser.urlbar.default.behavior"
  onsyncfrompreference="
    var pref = parseInt(
          document.getElementById('browser.urlbar.default.behavior').value
        );
    return pref & NOTHING ? 'nothing' :
           pref & RESTRICT_HISTORY ? 'history' :
           pref & RESTRICT_BOOKMARKS ? 'bookmarks' :
           'both' ;
  "
  onsynctopreference="
    var pref = parseInt(
          document.getElementById('browser.urlbar.default.behavior').value
        );
    var value = document.getElementById('menulist').value;
    if ((pref & NOTHING) != (value == 'nothing'))
       pref ^= NOTHING;
    if ((pref & RESTRICT_HISTORY) != (value == 'history'))
       pref ^= RESTRICT_HISTORY;
    if ((pref & RESTRICT_BOOKMARKS) != (value == 'bookmarks'))
       pref ^= RESTRICT_BOOKMARKS;
    return pref;
  ">
  <menupopup>
    <menuitem label="nothing"   value="nothing"/>
    <menuitem label="history"   value="history"/>
    <menuitem label="bookmarks" value="bookmarks"/>
    <menuitem label="history and bookamrks" value="both"/>
  </menupopup>
</menulist>
-------------------
Of course, we have to think about 3, 4, 32, etc.
KaiRo: It should be safe to drop search.sources for seamonkey, yeah? I believe you changed the UI pref to bind to default.behavior?

I think Firefox could do something similar to what you've done for bug 473734 and like comment #2 using onsyncto/frompref while adding an extra bit in default.behavior to turn off searching completely... ("restrict search to nothing".. perhaps better than adding even more prefs x.x)

Does seamonkey provide a way in the UI to turn off searching completely?
Status: UNCONFIRMED → NEW
Component: Location Bar and Autocomplete → Places
Ever confirmed: true
Product: Firefox → Toolkit
QA Contact: location.bar → places
Version: unspecified → Trunk
(In reply to comment #3)
> KaiRo: It should be safe to drop search.sources for seamonkey, yeah? I believe
> you changed the UI pref to bind to default.behavior?

Yes, SeaMonkey is fully on default.behavior now.
Depends on: 471903
http://hg.mozilla.org/mozilla-central/rev/68391d886801
Assignee: nobody → edilee
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: fixed by bug 471903
Target Milestone: --- → mozilla1.9.2a1
You need to log in before you can comment on or make changes to this bug.