Bug 1348462 - Use a process-unique uint64 instead of a uuid for request context ids r=mcmanus
authorNicholas Hurley <hurley@mozilla.com>
Thu, 23 Mar 2017 07:40:36 -0700
changeset 351031 f469eec0a987579f214df8f728f4e7cadde26ad2
parent 351030 381d637f43a18df25ccd7e759793080cff040d66
child 351032 c2363a9e7d2f5a5e952a3f4e907d8210ea24e504
push id31598
push usercbook@mozilla.com
push dateTue, 04 Apr 2017 10:33:38 +0000
treeherdermozilla-central@916a4ee676a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1348462
milestone55.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 1348462 - Use a process-unique uint64 instead of a uuid for request context ids r=mcmanus
netwerk/base/RequestContextService.cpp
netwerk/base/RequestContextService.h
netwerk/base/nsILoadGroup.idl
netwerk/base/nsIRequestContext.idl
netwerk/base/nsLoadGroup.cpp
netwerk/ipc/NeckoChannelParams.ipdlh
netwerk/ipc/NeckoParent.cpp
netwerk/ipc/NeckoParent.h
netwerk/ipc/PNecko.ipdl
netwerk/protocol/http/HttpBaseChannel.cpp
netwerk/protocol/http/HttpBaseChannel.h
netwerk/protocol/http/HttpChannelChild.cpp
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/HttpChannelParent.h
netwerk/protocol/http/NullHttpChannel.cpp
netwerk/protocol/http/nsIHttpChannel.idl
netwerk/protocol/viewsource/nsViewSourceChannel.cpp
--- a/netwerk/base/RequestContextService.cpp
+++ b/netwerk/base/RequestContextService.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 ;*; */
 /* vim: set sw=2 ts=8 et tw=80 : */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsAutoPtr.h"
 #include "nsIObserverService.h"
-#include "nsIUUIDGenerator.h"
+#include "nsIXULRuntime.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "RequestContextService.h"
 
 #include "mozilla/Atomics.h"
 #include "mozilla/Services.h"
 
 #include "mozilla/net/PSpdyPush.h"
@@ -21,34 +21,32 @@ namespace net {
 
 // nsIRequestContext
 class RequestContext final : public nsIRequestContext
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIREQUESTCONTEXT
 
-  explicit RequestContext(const nsID& id);
+  explicit RequestContext(const uint64_t id);
 private:
   virtual ~RequestContext();
 
-  nsID mID;
-  char mCID[NSID_LENGTH];
+  uint64_t mID;
   Atomic<uint32_t>       mBlockingTransactionCount;
   nsAutoPtr<SpdyPushCache> mSpdyCache;
   nsCString mUserAgentOverride;
 };
 
 NS_IMPL_ISUPPORTS(RequestContext, nsIRequestContext)
 
-RequestContext::RequestContext(const nsID& aID)
-  : mBlockingTransactionCount(0)
+RequestContext::RequestContext(const uint64_t aID)
+  : mID(aID)
+  , mBlockingTransactionCount(0)
 {
-  mID = aID;
-  mID.ToProvidedString(mCID);
 }
 
 RequestContext::~RequestContext()
 {
 }
 
 NS_IMETHODIMP
 RequestContext::GetBlockingTransactionCount(uint32_t *aBlockingTransactionCount)
