Fix JS exceptions in sandboxed iframes