Re-adding the fix for issue #5955.

d387261 undid a fix made by bb3450e for http://code.google.com/p/selenium/issues/detail?id=5955.
This pull request re-adds the workaround.