News:

The anti-spam plugins have stopped being effective. Registration is back to requiring approval. After registering, you must ALSO email me with your username, so that I can manually approve your account.

Main Menu

Victory Over The Sucky Firefox 3 Address Bar!

Started by Xepher, July 03, 2008, 09:21:37 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Xepher

Also known as the "AwesomeBar", but more like dead PossumBar! amirite? :-) Firefox 3 includes a completely reworked autocomplete/search system for the URL/address bar. The upside is you get pretty results with a bit more info in the pop up, and it makes for a great way to search through recent history or pages where you know the title but not the URL. The downside is that it's about as dumb as a brick when it comes to prioritizing things.

It's got a complex algorithm that ranks URLs based on how frequently you vist them, if they're book marked, how long since your last vist, if you went via a link or typed it directly, etc. As you type, it searches both the URL, page title, and any tags/comments you've assigned your bookmarks. The problem comes in that it searchs ANYWHERE in those, including in the middle of words.

A quick example:

If you frequently vist a site called, say ozyandmille.org, then that site gets a high priority. You might also frequent a site called commissionedcomic.com, and maybe missmab.com as well. Now, you want to go visit that last site, and you don't load it quite as often as the other two, but you still know it by name. So you start typing something logical, like say, the url. You get the "mi" done, and you'd expect it to be listing "missmab.com" as the autocompletion option. But no, it's not. comMIssionedcoMIc.com comes first, as it matches that "mi" four times, two in the url, and two more in the page title. Next is ozyandMIillie, for the same reasons, then finally "MIssmab.com" since it's only got one hit. Now, if you go back a lot of times, and keeping typing the same "mi" letters then picking the correct address, it will eventually learn to asscociate "mi" with missmab.com Yet if you then go and type "mis" later, you're gonna see "comMISionedcomic.com" at the top again, until you train that new, three letter sequence. For a place where you're supposed to type urls, that seems pretty stupid to me.

Don't get me wrong, I still want it to do fancy searching when I type in crazy stuff, but I want it to prioritze results where the URL starts with exactly what I started typing. At first, I thought I could do it via a firefox add-on... there's several out there of the "old location bar" type. Problem is, they all just use a couple visual tricks to make it look like the old firefox 2 behavior, without really fixing the underlying search algorithm. So I started hunting through code myself. It took me about 10 hours, as I had NO idea how firefox even works at that level, and I've never coded in any of the languages it uses. But I finally narrowed down it's search to a very small section of code that's actually using an SQL query to rank things. Now SQL, THAT I understand!

So the result is I've made a small patch that applies against the FF3 code, changing that query so that it gives 500 bonus points in the ranking to places where the start of the URL (minus the http://, www.) matches what you've typed. So far, it's working how I expected, but anyone else out there who feels daring, I could use more testers. This means you have to be comfortable compiling firefox from source code, which probably means very few of you. Hopefully I can still figure out a way to get it into add-on format, which can then be easily installed by anyone. For now though, here's the patch.



--- a/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp  2008-05-26 21:28:47.000000000 -0500
+++ b/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp  2008-07-03 03:07:40.054630131 -0500
@@ -276,12 +276,13 @@

   sql = NS_LITERAL_CSTRING(
     "SELECT h.url, h.title, f.url") + BOOK_TAG_SQL + NS_LITERAL_CSTRING(", "
-      "ROUND(MAX(((i.input = ?2) + (SUBSTR(i.input, 1, LENGTH(?2)) = ?2)) * "
-                "i.use_count), 1) rank "
-    "FROM moz_inputhistory i "
-    "JOIN moz_places h ON h.id = i.place_id "
+    "((SUBSTR(REPLACE(REPLACE(h.url, 'http://', ''), 'www.', ''), 1, LENGTH(?2)) = ?2) * 500) + "
+       "ifnull(ROUND(MAX(((i.input = ?2) + (SUBSTR(i.input, 1, LENGTH(?2)) = ?2)) "
+               " * i.use_count), 1),0) rank "
+    "FROM moz_places h "
+    "LEFT JOIN moz_inputhistory i ON i.place_id = h.id "
     "LEFT OUTER JOIN moz_favicons f ON f.id = h.favicon_id "
-    "GROUP BY i.place_id HAVING rank > 0 "
+    "GROUP BY h.id HAVING rank > 0 "
     "ORDER BY rank DESC, h.frecency DESC");
   rv = mDBConn->CreateStatement(sql, getter_AddRefs(mDBAdaptiveQuery));
   NS_ENSURE_SUCCESS(rv, rv);


Oh, quick note... this bit of code is hiding inside XULRunner... so if you normally building firefox against XUL runner, (rather than directly) you'll actually need to patch/rebuild XULRunner instead.

EDIT: Updated the patch to use "REPLACE" instead of "TRIM" as it was breaking sites that started with h, t, p, or w (aka, the http and www trims.)

EDIT2: No luck making an add-on. This code is deep in the basic functionality of the browser. The only way to do it as an add-on would be to completely implement a completely seperate/new address bar widget from scratch to completely replace the existing one. Darn!

Shmooi

Hm, that's really interesting. I really think they should have an on/off feature to it though(if they haven't included it already) but this makes it a lot less craptastic. I give you mad props for working with it. :)

Miluette

Wow, it's nice for you to take initiative like that and do that.

It was getting on my nerves too. It started being like Opera's addy bar, except Opera's is a bit less stupid.

I hope you can get this into add-on form. <3
And wasn't it you who told me,
"The sun would always chase the day"?

fesworks

maybe the rest of us aren't lazy, and typing more of the addy?

