Override gKeywordURIFixup to restore "Im Feeling Lucky"

I’m trying to override the gKeywordURIFixup but its not working. this function is here: https://dxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#763

and this is my attempt: https://gist.github.com/Noitidart/2d8df6ad02d227d78e11

this function is supposed to get called whenever a user navigates to a url from url bar: http://stackoverflow.com/questions/31089107/where-does-firefox-determine-the-words-typed-in-url-bar-are-to-be-converted-to-s

My end goal is to identify if the user pased search terms, and if so, send it to the I’m Feeling Ducky search of DDG

Just an idea:
There are always more than one way achieve a goal (especially in coding).

Since after entering a URL in url bar will eventually become http requests, another (simpler) method is to grab it on request (ie add an observer for http-on-modify-request) and parse the URL there.

Thanks man I appreciate that quick response and help thinking up a solution. I want to try to avoid observer, because that is very intensive, that gets triggered for everything. And also the way I tell if the user typed search terms in the request is if it is an improper URI, the search terms get passed to gURKeywordFixup, so if user leads with a special keyword (like ones they assign at about:preferences#search) it will then use that specific engine:

hooking into gURIKeywordFixup would help me identify if its just search terms with no special keyword, it only triggers for URL bar search too so would be lighter on performance I think.

A request to observer will already be in URI form, I wont be able to detect if it was from url bar, i can detect if its parent tab though, however i dont know if user is navigating to that url, or it was an auto redir due to user typing search terms.

In fact, Kris has told me that HTTP observers are very ‘cheap’ (use minimal resources) but you are correct that it would be triggered on all requests.

If you ask Kris on IRC, he should be able to point you to the right direction (listening for text input in address-bar)

Cool thanks man is kris john-galt?

yes…

I was playing around in Browser Toolbox and …

One idea is this:

That’s a really really cool idea to detect URL bar only requests!