That's fine, but the existing function doesn't call onFailure if it errors out.

So I guess the right fix would be to update cookiesEnabled to call onFailure, and update callers to pass an errback?