:P

... Also I get MIndMistress.coMIcgenesis.com for "mi" :P

one thing I don't like about the new Tab system is that instead of the convenient single "X"-out button on the top-right of all the tabs, each has their own tab... that's been pissing me off. Make porn surfing more time consuming.

www.PSIwebcomic.com
www.TheShifterArchive.com
www.ArdraComic.com
www.WebcomicBeacon.com

Xepher

Quote from: fesworks on July 25, 2008, 04:50:01 AM
one thing I don't like about the new Tab system is that instead of the convenient single "X"-out button on the top-right of all the tabs, each has their own tab... that's been pissing me off. Make porn surfing more time consuming.

Heheh... but you CAN actually configure that behavior. No patch needed. Full details at http://kb.mozillazine.org/Browser.tabs.closeButtons but you just need to open "about:config" and set "browser.tabs.closeButtons" to "3" for the old firefox 1.x behavior that you're wanting. I actually prefer the 0 setting, which provides an X only for the currently active tab, as it takes up less room when I have 50+ tabs open, and keeps me from accidently closing the wrong one.

JM

Firefox soaks up too much of my RAM and memory. :[ I can even only be running just one window and two tabs and it still takes up a lot. I'm trying to figure out something better and Opera seems to work. I figured that with 2GB of RAM I'd be good, but nooooo the internets are working to sink me again! O_o

fesworks

Awesome Thanks!

Also, I HATE Opera with a BURNING PASSION!

So many "little things" pop up and wreck the page viewing with mis key strokes doing weird things... and also the page viewing itself is effed up and smaller for various site and flash things. pisses me off.

www.PSIwebcomic.com
www.TheShifterArchive.com
www.ArdraComic.com
www.WebcomicBeacon.com

Xepher

JM, something is seriously wrong if you can't run firefox easily with 2GB of ram. I can open 64 tabs at once (my daily comic reading) and it only takes up about 230MB of ram. If you feel like fixing it, you should delete/remove all user data for firefox, including add-ons and toolbars and such, then reinstall it and see if it works better. (Backup your bookmarks and such first.) Most of the time problems like that are the result of some add-on or plugin that's leaking memory.

Miluette

I think the amount of RAM Firefox is using (between 77mb and 190mb for my average 3-12 tabs) is freaking insane on both my PC and mac. I can't even run it with Photoshop and/or AIM running decently anymore. It's sad.

My other browsers tend to do it now too, and I'm not sure if it's any way linked to my possible adware problem. But Firefox generally does it the worst. (Opera is second worse, but it's barely worth using anyway.)

if you search "firefox using too much ram/cpu" you'll find a lot of people are having this problem.
And wasn't it you who told me,
"The sun would always chase the day"?

fesworks

... how OLD is your computer?

Also, you may have serious issues with your computer too.

www.PSIwebcomic.com
www.TheShifterArchive.com
www.ArdraComic.com
www.WebcomicBeacon.com

Xepher

You need to be careful how you measure ram. I'm not sure what the windows task manager actually measures, but on mac and other *nix based OSes, the memory measurement you want is "resident" size minus the shared size. Almost all programs will map WAY more address/shared memory space than they actually use in ram. A lot of that is shared between many programs for GUI toolkits and system libraries (DLLs in windows) so you may not be getting an accurate picture of how much it uses. That said though, even with only 1 tab open, firefox 3 still uses about 120MB on mine, so your ranges sound pretty normal IMHO.

Toolbars (especially the google toolbar) can add a fair amount of memory usage, and if you've loaded the Flash plugin (who hasn't) it eats up a ton of memory. The other big thing with Firefox 2 and 3 is the phishing protection, which with FF3, downloads a file over 50MB in size... urlclassifier3.sqlite. It can suck up ram while it's checking/updating that.

Bottom line is though, modern browsers just have too many features to use less memory. Everyone wants javascript, and preloaded pages, tabs, alpha-blending, anti-aliased fonts, etc.

JM

Quote from: Xepher on July 26, 2008, 01:15:08 PM
JM, something is seriously wrong if you can't run firefox easily with 2GB of ram. I can open 64 tabs at once (my daily comic reading) and it only takes up about 230MB of ram. If you feel like fixing it, you should delete/remove all user data for firefox, including add-ons and toolbars and such, then reinstall it and see if it works better. (Backup your bookmarks and such first.) Most of the time problems like that are the result of some add-on or plugin that's leaking memory.

I recently wiped my whole comp clean, including the OS, and then Firefox was still iffy. Of course, it might be because my computer is kind of old. Also, I like to run other programs on the side, so it doesn't help that I'm working on an image file that's the size of a song (or larger) at the same time.

Miluette

My computer is turning four this year. ;x;

I'm getting a new one as soon as I can afford it, anyway. It's really not equipped for design work. Nor is it equipped for much of anything I do, including gaming... But I should be able to run stuff fine, considering my first computer (64Mb of RAM) could at least run Photoshop and AOL simultaneous at a reasonable functioning rate. >__>

Modern browsers DO have too much stuff. I never use toolbars, though. Don't need 'em.
And wasn't it you who told me,
"The sun would always chase the day"?

JM

Yeah I never get toolbars. Too many buttons for my two brain cells to handle.

I can run Windows Media Player, AIM, Yahoo IM, MSN Messenger, and Photoshop all at the same time and be fine, but if I run just Firefox alongside Photoshop everything gets really laggy.

Weiiiiird.

Databits

Yeah, both FF2 and FF3 use MySQL Lite on their back end. It's nice and nifty and really fast.
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]