I'd have to see it to be sure, but the javascript would have to be doing something to target the web site, not your browser. It may even be possible that they're using a high-level event-based attack that would work similarly for all web email.
That's the way I'd do it, anyway.