bug 833947 - system pac file at normalized uri fails r=jduell
authorPatrick McManus <mcmanus@ducksong.com>
Tue, 12 Feb 2013 13:29:27 -0500
changeset 131526 7836f6575a771421eb471a77e8ff3ee99397831a
parent 131525 ae25316d0a247da9123eb514011bfc1085e54ebd
child 131527 7d39a9c9cb7f79ed1d061b40450ef74a770c0be0
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs833947
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 833947 - system pac file at normalized uri fails r=jduell
netwerk/base/src/nsPACMan.cpp
netwerk/base/src/nsPACMan.h
--- a/netwerk/base/src/nsPACMan.cpp
+++ b/netwerk/base/src/nsPACMan.cpp
@@ -364,16 +364,17 @@ nsPACMan::LoadPACFromURI(const nsCString
   }
 
   CancelExistingLoad();
 
   mLoader = loader;
   if (!spec.IsEmpty()) {
     mPACURISpec = spec;
     mPACURIRedirectSpec.Truncate();
+    mNormalPACURISpec.Truncate(); // set at load time
     mLoadFailureCount = 0;  // reset
   }
 
   // reset to Null
   mScheduledReload = TimeStamp();
   return NS_OK;
 }
 
@@ -394,16 +395,17 @@ nsPACMan::StartLoading()
     nsCOMPtr<nsIIOService> ios = do_GetIOService();
     if (ios) {
       nsCOMPtr<nsIChannel> channel;
       nsCOMPtr<nsIURI> pacURI;
       NS_NewURI(getter_AddRefs(pacURI), mPACURISpec);
 
       // NOTE: This results in GetProxyForURI being called
       if (pacURI) {
+        pacURI->GetSpec(mNormalPACURISpec);
         ios->NewChannelFromURI(pacURI, getter_AddRefs(channel));
       }
       else {
         LOG(("nsPACMan::StartLoading Failed pacspec uri conversion %s\n",
              mPACURISpec.get()));
       }
 
       if (channel) {
--- a/netwerk/base/src/nsPACMan.h
+++ b/netwerk/base/src/nsPACMan.h
@@ -131,17 +131,18 @@ public:
    * URI it has been redirected to. In the case of a chain of redirections
    * only the current one being followed and the original are considered
    * becuase this information is used, respectively, to determine if we
    * should bypass the proxy (to fetch the pac file) or if the pac
    * configuration has changed (and we should reload the pac file)
    */
   bool IsPACURI(const nsACString &spec)
   {
-    return mPACURISpec.Equals(spec) || mPACURIRedirectSpec.Equals(spec);
+    return mPACURISpec.Equals(spec) || mPACURIRedirectSpec.Equals(spec) ||
+      mNormalPACURISpec.Equals(spec);
   }
 
   bool IsPACURI(nsIURI *uri) {
     if (mPACURISpec.IsEmpty() && mPACURIRedirectSpec.IsEmpty())
       return false;
 
     nsAutoCString tmp;
     uri->GetSpec(tmp);
@@ -201,18 +202,23 @@ private:
 
 private:
   mozilla::net::ProxyAutoConfig mPAC;
   nsCOMPtr<nsIThread>           mPACThread;
   nsCOMPtr<nsISystemProxySettings> mSystemProxySettings;
 
   mozilla::LinkedList<PendingPACQuery> mPendingQ; /* pac thread only */
 
-  nsCString                    mPACURISpec; // Not an nsIURI for use off main thread
+  // These specs are not nsIURI so that they can be used off the main thread.
+  // The non-normalized versions are directly from the configuration, the
+  // normalized version has been extracted from an nsIURI
+  nsCString                    mPACURISpec;
   nsCString                    mPACURIRedirectSpec;
+  nsCString                    mNormalPACURISpec;
+
   nsCOMPtr<nsIStreamLoader>    mLoader;
   bool                         mLoadPending;
   bool                         mShutdown;
   mozilla::TimeStamp           mScheduledReload;
   uint32_t                     mLoadFailureCount;
 
   bool                         mInProgress;
 };