Tracking down finnair.com's missing i
Monday, December 14, 2009 1:40:16 PM
Finnair site auto-complete menu broken, error in consoleAfter selecting a local site, the auto-complete menu to choose departure and destination cities from never populates. What's worse: the site doesn't accept anything you type in by hand! If you haven't made a menu selection, you get an error message! I'm sure that does wonders for their overall accessibility and section 508 compliance..
The error message complains that they refer to a variable "i" that doesn't exist. Somewhat wrapped, the code looks like this:
a.Autocompleter.Cache=function(c){
var f={};
var d=0;
function h(k,j){
if(!c.matchCase){
k=k.toLowerCase();
}
if(!k.startsWith(j)&&k.indexOf(" "+j)===-1&&k.indexOf("("+j)===-1){
return false;
}
return i==0||c.matchContains;
}
The problem is the reference to i in the return statement. There is no variable "i" defined nearby, indeed not in the entire script file. That "i==0" looks like some dead code that isn't meant to be there anymore. But it works in other browsers, no?
If I load the page in Firefox and type javascript:alert(window.i) into the address bar it says "1", so in Firefox the site does somewhere create a global variable named i. The question is where?
Firebug can't - as far as I know - break when a variable is initialized or changed. As always, Fiddler comes to the rescue - setting a "HTTP breakpoint" after response and re-loading the site in Firefox lets me add some simple debug code:
Fiddler screen in breakpoint mode, debug code highlightedwindow.__defineSetter__ ('i', function(){ try{ undefined() ; }catch(e){ console.log(e) ; } })
When I click Fiddler's "run to completion" button, an error message appears in Firebug's console pointing to this function:
function isFirefoxWMPPluginInstalled(){
var plugs=navigator.plugins;
for(i=0;
i<plugs.length;
i++){
which given its name is naturally called after some browser sniffing, here:
type:$.browser.mozilla&&isFirefoxWMPPluginInstalled()?"application/x-ms-wmp":"application/x-mplayer2"
So this works in other browsers by pure luck - because JavaScript scoping rules are such that when you don't use "var" keyword to declare variables, they will be global, and Fnnar's code contains numerous loops that use "i" as a counter and don't use var. If such a loop happens to run before you try booking, the site will work for you. As if we needed any more evidence that JavaScript scoping rules suck..
If we're going to site patch this error in browser.js, the patch would be simply var i;. At 6 characters, I'm fairly sure it would be the shortest site patch ever. Meanwhile, we'll contact them and hope Fnnar will get their "i"s back in order.
And I sure hope they deploy better software for their autopilot than their autocomplete...









shadowKshadowk # Monday, December 14, 2009 2:03:02 PM
ouzowtfouzoWTF # Monday, December 14, 2009 4:44:34 PM
Kyle Bakerkyleabaker # Monday, December 14, 2009 5:32:46 PM
MyOpera team, please fix this!fearphage # Monday, December 14, 2009 6:31:15 PM
Kyle Bakerkyleabaker # Monday, December 14, 2009 6:39:55 PM
Originally posted by fearphage:
Now translate that to Dragonfly.
Hallvord R. M. Steenhallvors # Monday, December 14, 2009 9:09:14 PM
and yes, I should have tried to clarify the Fnnar pun
Hallvord R. M. Steenhallvors # Monday, December 14, 2009 9:11:35 PM
Michael A. Puls IIburnout426 # Monday, December 14, 2009 10:41:23 PM
Originally posted by hallvors:
Bank, grocery/department store, insurance/medical and university sites are all like that. It sucks. (Of course, you already know that more than most)Charles SchlossChas4 # Tuesday, December 15, 2009 10:17:55 PM
Also United Arlines sends cr@p to Opera (logging onto the united millage plus is a bit messed up) I think I am sent to the mobile version of the site on some parts of the site
MyOpera team, please fix this!fearphage # Wednesday, December 16, 2009 12:31:27 AM
Originally posted by Hallvord R. M. Steen:
Time to up that market share perhaps...BridgeBuilderKiwi # Monday, December 28, 2009 4:25:04 AM
I think that you'd have to have a pretty substantial percentage ownership of a company before they would listen to you speaking as a shareholder.
Hallvord, I agree that encountering poorly coded e-commerce websites is a frustrating experience, especially when you are actually wanting to do business (by buying goods or services via the site) and aren't just browsing to satisfy curiosity.
BridgeBuilderKiwi # Monday, December 28, 2009 4:32:07 AM
Anonymous # Monday, December 28, 2009 1:03:51 PM
Hallvord R. M. Steenhallvors # Thursday, December 31, 2009 11:45:25 PM
Originally posted by BridgeBuilderKiwi:
Phred doesn't need to own anything, he's a user speaking from his heart and we'd be pretty dumb if we didn't listen to him.
(If he also told us how we could have, say, 10% of the desktop web browsing market by next December the statement would have been even more worth listening to though
Originally posted by anonymous:
Thanks for doing so! I keep trying to plan 2010 and it's complicated enough without ad-hoc debugging
BridgeBuilderKiwi # Tuesday, January 12, 2010 8:34:17 AM
I must have interpreted Phred's statement incorrectly.
Maybe I had doubted my understanding and subsequently chose to ask Phred the question.
When I first read his statement about market share, I had thought that he might have been talking about purchasing shares in Finnair, and then contacting them as a shareholder.
I don't know how I managed to get the concept of market share mixed up like that.
Happy 2010