Breaking News: OpenSearch Here, Presumed Queer
While I was doing some initial refactoring on the code that handles searches through my blog posts, I added support for the OpenSearch standard. What this means is that decent browsers such as Firefox will now inform you of the presence of a custom search engine when you visit this site. Notice the blue glow on the search toolbar and bring on the oohs and aahs.
Update: I’ve taken the liberty of adding search suggestions, as described at MDC. You should now be presented with some suggestions as you start typing in Firefox’s search toolbar. I say “should” because it doesn’t seem to be working, even though offline tests were successful. Some packet analysis confirmed that the suggestions are in fact coming through, yet Firefox adamantly refuses to display them. Any help would be appreciated, as I am at a loss.
Update: With a lot of help from biesi and gavin, I managed to figure it out: the server is just too slow to respond. Firefox’s timeout for suggestions is set to half a second, and the server generally doesn’t complete the request in that time. I’m pretty sure DreamHost’s configuration is to blame, specifically the MySQL over their LAN. Anyway, the whole ordeal did teach me a couple of things about Mozilla development:
Setting
javascript.options.showInConsoletotrueinabout:configdirects chrome errors to the error console.You can edit any JavaScript file in a nightly build’s
componentsdirectory as long as you restart Firefox afterwards.Calling
Components.utils.reportError(String)inside chrome JavaScript logs that string to the error console.The string
(new Error()).stackgives you a JavaScript stack trace.
So I’m going to be keeping search suggestions around. Theoretically, there’s nothing wrong with the code, and even if it only succeeds every 100 attempts, at least it succeeded at all.
Update: Still, if you want to see it in action, you can go into your Firefox program directory, open up components/nsSearchSuggestions.js in a text editor, find the line
_suggestionTimeout: 500,
and change that number to 5000 (milliseconds) or so. That way, the request for suggestions won’t time out so fast—obviously, this will affect all search engines. When you’re done, restart Firefox and voilà.
Honestly, after this, I’m not touching this post anymore.