libproxy polish mozilla-1.9.2
authorWolfgang Rosenauer <wr@rosenauer.org>
Wed, 28 Jul 2010 07:36:41 +0200
branchmozilla-1.9.2
changeset 113 04527a174eec
parent 112 22a2c93a47ee
child 114 e81242664334
libproxy polish
mozilla-libproxy.patch
--- a/mozilla-libproxy.patch	Wed Jul 28 07:36:02 2010 +0200
+++ b/mozilla-libproxy.patch	Wed Jul 28 07:36:41 2010 +0200
@@ -169,7 +169,7 @@
 new file mode 100644
 --- /dev/null
 +++ b/toolkit/system/unixproxy/nsLibProxySettings.cpp
-@@ -0,0 +1,162 @@
+@@ -0,0 +1,159 @@
 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 +/* ***** BEGIN LICENSE BLOCK *****
 + * Version: MPL 1.1/GPL 2.0/LGPL 2.1
@@ -188,7 +188,7 @@
 + *
 + * The Initial Developer of the Original Code is
 + * Wolfgang Rosenauer <wr@rosenauer.org>.
-+ * Portions created by the Initial Developer are Copyright (C) 2009
++ * Portions created by the Initial Developer are Copyright (C) 2010
 + * the Initial Developer. All Rights Reserved.
 + *
 + * Contributor(s):
@@ -234,7 +234,6 @@
 +  }
 +
 +  pxProxyFactory *mProxyFactory;
-+  nsCOMPtr<nsIIOService> mIOService;
 +};
 +
 +NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings)
@@ -262,12 +261,10 @@
 +  if (!mProxyFactory) {
 +    mProxyFactory = px_proxy_factory_new();
 +  }
-+  NS_ENSURE_TRUE(mProxyFactory, NS_ERROR_OUT_OF_MEMORY);
++  NS_ENSURE_TRUE(mProxyFactory, NS_ERROR_NOT_AVAILABLE);
 +
-+  if (!mIOService) {
-+    mIOService = do_GetIOService();
-+  }
-+  NS_ENSURE_TRUE(mIOService, NS_ERROR_FAILURE);
++  nsCOMPtr<nsIIOService> ios = do_GetIOService(&rv);
++  NS_ENSURE_SUCCESS(rv, rv);
 +
 +  nsCAutoString spec;
 +  rv = aURI->GetSpec(spec);
@@ -275,11 +272,11 @@
 +
 +  char **proxyArray = nsnull;
 +  proxyArray = px_proxy_factory_get_proxies(mProxyFactory, (char*)(spec.get()));
-+  NS_ENSURE_TRUE(proxyArray, NS_ERROR_FAILURE);
++  NS_ENSURE_TRUE(proxyArray, NS_ERROR_NOT_AVAILABLE);
 +
-+  // PAC string accepts
-+  // http, proxy, socks, socks4, socks5, direct, unknown
-+  // example: "PROXY proxy1.foo.com:8080; PROXY proxy2.foo.com:8080; DIRECT"
++  // Translate libproxy's output to PAC string as expected
++  // libproxy's prefixes: http, proxy, socks, socks4, socks5, direct, unknown
++  // PAC format: "PROXY proxy1.foo.com:8080; PROXY proxy2.foo.com:8080; DIRECT"
 +  int c = 0;
 +  while (proxyArray[c] != NULL) {
 +    if (c != 0) {
@@ -291,10 +288,10 @@
 +    nsXPIDLCString hostPortString;
 +    nsCOMPtr<nsIURI> proxyURI;
 +
-+    rv = mIOService->NewURI(nsDependentCString(proxyArray[c]),
-+                                               nsnull,
-+                                               nsnull,
-+                                               getter_AddRefs(proxyURI));
++    rv = ios->NewURI(nsDependentCString(proxyArray[c]),
++                                        nsnull,
++                                        nsnull,
++                                        getter_AddRefs(proxyURI));
 +    NS_ENSURE_SUCCESS(rv, rv);
 +
 +    proxyURI->GetScheme(schemeString);