[RESOLVED]__doPostBack fails. Only in Safari on a Mac without Developer Menu visible

I have a perplexing problem. The following fails


ONLY on a Mac, using Safari. AND ONLY if the Develop menu isn’t visible.

The error is

TypeError: ‘Undefined’ is not an object (evaluating ‘caller.arguments.callee’)

As already stated, this works in all other browsers. When the error occurs in Safari, the obvious troubleshooting approach is to turn on the developer tools. But, as soon as the Develop menu option is displayed, the problem goes away.

It works on Windows in IE, Chrome, Safari, etc. It works in Mac Safari, when the Develop menu is displayed.

I can’t test other browsers on the Mac, so assume it may just be Safari.

Difficult to say what the problem could be but here are few things you could try:

Install safari on windows and see if the problem still happens.

If it works with developer tools open, it might be there’s a timing issue happening. I’ve had instances every so often where opening a developer tool (e.g. firebug) stopped the error happening. I think what happens is the developer tool might slow things
down very slightly but long enough for an undefined object to be defined (if that makes sense). This is typical where you use asynchronous calls and have accidentally referenced data that you are waiting for in your asynchronous response before the data is
returned. Sometimes opening a debugging windows allows that call to be made in time and the problem goes away.

Also – try creating a copy of the page you;re working on but only include the absolute basics – and then add your components/code bit by bit until you hit the error again – at least that way you might be able to locate where the error is happening.

Are you doing anything complicated on the front-end? Are you dynamically loading javascript files? Are you loading data asynchronously?

Thanks for the reply loydall123

I now have a solution, which is more workaround than solution. Instead of calling __DoPostBack, I’m calling the .click(). The problem has gone away.

In reply to your questions, in case anyone else has a similar problem:

It works fine on Safari on Windows.

I thought it might have been a timing issue, so had tried adding a delay before calling. No success, but then I didn’t explore this path heavily.

There maybe some front-end complexity, depending on what your call complex. There’s an iframe involved. A script in the parent page runs, and after a number of steps calls a function in the iframe page. Domains have been set correctly, and the function call
definitely succeeds. The function validates some data (successfully) and call __DoPostBack(….) via javascript generated by 


That’s where the problem occurs.

My gut feel is the problem could be due to the iframe. The .Net code inside __DoPostBack loops upwards via caller.arguments.callee. I have a sneaking suspicion it’s getting to the first call in the iframe, tries to access the caller and
has a problem getting to the parent page. But, only in Safari on a Mac, with the Develop menu hidden.

Anyway, it now works.

Thanks again.

Leave a Reply