Firefox/URL Bar Algorithm: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 12: Line 12:


==When Enter Is Pressed==
==When Enter Is Pressed==
(Adding a Ctrl or Shift modifier changes the behaviour; the below is the unmodified algorithm.)


==Before Network==
==Before Network==
* The command is handled by urlbarBindings.xml's "urlbar" binding's handleCommand method
** It first calls _canonizeURL (urlbarBindings.xml), which handles Ctrl/Shift/Alt modifier suffix addition (e.g. Ctrl+Enter to add "www." and ".com")
** _canonizeURL also calls getShortcutOrURI (browser.js)
*** If the string contains a space, split on the first space and examine the first token.
**** If it's a search engine keyword, expand using the relevant search URL.
**** If it's a user-defined keyword, expand that.
** With the URL filtered through _canonizeURL, and the right tab/window obtained via handleCommand's modifier checking code, call nsDocShell::LoadURI with LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP


Function [http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#2297 getShortCutOrURI in browser.js].
..
 
* If the string contains a space, split on the first space and examine the first token.
** If it's a search engine keyword, expand using the relevant search URL.
** If it's a user-defined keyword, expand that.
 
...


* If it looks like a search according to [http://mxr.mozilla.org/mozilla-central/source/docshell/base/nsDefaultURIFixup.cpp#804 this algorithm], insert it into the <tt>keyword.URL</tt> preference value to produce a search URL, since the <code>keyword.enabled</code> preference defaults to true in Firefox.
* If it looks like a search according to [http://mxr.mozilla.org/mozilla-central/source/docshell/base/nsDefaultURIFixup.cpp#804 this algorithm], insert it into the <tt>keyword.URL</tt> preference value to produce a search URL, since the <code>keyword.enabled</code> preference defaults to true in Firefox.
Confirmed users, Bureaucrats and Sysops emeriti
722

edits

Navigation menu