@@ -84,17 +82,17 @@ RequestContext::GetSpdyPushCache(mozilla
 NS_IMETHODIMP
 RequestContext::SetSpdyPushCache(mozilla::net::SpdyPushCache *aSpdyPushCache)
 {
   mSpdyCache = aSpdyPushCache;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-RequestContext::GetID(nsID *outval)
+RequestContext::GetID(uint64_t *outval)
 {
   NS_ENSURE_ARG_POINTER(outval);
   *outval = mID;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 RequestContext::GetUserAgentOverride(nsACString& aUserAgentOverride)
@@ -112,20 +110,24 @@ RequestContext::SetUserAgentOverride(con
 
 
 //nsIRequestContextService
 RequestContextService *RequestContextService::sSelf = nullptr;
 
 NS_IMPL_ISUPPORTS(RequestContextService, nsIRequestContextService, nsIObserver)
 
 RequestContextService::RequestContextService()
+  : mNextRCID(1)
 {
   MOZ_ASSERT(!sSelf, "multiple rcs instances!");
   MOZ_ASSERT(NS_IsMainThread());
   sSelf = this;
+
+  nsCOMPtr<nsIXULRuntime> runtime = do_GetService("@mozilla.org/xre/runtime;1");
+  runtime->GetProcessID(&mRCIDNamespace);
 }
 
 RequestContextService::~RequestContextService()
 {
   MOZ_ASSERT(NS_IsMainThread());
   Shutdown();
   sSelf = nullptr;
 }
@@ -160,17 +162,17 @@ RequestContextService::Create(nsISupport
   RefPtr<RequestContextService> svc = new RequestContextService();
   nsresult rv = svc->Init();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return svc->QueryInterface(aIID, aResult);
 }
 
 NS_IMETHODIMP
-RequestContextService::GetRequestContext(const nsID& rcID, nsIRequestContext **rc)
+RequestContextService::GetRequestContext(const uint64_t rcID, nsIRequestContext **rc)
 {
   MOZ_ASSERT(NS_IsMainThread());
   NS_ENSURE_ARG_POINTER(rc);
   *rc = nullptr;
 
   if (!mTable.Get(rcID, rc)) {
     nsCOMPtr<nsIRequestContext> newSC = new RequestContext(rcID);
     mTable.Put(rcID, newSC);
@@ -182,35 +184,27 @@ RequestContextService::GetRequestContext
 
 NS_IMETHODIMP
 RequestContextService::NewRequestContext(nsIRequestContext **rc)
 {
   MOZ_ASSERT(NS_IsMainThread());
   NS_ENSURE_ARG_POINTER(rc);
   *rc = nullptr;
 
-  nsresult rv;
-  if (!mUUIDGen) {
-    mUUIDGen = do_GetService("@mozilla.org/uuid-generator;1", &rv);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  nsID rcID;
-  rv = mUUIDGen->GenerateUUIDInPlace(&rcID);
-  NS_ENSURE_SUCCESS(rv, rv);
+  uint64_t rcID = ((static_cast<uint64_t>(mRCIDNamespace) << 32) & 0xFFFFFFFF00000000LL) | mNextRCID++;
 
   nsCOMPtr<nsIRequestContext> newSC = new RequestContext(rcID);
   mTable.Put(rcID, newSC);
   newSC.swap(*rc);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-RequestContextService::RemoveRequestContext(const nsID& rcID)
+RequestContextService::RemoveRequestContext(const uint64_t rcID)
 {
   MOZ_ASSERT(NS_IsMainThread());
   mTable.Remove(rcID);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 RequestContextService::Observe(nsISupports *subject, const char *topic,
--- a/netwerk/base/RequestContextService.h
+++ b/netwerk/base/RequestContextService.h
@@ -7,18 +7,16 @@
 #ifndef mozilla__net__RequestContextService_h
 #define mozilla__net__RequestContextService_h
 
 #include "nsCOMPtr.h"
 #include "nsInterfaceHashtable.h"
 #include "nsIObserver.h"
 #include "nsIRequestContext.h"
 
-class nsIUUIDGenerator;
-
 namespace mozilla {
 namespace net {
 
 class RequestContextService final
   : public nsIRequestContextService
   , public nsIObserver
 {
 public:
@@ -32,16 +30,17 @@ public:
   void Shutdown();
   static nsresult Create(nsISupports *outer, const nsIID& iid, void **result);
 
 private:
   virtual ~RequestContextService();
 
   static RequestContextService *sSelf;
 
-  nsInterfaceHashtable<nsIDHashKey, nsIRequestContext> mTable;
-  nsCOMPtr<nsIUUIDGenerator> mUUIDGen;
+  nsInterfaceHashtable<nsUint64HashKey, nsIRequestContext> mTable;
+  uint32_t mRCIDNamespace;
+  uint32_t mNextRCID;
 };
 
 } // ::mozilla::net
 } // ::mozilla
 
 #endif // mozilla__net__RequestContextService_h
--- a/netwerk/base/nsILoadGroup.idl
+++ b/netwerk/base/nsILoadGroup.idl
@@ -76,17 +76,17 @@ interface nsILoadGroup : nsIRequest
      * Notification callbacks for the load group.
      */
     attribute nsIInterfaceRequestor notificationCallbacks;
 
     /**
      * Context for managing things like js/css connection blocking,
      * and per-tab connection grouping.
      */
-    [noscript] readonly attribute nsID requestContextID;
+    [noscript] readonly attribute unsigned long long requestContextID;
 
     /**
      * The set of load flags that will be added to all new requests added to
      * this group. Any existing requests in the load group are not modified,
      * so it is expected these flags will be added before requests are added
      * to the group - typically via nsIDocShell::defaultLoadFlags on a new
      * docShell.
      * Note that these flags are *not* added to the default request for the
--- a/netwerk/base/nsIRequestContext.idl
+++ b/netwerk/base/nsIRequestContext.idl
@@ -25,17 +25,17 @@ class SpdyPushCache;
  * This used to be known as nsILoadGroupConnectionInfo and nsISchedulingContext.
  */
 [scriptable, uuid(658e3e6e-8633-4b1a-8d66-fa9f72293e63)]
 interface nsIRequestContext : nsISupports
 {
   /**
    * A unique identifier for this request context
    */
-  [noscript] readonly attribute nsID ID;
+  [noscript] readonly attribute unsigned long long ID;
 
   /**
    * Number of active blocking transactions associated with this context
    */
   readonly attribute unsigned long blockingTransactionCount;
 
   /**
    * Increase the number of active blocking transactions associated
@@ -76,20 +76,20 @@ interface nsIRequestContext : nsISupport
  * will get a reference to the same request context you have.
  */
 [uuid(7fcbf4da-d828-4acc-b144-e5435198f727)]
 interface nsIRequestContextService : nsISupports
 {
   /**
    * Get an existing request context from its ID
    */
-  nsIRequestContext getRequestContext(in nsIDRef id);
+  nsIRequestContext getRequestContext(in unsigned long long id);
 
   /**
    * Create a new request context
    */
   nsIRequestContext newRequestContext();
 
   /**
    * Remove an existing request context from its ID
    */
-  void removeRequestContext(in nsIDRef id);
+  void removeRequestContext(in unsigned long long id);
 };
--- a/netwerk/base/nsLoadGroup.cpp
+++ b/netwerk/base/nsLoadGroup.cpp
@@ -122,27 +122,21 @@ nsLoadGroup::nsLoadGroup(nsISupports* ou
 nsLoadGroup::~nsLoadGroup()
 {
     DebugOnly<nsresult> rv = Cancel(NS_BINDING_ABORTED);
     NS_ASSERTION(NS_SUCCEEDED(rv), "Cancel failed");
 
     mDefaultLoadRequest = nullptr;
 
     if (mRequestContext) {
-        nsID rcid;
+        uint64_t rcid;
         mRequestContext->GetID(&rcid);
 
         if (IsNeckoChild() && gNeckoChild) {
-            char rcid_str[NSID_LENGTH];
-            rcid.ToProvidedString(rcid_str);
-
-            nsCString rcid_nscs;
-            rcid_nscs.AssignASCII(rcid_str);
-
-            gNeckoChild->SendRemoveRequestContext(rcid_nscs);
+            gNeckoChild->SendRemoveRequestContext(rcid);
         } else {
             mRequestContextService->RemoveRequestContext(rcid);
         }
     }
 
     LOG(("LOADGROUP [%p]: Destroyed.\n", this));
 }
 
@@ -698,17 +692,17 @@ nsLoadGroup::GetNotificationCallbacks(ns
 NS_IMETHODIMP
 nsLoadGroup::SetNotificationCallbacks(nsIInterfaceRequestor *aCallbacks)
 {
     mCallbacks = aCallbacks;
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLoadGroup::GetRequestContextID(nsID *aRCID)
+nsLoadGroup::GetRequestContextID(uint64_t *aRCID)
 {
     if (!mRequestContext) {
         return NS_ERROR_NOT_AVAILABLE;
     }
     return mRequestContext->GetID(aRCID);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/netwerk/ipc/NeckoChannelParams.ipdlh
+++ b/netwerk/ipc/NeckoChannelParams.ipdlh
@@ -116,17 +116,17 @@ struct HttpChannelOpenArgs
   nsCString                   appCacheClientID;
   bool                        allowSpdy;
   bool                        allowAltSvc;
   bool                        beConservative;
   OptionalLoadInfoArgs        loadInfo;
   OptionalHttpResponseHead    synthesizedResponseHead;
   nsCString                   synthesizedSecurityInfoSerialization;
   uint32_t                    cacheKey;
-  nsCString                   requestContextID;
+  uint64_t                    requestContextID;
   OptionalCorsPreflightArgs   preflightArgs;
   uint32_t                    initialRwin;
   bool                        blockAuthPrompt;
   bool                        suspendAfterSynthesizeResponse;
   bool                        allowStaleCacheContent;
   nsCString                   contentTypeHint;
   nsCString                   channelId;
   uint64_t                    contentWindowId;
--- a/netwerk/ipc/NeckoParent.cpp
+++ b/netwerk/ipc/NeckoParent.cpp
@@ -903,27 +903,25 @@ NeckoParent::RecvPredReset()
     do_GetService("@mozilla.org/network/predictor;1", &rv);
   NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this));
 
   predictor->Reset();
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
-NeckoParent::RecvRemoveRequestContext(const nsCString& rcid)
+NeckoParent::RecvRemoveRequestContext(const uint64_t& rcid)
 {
   nsCOMPtr<nsIRequestContextService> rcsvc =
     do_GetService("@mozilla.org/network/request-context-service;1");
   if (!rcsvc) {
     return IPC_OK();
   }
 
-  nsID id;
-  id.Parse(rcid.BeginReading());
-  rcsvc->RemoveRequestContext(id);
+  rcsvc->RemoveRequestContext(rcid);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 NeckoParent::RecvIncreaseThrottlePressure()
 {
   mThrottlers.AppendElement(mozilla::UniquePtr<mozilla::net::Throttler>(new mozilla::net::Throttler));
--- a/netwerk/ipc/NeckoParent.h
+++ b/netwerk/ipc/NeckoParent.h
@@ -222,17 +222,17 @@ protected:
                                                   const bool& hasVerifier) override;
 
   virtual mozilla::ipc::IPCResult RecvPredLearn(const ipc::URIParams& aTargetURI,
                                                 const ipc::OptionalURIParams& aSourceURI,
                                                 const PredictorPredictReason& aReason,
                                                 const OriginAttributes& aOriginAttributes) override;
   virtual mozilla::ipc::IPCResult RecvPredReset() override;
 
-  virtual mozilla::ipc::IPCResult RecvRemoveRequestContext(const nsCString& rcid) override;
+  virtual mozilla::ipc::IPCResult RecvRemoveRequestContext(const uint64_t& rcid) override;
 
   /* Throttler messages */
   virtual mozilla::ipc::IPCResult RecvIncreaseThrottlePressure() override;
   virtual mozilla::ipc::IPCResult RecvDecreaseThrottlePressure() override;
 
   virtual mozilla::ipc::IPCResult
   RecvNotifyCurrentTopLevelOuterContentWindowId(const uint64_t& aWindowId) override;
 private:
--- a/netwerk/ipc/PNecko.ipdl
+++ b/netwerk/ipc/PNecko.ipdl
@@ -111,17 +111,17 @@ parent:
    * These are called from the child with the results of the auth prompt.
    * callbackId is the id that was passed in PBrowser::AsyncAuthPrompt,
    * corresponding to an nsIAuthPromptCallback
    */
   async OnAuthAvailable(uint64_t callbackId, nsString user,
                         nsString password, nsString domain);
   async OnAuthCancelled(uint64_t callbackId, bool userCancel);
 
-  async RemoveRequestContext(nsCString rcid);
+  async RemoveRequestContext(uint64_t rcid);
 
   async PAltDataOutputStream(nsCString type, PHttpChannel channel);
 
   async PStunAddrsRequest();
 
   /**
    * Throttling of channels
    */
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -194,16 +194,17 @@ HttpBaseChannel::HttpBaseChannel()
   , mRedirectMode(nsIHttpChannelInternal::REDIRECT_MODE_FOLLOW)
   , mFetchCacheMode(nsIHttpChannelInternal::FETCH_CACHE_MODE_DEFAULT)
   , mOnStartRequestCalled(false)
   , mOnStopRequestCalled(false)
   , mAfterOnStartRequestBegun(false)
   , mTransferSize(0)
   , mDecodedBodySize(0)
   , mEncodedBodySize(0)
+  , mRequestContextID(0)
   , mContentWindowId(0)
   , mTopLevelOuterContentWindowId(0)
   , mRequireCORSPreflight(false)
   , mReportCollector(new ConsoleReportCollector())
   , mAltDataLength(0)
   , mForceMainDocumentChannel(false)
   , mIsTrackingResource(false)
 {
@@ -213,17 +214,16 @@ HttpBaseChannel::HttpBaseChannel()
 #ifdef MOZ_VALGRIND
   // Zero the entire unions so that Valgrind doesn't complain when we send them
   // to another process.
   memset(&mSelfAddr, 0, sizeof(NetAddr));
   memset(&mPeerAddr, 0, sizeof(NetAddr));
 #endif
   mSelfAddr.raw.family = PR_AF_UNSPEC;
   mPeerAddr.raw.family = PR_AF_UNSPEC;
-  mRequestContextID.Clear();
 }
 
 HttpBaseChannel::~HttpBaseChannel()
 {
   LOG(("Destroying HttpBaseChannel @%p\n", this));
 
   // Make sure we don't leak
   CleanRedirectCacheChainIfNecessary();
@@ -2118,25 +2118,25 @@ HttpBaseChannel::RedirectTo(nsIURI *targ
   // This would break the nsIStreamListener contract.
   NS_ENSURE_FALSE(mOnStartRequestCalled, NS_ERROR_NOT_AVAILABLE);
 
   mAPIRedirectToURI = targetURI;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-HttpBaseChannel::GetRequestContextID(nsID *aRCID)
+HttpBaseChannel::GetRequestContextID(uint64_t *aRCID)
 {
   NS_ENSURE_ARG_POINTER(aRCID);
   *aRCID = mRequestContextID;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-HttpBaseChannel::SetRequestContextID(const nsID aRCID)
+HttpBaseChannel::SetRequestContextID(uint64_t aRCID)
 {
   mRequestContextID = aRCID;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HttpBaseChannel::GetIsMainDocumentChannel(bool* aValue)
 {
@@ -3819,19 +3819,17 @@ HttpBaseChannel::GetThrottleQueue(nsIInp
   return NS_OK;
 }
 
 //------------------------------------------------------------------------------
 
 bool
 HttpBaseChannel::EnsureRequestContextID()
 {
-    nsID nullID;
-    nullID.Clear();
-    if (!mRequestContextID.Equals(nullID)) {
+    if (mRequestContextID) {
         // Already have a request context ID, no need to do the rest of this work
         return true;
     }
 
     // Find the loadgroup at the end of the chain in order
     // to make sure all channels derived from the load group
     // use the same connection scope.
     nsCOMPtr<nsILoadGroupChild> childLoadGroup = do_QueryInterface(mLoadGroup);
--- a/netwerk/protocol/http/HttpBaseChannel.h
+++ b/netwerk/protocol/http/HttpBaseChannel.h
@@ -189,21 +189,21 @@ public:
   NS_IMETHOD SetRedirectionLimit(uint32_t value) override;
   NS_IMETHOD IsNoStoreResponse(bool *value) override;
   NS_IMETHOD IsNoCacheResponse(bool *value) override;
   NS_IMETHOD IsPrivateResponse(bool *value) override;
   NS_IMETHOD GetResponseStatus(uint32_t *aValue) override;
   NS_IMETHOD GetResponseStatusText(nsACString& aValue) override;
   NS_IMETHOD GetRequestSucceeded(bool *aValue) override;
   NS_IMETHOD RedirectTo(nsIURI *newURI) override;
-  NS_IMETHOD GetRequestContextID(nsID *aRCID) override;
+  NS_IMETHOD GetRequestContextID(uint64_t *aRCID) override;
   NS_IMETHOD GetTransferSize(uint64_t *aTransferSize) override;
   NS_IMETHOD GetDecodedBodySize(uint64_t *aDecodedBodySize) override;
   NS_IMETHOD GetEncodedBodySize(uint64_t *aEncodedBodySize) override;
-  NS_IMETHOD SetRequestContextID(const nsID aRCID) override;
+  NS_IMETHOD SetRequestContextID(uint64_t aRCID) override;
   NS_IMETHOD GetIsMainDocumentChannel(bool* aValue) override;
   NS_IMETHOD SetIsMainDocumentChannel(bool aValue) override;
   NS_IMETHOD GetProtocolVersion(nsACString & aProtocolVersion) override;
   NS_IMETHOD GetChannelId(nsACString& aChannelId) override;
   NS_IMETHOD SetChannelId(const nsACString& aChannelId) override;
   NS_IMETHOD GetTopLevelContentWindowId(uint64_t *aContentWindowId) override;
   NS_IMETHOD SetTopLevelContentWindowId(uint64_t aContentWindowId) override;
   NS_IMETHOD GetTopLevelOuterContentWindowId(uint64_t *aWindowId) override;
@@ -582,17 +582,17 @@ protected:
 
   uint64_t mTransferSize;
   uint64_t mDecodedBodySize;
   uint64_t mEncodedBodySize;
 
   // The network interface id that's associated with this channel.
   nsCString mNetworkInterfaceId;
 
-  nsID mRequestContextID;
+  uint64_t mRequestContextID;
   bool EnsureRequestContextID();
 
   // ID of the top-level document's inner window this channel is being
   // originated from.
   uint64_t mContentWindowId;
 
   uint64_t mTopLevelOuterContentWindowId;
   void EnsureTopLevelOuterContentWindowId();
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -2411,19 +2411,17 @@ HttpChannelChild::ContinueAsyncOpen()
   openArgs.allowStaleCacheContent() = mAllowStaleCacheContent;
 
   openArgs.contentTypeHint() = mContentTypeHint;
 
   nsresult rv = mozilla::ipc::LoadInfoToLoadInfoArgs(mLoadInfo, &openArgs.loadInfo());
   NS_ENSURE_SUCCESS(rv, rv);
 
   EnsureRequestContextID();
-  char rcid[NSID_LENGTH];
-  mRequestContextID.ToProvidedString(rcid);
-  openArgs.requestContextID().AssignASCII(rcid);
+  openArgs.requestContextID() = mRequestContextID;
 
   char chid[NSID_LENGTH];
   mChannelId.ToProvidedString(chid);
   openArgs.channelId().AssignASCII(chid);
 
   openArgs.contentWindowId() = contentWindowId;
   openArgs.topLevelOuterContentWindowId() = mTopLevelOuterContentWindowId;
 
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -316,17 +316,17 @@ HttpChannelParent::DoAsyncOpen(  const U
                                  const nsCString&           appCacheClientID,
                                  const bool&                allowSpdy,
                                  const bool&                allowAltSvc,
                                  const bool&                beConservative,
                                  const OptionalLoadInfoArgs& aLoadInfoArgs,
                                  const OptionalHttpResponseHead& aSynthesizedResponseHead,
                                  const nsCString&           aSecurityInfoSerialization,
                                  const uint32_t&            aCacheKey,
-                                 const nsCString&           aRequestContextID,
+                                 const uint64_t&            aRequestContextID,
                                  const OptionalCorsPreflightArgs& aCorsPreflightArgs,
                                  const uint32_t&            aInitialRwin,
                                  const bool&                aBlockAuthPrompt,
                                  const bool&                aSuspendAfterSynthesizeResponse,
                                  const bool&                aAllowStaleCacheContent,
                                  const nsCString&           aContentTypeHint,
                                  const nsCString&           aChannelId,
                                  const uint64_t&            aContentWindowId,
@@ -572,19 +572,17 @@ HttpChannelParent::DoAsyncOpen(  const U
       // This works because we've already called SetNotificationCallbacks and
       // done mPBOverride logic by this point.
       chooseAppCache = NS_ShouldCheckAppCache(principal, NS_UsePrivateBrowsing(mChannel));
 
       appCacheChan->SetChooseApplicationCache(chooseAppCache);
     }
   }
 
-  nsID requestContextID;
-  requestContextID.Parse(aRequestContextID.BeginReading());
-  mChannel->SetRequestContextID(requestContextID);
+  mChannel->SetRequestContextID(aRequestContextID);
 
   mSuspendAfterSynthesizeResponse = aSuspendAfterSynthesizeResponse;
 
   if (!delayAsyncOpen) {
     InvokeAsyncOpen(NS_OK);
   }
 
   return true;
--- a/netwerk/protocol/http/HttpChannelParent.h
+++ b/netwerk/protocol/http/HttpChannelParent.h
@@ -134,17 +134,17 @@ protected:
               const nsCString&           appCacheClientID,
               const bool&                allowSpdy,
               const bool&                allowAltSvc,
               const bool&                beConservative,
               const OptionalLoadInfoArgs& aLoadInfoArgs,
               const OptionalHttpResponseHead& aSynthesizedResponseHead,
               const nsCString&           aSecurityInfoSerialization,
               const uint32_t&            aCacheKey,
-              const nsCString&           aRequestContextID,
+              const uint64_t&            aRequestContextID,
               const OptionalCorsPreflightArgs& aCorsPreflightArgs,
               const uint32_t&            aInitialRwin,
               const bool&                aBlockAuthPrompt,
               const bool&                aSuspendAfterSynthesizeResponse,
               const bool&                aAllowStaleCacheContent,
               const nsCString&           aContentTypeHint,
               const nsCString&           aChannelId,
               const uint64_t&            aContentWindowId,
--- a/netwerk/protocol/http/NullHttpChannel.cpp
+++ b/netwerk/protocol/http/NullHttpChannel.cpp
@@ -284,23 +284,23 @@ NullHttpChannel::IsPrivateResponse(bool 
 
 NS_IMETHODIMP
 NullHttpChannel::RedirectTo(nsIURI *aNewURI)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-NullHttpChannel::GetRequestContextID(nsID *_retval)
+NullHttpChannel::GetRequestContextID(uint64_t *_retval)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-NullHttpChannel::SetRequestContextID(const nsID rcID)
+NullHttpChannel::SetRequestContextID(uint64_t rcID)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 NullHttpChannel::GetProtocolVersion(nsACString& aProtocolVersion)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
--- a/netwerk/protocol/http/nsIHttpChannel.idl
+++ b/netwerk/protocol/http/nsIHttpChannel.idl
@@ -442,17 +442,17 @@ interface nsIHttpChannel : nsIChannel
      * @throws NS_ERROR_NOT_AVAILABLE if called after the channel has already
      *         started to deliver the content to its listener.
      */
     [must_use] void redirectTo(in nsIURI aTargetURI);
 
     /**
      * Identifies the request context for this load.
      */
-    [noscript, must_use] attribute nsID requestContextID;
+    [noscript, must_use] attribute uint64_t requestContextID;
 
     /**
      * Unique ID of the channel, shared between parent and child. Needed if
      * the channel activity needs to be monitored across process boundaries,
      * like in devtools net monitor. See bug 1274556.
      */
     [must_use] attribute ACString channelId;
 
--- a/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
+++ b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
@@ -997,24 +997,24 @@ nsViewSourceChannel::IsPrivateResponse(b
 NS_IMETHODIMP
 nsViewSourceChannel::RedirectTo(nsIURI *uri)
 {
     return !mHttpChannel ? NS_ERROR_NULL_POINTER :
         mHttpChannel->RedirectTo(uri);
 }
 
 NS_IMETHODIMP
-nsViewSourceChannel::GetRequestContextID(nsID *_retval)
+nsViewSourceChannel::GetRequestContextID(uint64_t *_retval)
 {
     return !mHttpChannel ? NS_ERROR_NULL_POINTER :
         mHttpChannel->GetRequestContextID(_retval);
 }
 
 NS_IMETHODIMP
-nsViewSourceChannel::SetRequestContextID(const nsID rcid)
+nsViewSourceChannel::SetRequestContextID(uint64_t rcid)
 {
     return !mHttpChannel ? NS_ERROR_NULL_POINTER :
         mHttpChannel->SetRequestContextID(rcid);
 }
 
 NS_IMETHODIMP
 nsViewSourceChannel::GetIsMainDocumentChannel(bool* aValue)
 {