Fix errors when using localStorage in Safari's private browsing mode (#1489996)