[Windmill-dev] Facebook X-domain problem

Matthew Eernisse mde at osafoundation.org
Thu Jan 3 21:01:44 PST 2008


How are you gentlemen.

I found the culprit, in the very last three lines of base.js:

if (navigator && navigator.userAgent &&
   !(parseInt((/Gecko\/([0-9]+)/.exec(navigator.userAgent)
   || []).pop()) <= 20060508)) {
    document.domain='facebook.com';
}

Probably doing it so it can see cookies set by pages from all the 
various subdomains. They're doing some kind of interesting user-agent 
sniffing in that conditional, weeding out Gecko-based browsers older 
than 2006-05-08. Not sure what the significance of that is.

Naturally enough, if I reset the domain for the IDE to the same thing, I 
can load the IDE with no errors, and do recording/playback on the FB 
home page. I was resetting it in windmill.Start, right after the two 
windmill.service calls.

This is going to be pretty annoying, because they're changing the domain 
*as* the JavaScript is loading and executing.

Once they change the domain in the opener window out from under us, 
there's of course no way to get a handle on it with script to look up 
what it changed to. So I guess we need a way to pass a designated domain 
name from the backend to set the IDE window to before trying to grab the 
reference to the testWindow.

It's kind of ugly, but anyone who wants to test their FB apps will need 
to do it.


Matthew



More information about the Windmill-dev mailing list