In other words, what makes you think the code in your browser is safe ?
On a Mac, Safari runs in a sandbox. It should not allow anything to escape and damage or infect the system.