Backed out 4 changesets (bug 1532253) for Windows bustage at Unified_cpp_netwerk_base2.i_o on a CLOSED TREE.
authorGurzau Raul <rgurzau@mozilla.com>
Mon, 11 Mar 2019 15:22:39 +0200
changeset 521356 949fbfb190a2627fbbeb842ac90e2ad7ed96c038
parent 521355 498d0bcc8ce8b5cc8c5f7b9af8ebda9136718e12
child 521357 a298dcb1bc36f0087dab0c26ee170d87d86c23b8
push id10866
push usernerli@mozilla.com
push dateTue, 12 Mar 2019 18:59:09 +0000
treeherdermozilla-beta@445c24a51727 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1532253
milestone67.0a1
backs out498d0bcc8ce8b5cc8c5f7b9af8ebda9136718e12
8e10880ff30b14d588329924f59b7e5ade671bfa
0491d225285c9ed0228228fb785b99a3fddc8f36
5384779a3b1f8835ebd2fbe16103744111d3896d
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
Backed out 4 changesets (bug 1532253) for Windows bustage at Unified_cpp_netwerk_base2.i_o on a CLOSED TREE. Backed out changeset 498d0bcc8ce8 (bug 1532253) Backed out changeset 8e10880ff30b (bug 1532253) Backed out changeset 0491d225285c (bug 1532253) Backed out changeset 5384779a3b1f (bug 1532253)
chrome/moz.build
chrome/nsChromeProtocolHandler.cpp
chrome/nsChromeProtocolHandler.h
dom/base/nsContentUtils.cpp
dom/file/uri/BlobURL.cpp
dom/file/uri/BlobURL.h
dom/file/uri/BlobURLProtocolHandler.cpp
dom/file/uri/BlobURLProtocolHandler.h
dom/jsurl/nsJSProtocolHandler.cpp
dom/jsurl/nsJSProtocolHandler.h
mfbt/ThreadLocal.h
netwerk/base/nsNetUtil.cpp
netwerk/base/nsNetUtil.h
netwerk/protocol/data/moz.build
netwerk/protocol/data/nsDataHandler.cpp
netwerk/protocol/data/nsDataHandler.h
netwerk/test/gtest/TestURIMutator.cpp
xpcom/threads/ThreadLocalVariables.cpp
xpcom/threads/moz.build
xpcom/threads/nsThread.cpp
--- a/chrome/moz.build
+++ b/chrome/moz.build
@@ -8,20 +8,16 @@ TEST_DIRS += ['test']
 
 XPIDL_SOURCES += [
     'nsIChromeRegistry.idl',
     'nsIToolkitChromeRegistry.idl',
 ]
 
 XPIDL_MODULE = 'chrome'
 
