diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-07-05 07:56:26 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-07-05 07:56:26 +0800 |
commit | 88b80a860b47b19756c162df89307a58a43ceeeb (patch) | |
tree | f89f003b7dcd6dcdc53cfee11aff027f380ad32e /embed/mozilla/EphySingle.cpp | |
parent | cb2cadac4196048e1caf47bb9a876d6edc2cfa34 (diff) | |
download | gsoc2013-epiphany-88b80a860b47b19756c162df89307a58a43ceeeb.tar gsoc2013-epiphany-88b80a860b47b19756c162df89307a58a43ceeeb.tar.gz gsoc2013-epiphany-88b80a860b47b19756c162df89307a58a43ceeeb.tar.bz2 gsoc2013-epiphany-88b80a860b47b19756c162df89307a58a43ceeeb.tar.lz gsoc2013-epiphany-88b80a860b47b19756c162df89307a58a43ceeeb.tar.xz gsoc2013-epiphany-88b80a860b47b19756c162df89307a58a43ceeeb.tar.zst gsoc2013-epiphany-88b80a860b47b19756c162df89307a58a43ceeeb.zip |
Decode ACE for UI, and encode UTF-8 hostnames before using cookie and
2004-07-05 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/EphySingle.cpp:
* embed/mozilla/mozilla-embed-single.cpp:
Decode ACE for UI, and encode UTF-8 hostnames before using
cookie and passwords functions with them.
Fixes bug #130930.
Diffstat (limited to 'embed/mozilla/EphySingle.cpp')
-rw-r--r-- | embed/mozilla/EphySingle.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/embed/mozilla/EphySingle.cpp b/embed/mozilla/EphySingle.cpp index b8814d4e6..3c8fb67b6 100644 --- a/embed/mozilla/EphySingle.cpp +++ b/embed/mozilla/EphySingle.cpp @@ -33,6 +33,11 @@ #include <nsICookieManager.h> #include <nsIServiceManager.h> #include <nsICookie2.h> +#include <nsIServiceManager.h> + +#ifdef ALLOW_PRIVATE_API +#include <nsIIDNService.h> +#endif NS_IMPL_ISUPPORTS2(EphySingle, nsIObserver, nsISupportsWeakReference) @@ -231,12 +236,23 @@ NS_IMETHODIMP EphySingle::Observe(nsISupports *aSubject, EphyCookie * mozilla_cookie_to_ephy_cookie (nsICookie *cookie) { - EphyCookie *info = ephy_cookie_new (); + EphyCookie *info; nsEmbedCString transfer; cookie->GetHost (transfer); - info->domain = g_strdup (transfer.get()); + + nsCOMPtr<nsIIDNService> idnService + (do_GetService ("@mozilla.org/network/idn-service;1")); + NS_ENSURE_TRUE (idnService, nsnull); + + nsEmbedCString decoded; + /* ToUTF8 never fails, no need to check return value */ + idnService->ConvertACEtoUTF8 (transfer, decoded); + + info = ephy_cookie_new (); + info->domain = g_strdup (decoded.get()); + cookie->GetName (transfer); info->name = g_strdup (transfer.get()); cookie->GetValue (transfer); @@ -305,5 +321,12 @@ mozilla_permission_to_ephy_permission (nsIPermission *perm) nsEmbedCString host; perm->GetHost(host); - return ephy_permission_info_new (host.get(), type.get(), permission); + nsCOMPtr<nsIIDNService> idnService + (do_GetService ("@mozilla.org/network/idn-service;1")); + NS_ENSURE_TRUE (idnService, nsnull); + + nsEmbedCString decodedHost; + idnService->ConvertACEtoUTF8 (host, decodedHost); + + return ephy_permission_info_new (decodedHost.get(), type.get(), permission); } |