We need a way to test for race conditions in code like LocalStorage's import. https://bugs.webkit.org/show_bug.cgi?id=26629 is tracking some changes that (among other things) correct some races I've found, but we really need a way to reliably verify we're doing the right thing. This is somewhat related to https://bugs.webkit.org/show_bug.cgi?id=26171 which is also about needing better ways to test stuff (though that bug doesn't have to do with multi-threaded code). This is on my long-term radar.
There are a few tests for races in LayoutTests in the form "repeat something for 0.5 sec" that did reliably trigger bugs, but that's not always possible, of course.