-EXPORTS += [
-    'nsChromeProtocolHandler.h',
-]
-
 EXPORTS.mozilla.chrome += [
     'RegistryMessageUtils.h',
 ]
 
 UNIFIED_SOURCES += [
     'nsChromeProtocolHandler.cpp',
     'nsChromeRegistry.cpp',
     'nsChromeRegistryChrome.cpp',
--- a/chrome/nsChromeProtocolHandler.cpp
+++ b/chrome/nsChromeProtocolHandler.cpp
@@ -61,23 +61,16 @@ NS_IMETHODIMP
 nsChromeProtocolHandler::GetProtocolFlags(uint32_t *result) {
   *result = URI_STD | URI_IS_UI_RESOURCE | URI_IS_LOCAL_RESOURCE;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsChromeProtocolHandler::NewURI(const nsACString &aSpec, const char *aCharset,
                                 nsIURI *aBaseURI, nsIURI **result) {
-  return nsChromeProtocolHandler::CreateNewURI(aSpec, aCharset, aBaseURI,
-                                               result);
-}
-
-/* static */ nsresult nsChromeProtocolHandler::CreateNewURI(
-    const nsACString &aSpec, const char *aCharset, nsIURI *aBaseURI,
-    nsIURI **result) {
   // Chrome: URLs (currently) have no additional structure beyond that provided
   // by standard URLs, so there is no "outer" given to CreateInstance
   nsresult rv;
   nsCOMPtr<nsIURI> surl;
   nsCOMPtr<nsIURI> base(aBaseURI);
   rv = NS_MutateURI(new mozilla::net::nsStandardURL::Mutator())
            .Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
                                    nsIStandardURL::URLTYPE_STANDARD, -1,
--- a/chrome/nsChromeProtocolHandler.h
+++ b/chrome/nsChromeProtocolHandler.h
@@ -22,16 +22,14 @@ class nsChromeProtocolHandler final : pu
  public:
   NS_DECL_THREADSAFE_ISUPPORTS
 
   // nsIProtocolHandler methods:
   NS_DECL_NSIPROTOCOLHANDLER
 
   // nsChromeProtocolHandler methods:
   nsChromeProtocolHandler() {}
-  static nsresult CreateNewURI(const nsACString &aSpec, const char *aCharset,
-                               nsIURI *aBaseURI, nsIURI **result);
 
  private:
   ~nsChromeProtocolHandler() {}
 };
 
 #endif /* nsChromeProtocolHandler_h___ */
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -184,17 +184,16 @@
 #include "nsIScriptGlobalObject.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIScrollable.h"
 #include "nsIStreamConverter.h"
 #include "nsIStreamConverterService.h"
 #include "nsIStringBundle.h"
 #include "nsIURI.h"
-#include "nsIURIMutator.h"
 #include "nsIURIWithSpecialOrigin.h"
 #include "nsIURL.h"
 #include "nsIWebNavigation.h"
 #include "nsIWidget.h"
 #include "nsIWindowMediator.h"
 #include "nsIXPConnect.h"
 #include "nsJSUtils.h"
 #include "nsMappedAttributes.h"
@@ -5981,29 +5980,30 @@ nsresult nsContentUtils::GetUTFOrigin(ns
 
   nsCOMPtr<nsIURI> uri = NS_GetInnermostURI(aURI);
   NS_ENSURE_TRUE(uri, NS_ERROR_UNEXPECTED);
 
   nsAutoCString host;
   rv = uri->GetHost(host);
 
   if (NS_SUCCEEDED(rv) && !host.IsEmpty()) {
-    nsAutoCString userPass;
-    uri->GetUserPass(userPass);
-
-    nsAutoCString prePath;
-    if (!userPass.IsEmpty()) {
-      rv = NS_MutateURI(uri).SetUserPass(EmptyCString()).Finalize(uri);
-      NS_ENSURE_SUCCESS(rv, rv);
-    }
-
-    rv = uri->GetPrePath(prePath);
+    nsAutoCString scheme;
+    rv = uri->GetScheme(scheme);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    aOrigin = NS_ConvertUTF8toUTF16(prePath);
+    int32_t port = -1;
+    uri->GetPort(&port);
+    if (port != -1 && port == NS_GetDefaultPort(scheme.get())) port = -1;
+
+    nsAutoCString hostPort;
+    rv = NS_GenerateHostPort(host, port, hostPort);
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    aOrigin =
+        NS_ConvertUTF8toUTF16(scheme + NS_LITERAL_CSTRING("://") + hostPort);
   } else {
     aOrigin.AssignLiteral("null");
   }
 
   return NS_OK;
 }
 
 /* static */
--- a/dom/file/uri/BlobURL.cpp
+++ b/dom/file/uri/BlobURL.cpp
@@ -147,17 +147,17 @@ nsresult BlobURL::EqualsInternal(
       mozilla::net::nsSimpleURI::EqualsInternal(otherUri, aRefHandlingMode);
 
   // We don't want to compare the revoked flag.
   return NS_OK;
 }
 
 // Queries this list of interfaces. If none match, it queries mURI.
 NS_IMPL_NSIURIMUTATOR_ISUPPORTS(BlobURL::Mutator, nsIURISetters, nsIURIMutator,
-                                nsISerializable, nsIBlobURLMutator)
+                                nsISerializable)
 
 NS_IMETHODIMP
 BlobURL::Mutate(nsIURIMutator** aMutator) {
   RefPtr<BlobURL::Mutator> mutator = new BlobURL::Mutator();
   nsresult rv = mutator->InitFromURI(this);
   if (NS_FAILED(rv)) {
     return rv;
   }
--- a/dom/file/uri/BlobURL.h
+++ b/dom/file/uri/BlobURL.h
@@ -8,31 +8,16 @@
 #define mozilla_dom_BlobURL_h
 
 #include "mozilla/Attributes.h"
 #include "nsCOMPtr.h"
 #include "nsISerializable.h"
 #include "nsSimpleURI.h"
 #include "prtime.h"
 
-#define NS_IBLOBURLMUTATOR_IID                       \
-  {                                                  \
-    0xf91e646d, 0xe87b, 0x485e, {                    \
-      0xbb, 0xc8, 0x0e, 0x8a, 0x2e, 0xe9, 0x87, 0xa9 \
-    }                                                \
-  }
-
-class NS_NO_VTABLE nsIBlobURLMutator : public nsISupports {
- public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IBLOBURLMUTATOR_IID)
-  NS_IMETHOD SetRevoked(bool aRevoked) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIBlobURLMutator, NS_IBLOBURLMUTATOR_IID)
-
 namespace mozilla {
 namespace dom {
 
 /**
  * These URIs refer to host objects with "blob" scheme.
  */
 class BlobURL final : public mozilla::net::nsSimpleURI {
  private:
@@ -66,50 +51,44 @@ class BlobURL final : public mozilla::ne
 
  private:
   virtual ~BlobURL() = default;
 
   nsresult SetScheme(const nsACString& aProtocol) override;
   bool Deserialize(const mozilla::ipc::URIParams&);
   nsresult ReadPrivate(nsIObjectInputStream* stream);
 
-  bool mRevoked;
-
  public:
   class Mutator final : public nsIURIMutator,
                         public BaseURIMutator<BlobURL>,
-                        public nsIBlobURLMutator,
                         public nsISerializable {
     NS_DECL_ISUPPORTS
     NS_FORWARD_SAFE_NSIURISETTERS_RET(mURI)
     NS_DEFINE_NSIMUTATOR_COMMON
 
     NS_IMETHOD
     Write(nsIObjectOutputStream* aOutputStream) override {
       return NS_ERROR_NOT_IMPLEMENTED;
     }
 
     MOZ_MUST_USE NS_IMETHOD Read(nsIObjectInputStream* aStream) override {
       return InitFromInputStream(aStream);
     }
 
-    NS_IMETHOD SetRevoked(bool aRevoked) override {
-      mURI->mRevoked = aRevoked;
-      return NS_OK;
-    }
-
     Mutator() = default;
 
    private:
     ~Mutator() = default;
 
     friend class BlobURL;
   };
 
   friend BaseURIMutator<BlobURL>;
+
+  bool mRevoked;
 };
 
 #define NS_HOSTOBJECTURI_CID                         \
   {                                                  \
     0xf5475c51, 0x59a7, 0x4757, {                    \
       0xb3, 0xd9, 0xe2, 0x11, 0xa9, 0x41, 0x08, 0x72 \
     }                                                \
   }
--- a/dom/file/uri/BlobURLProtocolHandler.cpp
+++ b/dom/file/uri/BlobURLProtocolHandler.cpp
@@ -68,24 +68,16 @@ struct DataInfo {
   nsCString mStack;
 
   // When a blobURL is revoked, we keep it alive for RELEASING_TIMER
   // milliseconds in order to support pending operations such as navigation,
   // download and so on.
   bool mRevoked;
 };
 
-// The mutex is locked whenever gDataTable is changed, or if gDataTable
-// is accessed off-main-thread.
-static StaticMutex sMutex;
-
-// All changes to gDataTable must happen on the main thread, while locking
-// sMutex. Reading from gDataTable on the main thread may happen without
-// locking, since no changes are possible. Reading it from another thread
-// must also lock sMutex to prevent data races.
 static nsClassHashtable<nsCStringHashKey, DataInfo>* gDataTable;
 
 static DataInfo* GetDataInfo(const nsACString& aUri,
                              bool aAlsoIfRevoked = false) {
   if (!gDataTable) {
     return nullptr;
   }
 
@@ -169,18 +161,16 @@ void BroadcastBlobURLUnregistration(cons
 }
 
 class BlobURLsReporter final : public nsIMemoryReporter {
  public:
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aCallback,
                             nsISupports* aData, bool aAnonymize) override {
-    MOZ_ASSERT(NS_IsMainThread(),
-             "without locking gDataTable is main-thread only");
     if (!gDataTable) {
       return NS_OK;
     }
 
     nsDataHashtable<nsPtrHashKey<BlobImpl>, uint32_t> refCounts;
 
     // Determine number of URLs per BlobImpl, to handle the case where it's > 1.
     for (auto iter = gDataTable->Iter(); !iter.Done(); iter.Next()) {
@@ -466,28 +456,25 @@ class ReleasingTimerHolder final : publi
 
   void RevokeURI() {
     // Remove the shutting down blocker
     nsCOMPtr<nsIAsyncShutdownClient> phase = GetShutdownPhase();
     if (phase) {
       phase->RemoveBlocker(this);
     }
 
-    MOZ_ASSERT(NS_IsMainThread(),
-               "without locking gDataTable is main-thread only");
     DataInfo* info =
         GetDataInfo(mURI, true /* We care about revoked dataInfo */);
     if (!info) {
       // Already gone!
       return;
     }
 
     MOZ_ASSERT(info->mRevoked);
 
-    StaticMutexAutoLock lock(sMutex);
     gDataTable->Remove(mURI);
     if (gDataTable->Count() == 0) {
       delete gDataTable;
       gDataTable = nullptr;
     }
   }
 
   void CancelTimerAndRevokeURI() {
@@ -515,18 +502,16 @@ class ReleasingTimerHolder final : publi
 };
 
 NS_IMPL_ISUPPORTS_INHERITED(ReleasingTimerHolder, Runnable, nsITimerCallback,
                             nsIAsyncShutdownBlocker)
 
 template <typename T>
 static nsresult AddDataEntryInternal(const nsACString& aURI, T aObject,
                                      nsIPrincipal* aPrincipal) {
-  MOZ_ASSERT(NS_IsMainThread(), "changing gDataTable is main-thread only");
-  StaticMutexAutoLock lock(sMutex);
   if (!gDataTable) {
     gDataTable = new nsClassHashtable<nsCStringHashKey, DataInfo>;
   }
 
   DataInfo* info = new DataInfo(aObject, aPrincipal);
   BlobURLsReporter::GetJSStackForBlob(info);
 
   gDataTable->Put(aURI, info);
@@ -592,18 +577,16 @@ nsresult BlobURLProtocolHandler::AddData
 
   return AddDataEntryInternal(aURI, aBlobImpl, aPrincipal);
 }
 
 /* static */
 bool BlobURLProtocolHandler::GetAllBlobURLEntries(
     nsTArray<BlobURLRegistrationData>& aRegistrations, ContentParent* aCP) {
   MOZ_ASSERT(aCP);
-  MOZ_ASSERT(NS_IsMainThread(),
-             "without locking gDataTable is main-thread only");
 
   if (!gDataTable) {
     return true;
   }
 
   for (auto iter = gDataTable->ConstIter(); !iter.Done(); iter.Next()) {
     DataInfo* info = iter.UserData();
     MOZ_ASSERT(info);
@@ -626,57 +609,50 @@ bool BlobURLProtocolHandler::GetAllBlobU
   }
 
   return true;
 }
 
 /*static */
 void BlobURLProtocolHandler::RemoveDataEntry(const nsACString& aUri,
                                              bool aBroadcastToOtherProcesses) {
-  MOZ_ASSERT(NS_IsMainThread(), "changing gDataTable is main-thread only");
   if (!gDataTable) {
     return;
   }
+
   DataInfo* info = GetDataInfo(aUri);
   if (!info) {
     return;
   }
 
-  {
-    StaticMutexAutoLock lock(sMutex);
-    info->mRevoked = true;
-  }
+  info->mRevoked = true;
 
   if (aBroadcastToOtherProcesses && info->mObjectType == DataInfo::eBlobImpl) {
     BroadcastBlobURLUnregistration(nsCString(aUri));
   }
 
   // The timer will take care of removing the entry for real after
   // RELEASING_TIMER milliseconds. In the meantime, the DataInfo, marked as
   // revoked, will not be exposed.
   ReleasingTimerHolder::Create(aUri);
 }
 
 /* static */
 void BlobURLProtocolHandler::RemoveDataEntries() {
-  MOZ_ASSERT(NS_IsMainThread(), "changing gDataTable is main-thread only");
-  StaticMutexAutoLock lock(sMutex);
   if (!gDataTable) {
     return;
   }
 
   gDataTable->Clear();
   delete gDataTable;
   gDataTable = nullptr;
 }
 
 /* static */
 bool BlobURLProtocolHandler::HasDataEntry(const nsACString& aUri) {
-  MOZ_ASSERT(NS_IsMainThread(),
-             "without locking gDataTable is main-thread only");
   return !!GetDataInfo(aUri);
 }
 
 /* static */
 nsresult BlobURLProtocolHandler::GenerateURIString(nsIPrincipal* aPrincipal,
                                                    nsACString& aUri) {
   nsresult rv;
   nsCOMPtr<nsIUUIDGenerator> uuidgen =
@@ -707,36 +683,32 @@ nsresult BlobURLProtocolHandler::Generat
   aUri += Substring(chars + 1, chars + NSID_LENGTH - 2);
 
   return NS_OK;
 }
 
 /* static */
 nsIPrincipal* BlobURLProtocolHandler::GetDataEntryPrincipal(
     const nsACString& aUri) {
-  MOZ_ASSERT(NS_IsMainThread(),
-             "without locking gDataTable is main-thread only");
   if (!gDataTable) {
     return nullptr;
   }
 
   DataInfo* res = GetDataInfo(aUri);
 
   if (!res) {
     return nullptr;
   }
 
   return res->mPrincipal;
 }
 
 /* static */
 void BlobURLProtocolHandler::Traverse(
     const nsACString& aUri, nsCycleCollectionTraversalCallback& aCallback) {
-  MOZ_ASSERT(NS_IsMainThread(),
-             "without locking gDataTable is main-thread only");
   if (!gDataTable) {
     return;
   }
 
   DataInfo* res;
   gDataTable->Get(aUri, &res);
   if (!res) {
     return;
@@ -775,40 +747,38 @@ BlobURLProtocolHandler::GetFlagsForURI(n
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 BlobURLProtocolHandler::NewURI(const nsACString& aSpec, const char* aCharset,
                                nsIURI* aBaseURI, nsIURI** aResult) {
-  return BlobURLProtocolHandler::CreateNewURI(aSpec, aCharset, aBaseURI,
-                                              aResult);
-}
-
-/* static */ nsresult BlobURLProtocolHandler::CreateNewURI(
-    const nsACString& aSpec, const char* aCharset, nsIURI* aBaseURI,
-    nsIURI** aResult) {
   *aResult = nullptr;
 
-  // This method can be called on any thread, which is why we lock the mutex
-  // for read access to gDataTable.
+  nsCOMPtr<nsIURI> uri;
+  nsresult rv =
+      NS_MutateURI(new BlobURL::Mutator()).SetSpec(aSpec).Finalize(uri);
+  NS_ENSURE_SUCCESS(rv, rv);
+
   bool revoked = true;
-  {
-    StaticMutexAutoLock lock(sMutex);
-    DataInfo* info = GetDataInfo(aSpec);
-    if (info && info->mObjectType == DataInfo::eBlobImpl) {
-      revoked = info->mRevoked;
-    }
+  DataInfo* info = GetDataInfo(aSpec);
+  if (info && info->mObjectType == DataInfo::eBlobImpl) {
+    revoked = info->mRevoked;
   }
 
-  return NS_MutateURI(new BlobURL::Mutator())
-      .SetSpec(aSpec)
-      .Apply(NS_MutatorMethod(&nsIBlobURLMutator::SetRevoked, revoked))
-      .Finalize(aResult);
+  RefPtr<BlobURL> blobURL;
+  rv = uri->QueryInterface(kHOSTOBJECTURICID, getter_AddRefs(blobURL));
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  MOZ_ASSERT(blobURL);
+  blobURL->mRevoked = revoked;
+
+  uri.forget(aResult);
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 BlobURLProtocolHandler::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
                                    nsIChannel** aResult) {
   RefPtr<BlobURLChannel> channel = new BlobURLChannel(aURI, aLoadInfo);
 
   auto raii = MakeScopeExit([&] {
@@ -818,18 +788,16 @@ BlobURLProtocolHandler::NewChannel(nsIUR
 
   RefPtr<BlobURL> blobURL;
   nsresult rv =
       aURI->QueryInterface(kHOSTOBJECTURICID, getter_AddRefs(blobURL));
   if (NS_FAILED(rv) || !blobURL) {
     return NS_OK;
   }
 
-  MOZ_ASSERT(NS_IsMainThread(),
-             "without locking gDataTable is main-thread only");
   DataInfo* info = GetDataInfoFromURI(aURI, true /*aAlsoIfRevoked */);
   if (!info || info->mObjectType != DataInfo::eBlobImpl || !info->mBlobImpl) {
     return NS_OK;
   }
 
   if (blobURL->Revoked()) {
     return NS_OK;
   }
@@ -880,18 +848,16 @@ bool BlobURLProtocolHandler::GetBlobURLP
 
   RefPtr<BlobURL> blobURL;
   nsresult rv =
       aURI->QueryInterface(kHOSTOBJECTURICID, getter_AddRefs(blobURL));
   if (NS_FAILED(rv) || !blobURL) {
     return false;
   }
 
-  MOZ_ASSERT(NS_IsMainThread(),
-             "without locking gDataTable is main-thread only");
   DataInfo* info = GetDataInfoFromURI(aURI, true /*aAlsoIfRevoked */);
   if (!info || info->mObjectType != DataInfo::eBlobImpl || !info->mBlobImpl) {
     return false;
   }
 
   nsCOMPtr<nsIPrincipal> principal;
 
   if (blobURL->Revoked()) {
@@ -905,64 +871,57 @@ bool BlobURLProtocolHandler::GetBlobURLP
   return true;
 }
 
 }  // namespace dom
 }  // namespace mozilla
 
 nsresult NS_GetBlobForBlobURI(nsIURI* aURI, BlobImpl** aBlob) {
   *aBlob = nullptr;
-  MOZ_ASSERT(NS_IsMainThread(),
-             "without locking gDataTable is main-thread only");
+
   DataInfo* info = GetDataInfoFromURI(aURI, false /* aAlsoIfRevoked */);
   if (!info || info->mObjectType != DataInfo::eBlobImpl) {
     return NS_ERROR_DOM_BAD_URI;
   }
 
   RefPtr<BlobImpl> blob = info->mBlobImpl;
   blob.forget(aBlob);
   return NS_OK;
 }
 
 nsresult NS_GetBlobForBlobURISpec(const nsACString& aSpec, BlobImpl** aBlob) {
   *aBlob = nullptr;
-  MOZ_ASSERT(NS_IsMainThread(),
-             "without locking gDataTable is main-thread only");
 
   DataInfo* info = GetDataInfo(aSpec);
   if (!info || info->mObjectType != DataInfo::eBlobImpl) {
     return NS_ERROR_DOM_BAD_URI;
   }
 
   RefPtr<BlobImpl> blob = info->mBlobImpl;
   blob.forget(aBlob);
   return NS_OK;
 }
 
 nsresult NS_GetSourceForMediaSourceURI(nsIURI* aURI, MediaSource** aSource) {
   *aSource = nullptr;
 
-  MOZ_ASSERT(NS_IsMainThread(),
-             "without locking gDataTable is main-thread only");
   DataInfo* info = GetDataInfoFromURI(aURI);
   if (!info || info->mObjectType != DataInfo::eMediaSource) {
     return NS_ERROR_DOM_BAD_URI;
   }
 
   RefPtr<MediaSource> mediaSource = info->mMediaSource;
   mediaSource.forget(aSource);
   return NS_OK;
 }
 
 namespace mozilla {
 namespace dom {
 
 bool IsType(nsIURI* aUri, DataInfo::ObjectType aType) {
-  MOZ_ASSERT(NS_IsMainThread(),
-             "without locking gDataTable is main-thread only");
   DataInfo* info = GetDataInfoFromURI(aUri);
   if (!info) {
     return false;
   }
 
   return info->mObjectType == aType;
 }
 
--- a/dom/file/uri/BlobURLProtocolHandler.h
+++ b/dom/file/uri/BlobURLProtocolHandler.h
@@ -34,19 +34,16 @@ class BlobURLProtocolHandler final : pub
                                      public nsSupportsWeakReference {
  public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPROTOCOLHANDLER
   NS_DECL_NSIPROTOCOLHANDLERWITHDYNAMICFLAGS
 
   BlobURLProtocolHandler();
 
-  static nsresult CreateNewURI(const nsACString& aSpec, const char* aCharset,
-                               nsIURI* aBaseURI, nsIURI** result);
-
   // Methods for managing uri->object mapping
   // AddDataEntry creates the URI with the given scheme and returns it in aUri
   static nsresult AddDataEntry(mozilla::dom::BlobImpl* aBlobImpl,
                                nsIPrincipal* aPrincipal, nsACString& aUri);
   static nsresult AddDataEntry(mozilla::dom::MediaSource* aMediaSource,
                                nsIPrincipal* aPrincipal, nsACString& aUri);
   // IPC only
   static nsresult AddDataEntry(const nsACString& aURI, nsIPrincipal* aPrincipal,
--- a/dom/jsurl/nsJSProtocolHandler.cpp
+++ b/dom/jsurl/nsJSProtocolHandler.cpp
@@ -37,17 +37,16 @@
 #include "nsContentUtils.h"
 #include "nsJSUtils.h"
 #include "nsThreadUtils.h"
 #include "nsIScriptChannel.h"
 #include "mozilla/dom/Document.h"
 #include "nsILoadInfo.h"
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
-#include "nsITextToSubURI.h"
 #include "nsIWritablePropertyBag2.h"
 #include "nsIContentSecurityPolicy.h"
 #include "nsSandboxFlags.h"
 #include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/PopupBlocker.h"
 #include "nsILoadInfo.h"
 #include "nsContentSecurityManager.h"
@@ -1040,29 +1039,30 @@ nsresult nsJSProtocolHandler::Create(nsI
   nsresult rv = ph->Init();
   if (NS_SUCCEEDED(rv)) {
     rv = ph->QueryInterface(aIID, aResult);
   }
   NS_RELEASE(ph);
   return rv;
 }
 
-/* static */ nsresult nsJSProtocolHandler::EnsureUTF8Spec(
-    const nsCString& aSpec, const char* aCharset, nsACString& aUTF8Spec) {
+nsresult nsJSProtocolHandler::EnsureUTF8Spec(const nsCString& aSpec,
+                                             const char* aCharset,
+                                             nsACString& aUTF8Spec) {
   aUTF8Spec.Truncate();
 
   nsresult rv;
 
-  nsCOMPtr<nsITextToSubURI> txtToSubURI =
-      do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
+  if (!mTextToSubURI) {
+    mTextToSubURI = do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
+    NS_ENSURE_SUCCESS(rv, rv);
+  }
   nsAutoString uStr;
-  rv = txtToSubURI->UnEscapeNonAsciiURI(nsDependentCString(aCharset), aSpec,
-                                        uStr);
+  rv = mTextToSubURI->UnEscapeNonAsciiURI(nsDependentCString(aCharset), aSpec,
+                                          uStr);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!IsASCII(uStr)) {
     rv = NS_EscapeURL(NS_ConvertUTF16toUTF8(uStr),
                       esc_AlwaysCopy | esc_OnlyNonASCII, aUTF8Spec,
                       mozilla::fallible);
     NS_ENSURE_SUCCESS(rv, rv);
   }
@@ -1087,26 +1087,20 @@ nsJSProtocolHandler::GetDefaultPort(int3
 
 NS_IMETHODIMP
 nsJSProtocolHandler::GetProtocolFlags(uint32_t* result) {
   *result = URI_NORELATIVE | URI_NOAUTH | URI_INHERITS_SECURITY_CONTEXT |
             URI_LOADABLE_BY_ANYONE | URI_NON_PERSISTABLE |
             URI_OPENING_EXECUTES_SCRIPT;
   return NS_OK;
 }
+
 NS_IMETHODIMP
 nsJSProtocolHandler::NewURI(const nsACString& aSpec, const char* aCharset,
                             nsIURI* aBaseURI, nsIURI** result) {
-  return nsJSProtocolHandler::CreateNewURI(aSpec, aCharset, aBaseURI, result);
-}
-
-/* static */ nsresult nsJSProtocolHandler::CreateNewURI(const nsACString& aSpec,
-                                                        const char* aCharset,
-                                                        nsIURI* aBaseURI,
-                                                        nsIURI** result) {
   nsresult rv = NS_OK;
 
   // javascript: URLs (currently) have no additional structure beyond that
   // provided by standard URLs, so there is no "outer" object given to
   // CreateInstance.
 
   NS_MutateURI mutator(new nsJSURI::Mutator());
   nsCOMPtr<nsIURI> base(aBaseURI);
--- a/dom/jsurl/nsJSProtocolHandler.h
+++ b/dom/jsurl/nsJSProtocolHandler.h
@@ -3,16 +3,17 @@
  * 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/. */
 
 #ifndef nsJSProtocolHandler_h___
 #define nsJSProtocolHandler_h___
 
 #include "mozilla/Attributes.h"
 #include "nsIProtocolHandler.h"
+#include "nsITextToSubURI.h"
 #include "nsIURI.h"
 #include "nsIMutable.h"
 #include "nsISerializable.h"
 #include "nsIClassInfo.h"
 #include "nsSimpleURI.h"
 #include "nsINestedURI.h"
 
 #define NS_JSPROTOCOLHANDLER_CID                     \
@@ -48,24 +49,23 @@ class nsJSProtocolHandler : public nsIPr
 
   // nsJSProtocolHandler methods:
   nsJSProtocolHandler();
 
   static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
 
   nsresult Init();
 
-  static nsresult CreateNewURI(const nsACString& aSpec, const char* aCharset,
-                               nsIURI* aBaseURI, nsIURI** result);
-
  protected:
   virtual ~nsJSProtocolHandler();
 
-  static nsresult EnsureUTF8Spec(const nsCString& aSpec, const char* aCharset,
-                                 nsACString& aUTF8Spec);
+  nsresult EnsureUTF8Spec(const nsCString& aSpec, const char* aCharset,
+                          nsACString& aUTF8Spec);
+
+  nsCOMPtr<nsITextToSubURI> mTextToSubURI;
 };
 
 class nsJSURI final : public mozilla::net::nsSimpleURI {
  public:
   using mozilla::net::nsSimpleURI::Read;
   using mozilla::net::nsSimpleURI::Write;
 
   nsIURI* GetBaseURI() const { return mBaseURI; }
--- a/mfbt/ThreadLocal.h
+++ b/mfbt/ThreadLocal.h
@@ -173,18 +173,16 @@ class ThreadLocal : public Storage<T> {
 
   void infallibleInit() {
     MOZ_RELEASE_ASSERT(init(), "Infallible TLS initialization failed");
   }
 
   inline T get() const;
 
   inline void set(const T aValue);
-
-  using Type = T;
 };
 
 template <typename T, template <typename U> class Storage>
 inline bool ThreadLocal<T, Storage>::init() {
   static_assert(mozilla::IsPointer<T>::value || mozilla::IsIntegral<T>::value,
                 "mozilla::ThreadLocal must be used with a pointer or "
                 "integral type");
   static_assert(sizeof(T) <= sizeof(void*),
--- a/netwerk/base/nsNetUtil.cpp
+++ b/netwerk/base/nsNetUtil.cpp
@@ -80,21 +80,16 @@
 #include "nsHttpHandler.h"
 #include "nsNSSComponent.h"
 #include "nsIRedirectHistoryEntry.h"
 #include "nsICertBlocklist.h"
 #include "nsICertOverrideService.h"
 #include "nsQueryObject.h"
 #include "mozIThirdPartyUtil.h"
 #include "../mime/nsMIMEHeaderParamImpl.h"
-#include "nsStandardURL.h"
-#include "nsChromeProtocolHandler.h"
-#include "nsJSProtocolHandler.h"
-#include "nsDataHandler.h"
-#include "mozilla/dom/BlobURLProtocolHandler.h"
 
 #include <limits>
 
 using namespace mozilla;
 using namespace mozilla::net;
 using mozilla::dom::BlobURLProtocolHandler;
 using mozilla::dom::ClientInfo;
 using mozilla::dom::PerformanceStorage;
@@ -1674,143 +1669,16 @@ nsresult NS_NewURI(
     nsIURI **result, const char *spec, nsIURI *baseURI /* = nullptr */,
     nsIIOService
         *ioService /* = nullptr */)  // pass in nsIIOService to optimize callers
 {
   return NS_NewURI(result, nsDependentCString(spec), nullptr, baseURI,
                    ioService);
 }
 
-static nsresult NewStandardURI(const nsACString &aSpec, const char *aCharset,
-                               nsIURI *aBaseURI, int32_t aDefaultPort,
-                               nsIURI **aURI) {
-  nsCOMPtr<nsIURI> base(aBaseURI);
-  return NS_MutateURI(new nsStandardURL::Mutator())
-      .Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
-                              nsIStandardURL::URLTYPE_AUTHORITY, aDefaultPort,
-                              nsCString(aSpec), aCharset, base, nullptr))
-      .Finalize(aURI);
-}
-
-extern MOZ_THREAD_LOCAL(uint32_t) gTlsURLRecursionCount;
-
-template <typename T>
-class TlsAutoIncrement {
- public:
-  explicit TlsAutoIncrement(T &var) : mVar(var) {
-    mValue = mVar.get();
-    mVar.set(mValue + 1);
-  }
-  ~TlsAutoIncrement() {
-    typename T::Type value = mVar.get();
-    MOZ_ASSERT(value == mValue + 1);
-    mVar.set(value - 1);
-  }
-
-  typename T::Type value() { return mValue; }
-
- private:
-  typename T::Type mValue;
-  T &mVar;
-};
-
-nsresult NS_NewURIOnAnyThread(nsIURI **aURI, const nsACString &aSpec,
-                              const char *aCharset /* = nullptr */,
-                              nsIURI *aBaseURI /* = nullptr */,
-                              nsIIOService *aIOService /* = nullptr */) {
-  TlsAutoIncrement<typeof(gTlsURLRecursionCount)> inc(gTlsURLRecursionCount);
-  if (inc.value() >= MAX_RECURSION_COUNT) {
-    return NS_ERROR_MALFORMED_URI;
-  }
-
-  nsAutoCString scheme;
-  nsresult rv = net_ExtractURLScheme(aSpec, scheme);
-  if (NS_FAILED(rv)) {
-    // then aSpec is relative
-    if (!aBaseURI) {
-      return NS_ERROR_MALFORMED_URI;
-    }
-
-    if (!aSpec.IsEmpty() && aSpec[0] == '#') {
-      // Looks like a reference instead of a fully-specified URI.
-      // --> initialize |uri| as a clone of |aBaseURI|, with ref appended.
-      return NS_GetURIWithNewRef(aBaseURI, aSpec, aURI);
-    }
-
-    rv = aBaseURI->GetScheme(scheme);
-    if (NS_FAILED(rv)) return rv;
-  }
-
-  if (scheme.EqualsLiteral("http") || scheme.EqualsLiteral("ws")) {
-    return NewStandardURI(aSpec, aCharset, aBaseURI, NS_HTTP_DEFAULT_PORT,
-                          aURI);
-  }
-  if (scheme.EqualsLiteral("https") || scheme.EqualsLiteral("wss")) {
-    return NewStandardURI(aSpec, aCharset, aBaseURI, NS_HTTPS_DEFAULT_PORT,
-                          aURI);
-  }
-  if (scheme.EqualsLiteral("ftp")) {
-    return NewStandardURI(aSpec, aCharset, aBaseURI, 21, aURI);
-  }
-
-  if (scheme.EqualsLiteral("file")) {
-    nsAutoCString buf(aSpec);
-#if defined(XP_WIN)
-    buf.Truncate();
-    if (!net_NormalizeFileURL(aSpec, buf)) {
-      buf = aSpec;
-    }
-#endif
-
-    nsCOMPtr<nsIURI> base(aBaseURI);
-    return NS_MutateURI(new nsStandardURL::Mutator())
-        .Apply(NS_MutatorMethod(&nsIFileURLMutator::MarkFileURL))
-        .Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
-                                nsIStandardURL::URLTYPE_NO_AUTHORITY, -1, buf,
-                                aCharset, base, nullptr))
-        .Finalize(aURI);
-  }
-
-  if (scheme.EqualsLiteral("data")) {
-    return nsDataHandler::CreateNewURI(aSpec, aCharset, aBaseURI, aURI);
-  }
-
-  if (scheme.EqualsLiteral("moz-safe-about") ||
-      scheme.EqualsLiteral("page-icon") || scheme.EqualsLiteral("moz") ||
-      scheme.EqualsLiteral("moz-anno") ||
-      scheme.EqualsLiteral("moz-page-thumb") ||
-      scheme.EqualsLiteral("moz-fonttable")) {
-    return NS_MutateURI(new nsSimpleURI::Mutator())
-        .SetSpec(aSpec)
-        .Finalize(aURI);
-  }
-
-  if (scheme.EqualsLiteral("chrome")) {
-    return nsChromeProtocolHandler::CreateNewURI(aSpec, aCharset, aBaseURI,
-                                                 aURI);
-  }
-
-  if (scheme.EqualsLiteral("javascript")) {
-    return nsJSProtocolHandler::CreateNewURI(aSpec, aCharset, aBaseURI, aURI);
-  }
-
-  if (scheme.EqualsLiteral("blob")) {
-    return BlobURLProtocolHandler::CreateNewURI(aSpec, aCharset, aBaseURI,
-                                                aURI);
-  }
-
-  if (NS_IsMainThread()) {
-    // XXX (valentin): this fallback should be removed once we get rid of
-    // nsIProtocolHandler.newURI
-    return NS_NewURI(aURI, aSpec, aCharset, aBaseURI, aIOService);
-  }
-
-  return NS_ERROR_UNKNOWN_PROTOCOL;
-}
-
 nsresult NS_GetSanitizedURIStringFromURI(nsIURI *aUri,
                                          nsAString &aSanitizedSpec) {
   aSanitizedSpec.Truncate();
 
   nsCOMPtr<nsISensitiveInfoHiddenURI> safeUri = do_QueryInterface(aUri);
   nsAutoCString cSpec;
   nsresult rv;
   if (safeUri) {
--- a/netwerk/base/nsNetUtil.h
+++ b/netwerk/base/nsNetUtil.h
@@ -95,29 +95,16 @@ nsresult NS_NewURI(nsIURI **result, cons
                    nsIURI *baseURI = nullptr,
                    nsIIOService *ioService =
                        nullptr);  // pass in nsIIOService to optimize callers
 
 nsresult NS_NewURI(nsIURI **result, const char *spec, nsIURI *baseURI = nullptr,
                    nsIIOService *ioService =
                        nullptr);  // pass in nsIIOService to optimize callers
 
-// This function attempts to create an nsIURI on any thread. This implies we
-// can't instantiate a protcol handler, since protocol handers may have a JS
-// implementation so they can't work off-main-thread.
-// When called off the main thread, if the nsIURI can't be created without
-// instantiating protocol handlers, the method will return
-// NS_ERROR_UNKNOWN_PROTOCOL. The caller may retry on the main thread.
-// When called on the main thread, this function will fall back on calling
-// nsIProtocolHandler.newURI
-nsresult NS_NewURIOnAnyThread(nsIURI **aResult, const nsACString &aSpec,
-                              const char *aCharset = nullptr,
-                              nsIURI *aBaseURI = nullptr,
-                              nsIIOService *aIOService = nullptr);
-
 nsresult NS_NewFileURI(
     nsIURI **result, nsIFile *spec,
     nsIIOService *ioService =
         nullptr);  // pass in nsIIOService to optimize callers
 
 // These methods will only mutate the URI if the ref of aInput doesn't already
 // match the ref we are trying to set.
 // If aInput has no ref, and we are calling NS_GetURIWithoutRef, or
--- a/netwerk/protocol/data/moz.build
+++ b/netwerk/protocol/data/moz.build
@@ -3,20 +3,16 @@
 # 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/.
 
 EXPORTS.mozilla.net += [
     'DataChannelParent.h',
 ]
 
-EXPORTS += [
-  'nsDataHandler.h',
-]
-
 UNIFIED_SOURCES += [
     'DataChannelChild.cpp',
     'DataChannelParent.cpp',
     'nsDataChannel.cpp',
     'nsDataHandler.cpp',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
--- a/netwerk/protocol/data/nsDataHandler.cpp
+++ b/netwerk/protocol/data/nsDataHandler.cpp
@@ -46,23 +46,16 @@ nsDataHandler::GetProtocolFlags(uint32_t
             URI_IS_LOCAL_RESOURCE | URI_SYNC_LOAD_IS_OK;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDataHandler::NewURI(const nsACString& aSpec,
                       const char* aCharset,  // ignore charset info
                       nsIURI* aBaseURI, nsIURI** result) {
-  return nsDataHandler::CreateNewURI(aSpec, aCharset, aBaseURI, result);
-}
-
-/* static */ nsresult nsDataHandler::CreateNewURI(const nsACString& aSpec,
-                                                  const char* aCharset,
-                                                  nsIURI* aBaseURI,
-                                                  nsIURI** result) {
   nsresult rv;
   nsCOMPtr<nsIURI> uri;
 
   nsCString spec(aSpec);
 
   if (aBaseURI && !spec.IsEmpty() && spec[0] == '#') {
     // Looks like a reference instead of a fully-specified URI.
     // --> initialize |uri| as a clone of |aBaseURI|, with ref appended.
--- a/netwerk/protocol/data/nsDataHandler.h
+++ b/netwerk/protocol/data/nsDataHandler.h
@@ -17,19 +17,16 @@ class nsDataHandler : public nsIProtocol
   NS_DECL_ISUPPORTS
 
   // nsIProtocolHandler methods:
   NS_DECL_NSIPROTOCOLHANDLER
 
   // nsDataHandler methods:
   nsDataHandler() = default;
 
-  static nsresult CreateNewURI(const nsACString& aSpec, const char* aCharset,
-                               nsIURI* aBaseURI, nsIURI** result);
-
   // Define a Create method to be used with a factory:
   static MOZ_MUST_USE nsresult Create(nsISupports* aOuter, const nsIID& aIID,
                                       void** aResult);
 
   // Parse a data: URI and return the individual parts
   // (the given spec will temporarily be modified but will be returned
   //  to the original before returning)
   // contentCharset and dataBuffer can be nullptr if they are not needed.
--- a/netwerk/test/gtest/TestURIMutator.cpp
+++ b/netwerk/test/gtest/TestURIMutator.cpp
@@ -1,15 +1,13 @@
 #include "gtest/gtest.h"
 #include "nsCOMPtr.h"
 #include "nsNetCID.h"
 #include "nsIURL.h"
 #include "nsIURIMutator.h"
-#include "nsThreadPool.h"
-#include "nsNetUtil.h"
 
 TEST(TestURIMutator, Mutator) {
   nsAutoCString out;
 
   // This test instantiates a new nsStandardURL::Mutator (via contractID)
   // and uses it to create a new URI.
   nsCOMPtr<nsIURI> uri;
   nsresult rv = NS_MutateURI(NS_STANDARDURLMUTATOR_CONTRACTID)
@@ -94,44 +92,8 @@ TEST(TestURIMutator, Mutator) {
   ASSERT_EQ(rv, NS_OK);
   ASSERT_EQ(uri2->GetSpec(out), NS_OK);
   ASSERT_TRUE(out == NS_LITERAL_CSTRING("https://mozilla.org/path#newref"));
   nsCOMPtr<nsIURI> uri3;
   rv = mutator.Finalize(uri3);
   ASSERT_EQ(rv, NS_ERROR_NOT_AVAILABLE);
   ASSERT_TRUE(uri3 == nullptr);
 }
-
-extern MOZ_THREAD_LOCAL(uint32_t) gTlsURLRecursionCount;
-
-TEST(TestURIMutator, NS_NewURIOnAnyThread) {
-  nsCOMPtr<nsIThreadPool> pool = new nsThreadPool();
-  pool->SetThreadLimit(60);
-
-  pool = new nsThreadPool();
-  for (int i = 0; i < 1000; ++i) {
-    nsCOMPtr<nsIRunnable> task =
-        NS_NewRunnableFunction("gtest-NS_NewURIOnAnyThread", []() {
-          nsCOMPtr<nsIURI> uri;
-          nsresult rv = NS_NewURIOnAnyThread(
-              getter_AddRefs(uri), NS_LITERAL_CSTRING("http://example.com"));
-          ASSERT_EQ(rv, NS_OK);
-          nsAutoCString out;
-          ASSERT_EQ(uri->GetSpec(out), NS_OK);
-          ASSERT_TRUE(out == NS_LITERAL_CSTRING("http://example.com/"));
-        });
-    EXPECT_TRUE(task);
-
-    pool->Dispatch(task, NS_DISPATCH_NORMAL);
-  }
-
-  nsCOMPtr<nsIURI> uri;
-  nsresult rv = NS_NewURIOnAnyThread(getter_AddRefs(uri),
-                                     NS_LITERAL_CSTRING("http://example.com"));
-  ASSERT_EQ(rv, NS_OK);
-  nsAutoCString out;
-  ASSERT_EQ(uri->GetSpec(out), NS_OK);
-  ASSERT_TRUE(out == NS_LITERAL_CSTRING("http://example.com/"));
-
-  pool->Shutdown();
-
-  ASSERT_EQ(gTlsURLRecursionCount.get(), 0u);
-}
deleted file mode 100644
--- a/xpcom/threads/ThreadLocalVariables.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-/* 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/. */
-
-// This variable is used to ensure creating new URI doesn't put us in an
-// infinite loop
-MOZ_THREAD_LOCAL(uint32_t) gTlsURLRecursionCount;
-
-void InitThreadLocalVariables() {
-  if (!gTlsURLRecursionCount.init()) {
-    MOZ_CRASH("Could not init gTlsURLRecursionCount");
-  }
-  gTlsURLRecursionCount.set(0);
-}
--- a/xpcom/threads/moz.build
+++ b/xpcom/threads/moz.build
@@ -102,17 +102,16 @@ UNIFIED_SOURCES += [
     'RWLock.cpp',
     'SchedulerGroup.cpp',
     'SharedThreadPool.cpp',
     'SynchronizedEventQueue.cpp',
     'SystemGroup.cpp',
     'TaskQueue.cpp',
     'ThreadEventQueue.cpp',
     'ThreadEventTarget.cpp',
-    'ThreadLocalVariables.cpp',
     'ThrottledEventQueue.cpp',
     'TimerThread.cpp',
 ]
 
 LOCAL_INCLUDES += [
     '../build',
     '/caps',
     '/tools/profiler',
--- a/xpcom/threads/nsThread.cpp
+++ b/xpcom/threads/nsThread.cpp
@@ -567,17 +567,16 @@ void nsThread::InitCommon() {
       ULONG_PTR stackBottom, stackTop;
       sGetStackLimits(&stackBottom, &stackTop);
       mStackBase = reinterpret_cast<void*>(stackBottom);
       mStackSize = stackTop - stackBottom;
     }
 #endif
   }
 
-  InitThreadLocalVariables();
   AddToThreadList();
 }
 
 //-----------------------------------------------------------------------------
 
 #ifdef MOZ_CANARY
 int sCanaryOutputFD = -1;
 #endif