You can't just "not worry about JavaScript errors". You have to test the properties to see whether they're empty.
(window.name ="xyz" && ahdframeset == ahdtop &&
window.parent && window.parent.ahdframe && window.parent.ahdframe.frames && window.parent.ahdframe.frames[window.name] &&
typeof window.parent.ahdframe.frames[window.name].somefunction == "undefined" ))