On Firefox, you can go to Options > Privacy > Always clear my private data when I close Firefox. You can specify which (or all) private data you want to delete.
Clear Safari history and topsites with automator - 2010
The way I do this is to use automator to find the files history.plist and toplist.plist and move them both to the trash. The files are in the Library > Safari. Be sure to close Safari before you do this so when it is next launched the history and topsite folders will be clear.