On a personal note, I have started a new job at Kontera, involving much more web-related development than I have ever done. I will continue posting experiences from this job I find interesting and worthy of sharing.
Interestingly enough, Chrome which is based on the same engine does not have these crashes.
From examining the stack of Safari (and also knowing the behavior of my flash app ;-), I think that the crash happens when Safari is trying to do something while Flash is calling JavaScript code via ExternalInterface.call(). Reducing the number of calls from Flash to JavaScript and reducing the time spent in the JavaScript calls causes the probability of a crash to be reduced dramatically. The simplest technique is to modify the JavaScript callback to wrap it in a setTimeout(...) as such:
function foo(param1, param2) { .....}
should be replaced with:
function foo(param1, param2, afterTimeout) {
if (!afterTimeout) {
setTimeout(function() { foo(param1, param2, true) }, 20);
}
.... // the original code
}
The flash code does not need to be modified at all.
Happy hacking,
Noam