When comparing the 'window' object with strings, numbers, or boolean values, Safari (and related browsers like OmniWeb and Shiira, but not Konqueror) throws an error while trying to obtain a value of the object to use in the comparison. All other major browsers correctly return false. The cause of this problem is that window.toString() returns an undefined value, that Safari is unable to convert into a string. Tested in Safari <= 1.2.
If you are going to compare objects, and there is a possibility that one of them might be a 'window' object, and the other might be a string, number, or boolean; check if the typeof each variable is the same first, and only perform the actual comparison afterwards:
if( ( typeof(foo) == typeof(bar) ) && ( foo == bar ) )