Support SAFECOOKIE authentication in Tor Browser

We should support SAFECOOKIE authentication in Tor Browser, that is adapt the code in Torbutton and Tor Launcher accordingly.