Closed Bug 219532 Opened 21 years ago Closed 19 years ago

Add pref to make search bar results always open in a new tab

Categories

(Firefox :: Search, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 2

People

(Reporter: thesh_bugs, Assigned: cbutcher)

References

Details

(Keywords: fixed1.8.1)

Attachments

(1 file, 7 obsolete files)

User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 When searching in the sidebar, I don't really like that the search results open in both the sidebar and the main browser window. I would prefer that it opens up in the sidebar only; could you add an option to search only in the sidebar? Also, can you add an option to open the search engine in a new tab when using the search button on the navigation bar, and then have the option for that to override the "load links in background" option for tabbed browsing? -Scott Reproducible: Always Steps to Reproduce: 1. 2. 3.
This bug report is actually two different issues, I would like to support the second issue of opening the search bar results in a new tab by default. This keeps the current page you're browsing and uses the tabs properly.
Yeah, your right - this really should only be one bug. I don't really care about the searching only in the sidebar part (I have gotten used to it showing the results in the window). I'll change the description so this is _only_ for the opening new tabs for a search part - I would like to see it for the sidebar as well, though.
Summary: Option to search only in sidebar and open new tab... → Option to open new tabs for a search.
*** Bug 269735 has been marked as a duplicate of this bug. ***
Please, note that pressing ALT-ENTER in the search toolbox does in fact open up the results in a new tab, but I think that should be configurable option. I personally would like to switch it so ENTER opens up the new tab, while ALT-ENTER puts it in the current window.
*** Bug 275492 has been marked as a duplicate of this bug. ***
Assignee: shliang → cbutcher
OS: Windows 98 → All
Product: Core → Firefox
Hardware: PC → All
Summary: Option to open new tabs for a search. → Add pref to make search bar results always open in a new tab
Attachment #169336 - Attachment is obsolete: true
Attached patch Patch revision 2 (obsolete) — Splinter Review
Attachment #169343 - Attachment is obsolete: true
Attached patch Patch revision 3 (obsolete) — Splinter Review
I think I got it this time! Search bar results open in a new tab, unless the currently viewed tab was just created, and is blank.
Out of curiosity, why has this been changed to firefox instead of for the core or suite (which is what it was intended for)?
(In reply to comment #9) > Out of curiosity, why has this been changed to firefox instead of for the core > or suite (which is what it was intended for)? Oops. Note that the patches that were submitted by Chris are Firefox-specific. (In reply to comment #8) > Created an attachment (id=169345) [edit] > Patch revision 3 Chris, you should not be setting that pref to true by default. Adding a pref is one thing, changing default behavior is another.
Product: Firefox → Core
> Chris, you should not be setting that pref to true by default. Adding a pref is > one thing, changing default behavior is another. No problem, I will change that. This is my first code contribution to Mozilla, and I'm enjoying it. I'll revise it right away. :D
Attachment #169345 - Attachment is obsolete: true
Attached patch Patch revision 4 (obsolete) — Splinter Review
Default pref value made false.
Status: NEW → ASSIGNED
Comment on attachment 169381 [details] [diff] [review] Patch revision 4 >Index: mozilla/browser/base/content/browser.js > if (gBrowser.localName == "tabbrowser" && > aTriggeringEvent && 'altKey' in aTriggeringEvent && >- aTriggeringEvent.altKey) { >+ aTriggeringEvent.altKey || gPrefService.getBoolPref("browser.tabs.opentabfor.searchbar") && getWebNavigation().currentURI.spec != "about:blank") { This needs proper indentation/wrapping. All files should wrap at 80, although browser.js is kinda bad at following that rule. Also, you can use the getBoolPref helper function defined at http://lxr.mozilla.org/mozilla/source/browser/base/content/utilityOverlay.js#10 6 (also not commonly used, but handles failure better).
Attachment #169381 - Attachment is obsolete: true
Attached patch Patch Revision 5 (obsolete) — Splinter Review
Thanks Gavin for your continued help with this patch. I enjoy using Firefox, and want to contribute in any way that I can, I'd like to see this preference changes go into Firefox for those people that want it.
Attachment #186280 - Flags: review?(cbutcher)
Comment on attachment 186280 [details] [diff] [review] Patch Revision 5 Changing to a proper review target.
Attachment #186280 - Flags: review?(cbutcher) → review?(mconnor)
Comment on attachment 186280 [details] [diff] [review] Patch Revision 5 I don't think this is the right prefname, the opentabfor prefs are open tab (instead of window) for prefs, so logically flipping this pref would make alt-enter open the search in a new window. I think this should be a browser.search.* pref, possibly sharing the pref for the search dialog, but that could be confusing.
Attachment #186280 - Flags: review?(mconnor) → review+
Attachment #186280 - Attachment is obsolete: true
Attached patch Patch Revision 6 (obsolete) — Splinter Review
Attachment #196396 - Flags: review?(mconnor)
Attachment #196396 - Flags: review?(mconnor) → review+
Trunk: mozilla/browser/app/profile/firefox.js; new revision: 1.80; mozilla/browser/base/content/search.xml; new revision: 1.31;
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Flags: review+
Product: Core → Firefox
Resolution: --- → FIXED
Target Milestone: --- → Firefox1.6-
Version: Trunk → unspecified
QA Contact: chrispetersen → search
Attached patch Patch Revision 7 (obsolete) — Splinter Review
Further enhancement: In a case where the current tab is blank, make use of it, and load the search results there.
Attachment #196396 - Attachment is obsolete: true
Attachment #196483 - Flags: review?(mconnor)
Attachment #196483 - Attachment is obsolete: true
Attachment #196483 - Flags: review?(mconnor)
Attachment #196487 - Flags: review?(mconnor)
Comment on attachment 196487 [details] [diff] [review] Checking for about:config was unnecessary > var openInTab = this.prefService.getBoolPref("browser.search.openintab"); >+ var url = getBrowser().currentURI.spec; >+ // if the current tab is blank, load the search results into it >+ if (url == "about:blank") >+ openInTab = false; > SearchLoadURL(searchURL, (evt && evt.altKey || openInTab)); a) we only need this code block if openInTab is true b) the more useful case is if the last tab is about:blank, which is covered by the generic bug for making addTab reuse an existing blank tab instead of appending
Attachment #196487 - Flags: review?(mconnor) → review-
Attachment #196396 - Flags: approval1.8b5?
Attachment #196396 - Flags: approval1.8b5? → approval1.8b5-
Comment on attachment 196396 [details] [diff] [review] Patch Revision 6 315034 already has approval, it depends on this landing.
Attachment #196396 - Flags: branch-1.8.1?(mconnor)
Attachment #196396 - Flags: branch-1.8.1?(mconnor) → branch-1.8.1+
Checked in on the 1.8 branch. mozilla/browser/base/content/search.xml; new revision: 1.25.2.9; mozilla/browser/app/profile/firefox.js; new revision: 1.71.2.17;
Keywords: fixed1.8.1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: