Bug 1435174 - Remove the renaming 'using namespace workers', r=bkelly
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 05 Feb 2018 19:55:07 +0100
changeset 454905 7818e2f5572c3e90c14d0d42881d793864baa2e4
parent 454904 de4276013d2f772c4280a09320d11a277d052985
child 454906 d79788e03f7451ebc4a3c694117497f091a5a129
push id8799
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 16:46:23 +0000
treeherdermozilla-beta@15334014dc67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1435174
milestone60.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 1435174 - Remove the renaming 'using namespace workers', r=bkelly
caps/nsJSPrincipals.cpp
dom/base/EventSource.cpp
dom/base/ImageEncoder.cpp
dom/base/nsContentUtils.cpp
dom/base/nsGlobalWindowInner.cpp
dom/base/nsJSTimeoutHandler.cpp
dom/bindings/BindingUtils.cpp
dom/broadcastchannel/BroadcastChannel.cpp
dom/broadcastchannel/BroadcastChannelChild.cpp
dom/canvas/ImageBitmap.cpp
dom/canvas/ImageBitmap.h
dom/clients/api/Client.cpp
dom/clients/api/ClientDOMUtil.h
dom/clients/api/Clients.cpp
dom/clients/manager/ClientManager.cpp
dom/console/Console.cpp
dom/crypto/WebCryptoTask.cpp
dom/events/Event.cpp
dom/events/EventDispatcher.cpp
dom/events/JSEventHandler.cpp
dom/fetch/Fetch.cpp
dom/fetch/FetchConsumer.cpp
dom/fetch/FetchDriver.cpp
dom/fetch/FetchStream.cpp
dom/fetch/FetchStreamReader.cpp
dom/file/FileBlobImpl.cpp
dom/file/FileReader.cpp
dom/file/FileReaderSync.cpp
dom/file/ipc/IPCBlobInputStreamChild.cpp
dom/indexedDB/ActorsChild.cpp
dom/indexedDB/IDBObjectStore.cpp
dom/indexedDB/IDBRequest.cpp
dom/indexedDB/IDBTransaction.cpp
dom/indexedDB/IndexedDatabaseManager.cpp
dom/ipc/ContentChild.cpp
dom/ipc/TabChild.cpp
dom/messagechannel/MessagePort.cpp
dom/notification/Notification.cpp
dom/notification/Notification.h
dom/performance/Performance.cpp
dom/performance/PerformanceObserver.cpp
dom/promise/Promise.cpp
dom/push/PushManager.cpp
dom/push/PushNotifier.cpp
dom/push/PushSubscription.cpp
dom/quota/StorageManager.cpp
dom/script/ScriptSettings.cpp
dom/serviceworkers/ServiceWorkerEvents.cpp
dom/serviceworkers/ServiceWorkerRegistration.cpp
dom/url/URLWorker.cpp
dom/websocket/WebSocket.cpp
dom/workers/MessageEventRunnable.cpp
dom/workers/RuntimeService.cpp
dom/workers/RuntimeService.h
dom/workers/ScriptLoader.cpp
dom/workers/WorkerCommon.h
dom/workers/WorkerError.cpp
dom/workers/WorkerPrivate.cpp
dom/workers/WorkerPrivate.h
dom/workers/WorkerRunnable.cpp
dom/workers/WorkerRunnable.h
dom/workers/WorkerScope.cpp
dom/xhr/XMLHttpRequestWorker.cpp
gfx/thebes/gfxUtils.cpp
ipc/glue/BackgroundParentImpl.cpp
ipc/glue/IPCStreamSource.cpp
js/src/devtools/rootAnalysis/annotations.js
js/xpconnect/src/nsXPConnect.cpp
xpcom/threads/MainThreadUtils.h
xpcom/threads/nsThreadManager.cpp
--- a/caps/nsJSPrincipals.cpp
+++ b/caps/nsJSPrincipals.cpp
@@ -10,17 +10,17 @@
 #include "nsJSPrincipals.h"
 #include "plstr.h"
 #include "nsCOMPtr.h"
 #include "nsIServiceManager.h"
 #include "nsMemory.h"
 #include "nsStringBuffer.h"
 
 #include "mozilla/dom/StructuredCloneTags.h"
-// for mozilla::dom::workers::kJSPrincipalsDebugToken
+// for mozilla::dom::workerinternals::kJSPrincipalsDebugToken
 #include "mozilla/dom/workerinternals/JSSettings.h"
 #include "mozilla/ipc/BackgroundUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::ipc;
 
 NS_IMETHODIMP_(MozExternalRefCountType)
 nsJSPrincipals::AddRef()
--- a/dom/base/EventSource.cpp
+++ b/dom/base/EventSource.cpp
@@ -45,18 +45,16 @@
 #include "nsWrapperCacheInlines.h"
 #include "mozilla/Attributes.h"
 #include "nsError.h"
 #include "mozilla/Encoding.h"
 
 namespace mozilla {
 namespace dom {
 
-using namespace workers;
-
 static LazyLogModule gEventSourceLog("EventSource");
 
 #define SPACE_CHAR           (char16_t)0x0020
 #define CR_CHAR              (char16_t)0x000D
 #define LF_CHAR              (char16_t)0x000A
 #define COLON_CHAR           (char16_t)0x003A
 
 // Reconnection time related values in milliseconds. The default one is equal
--- a/dom/base/ImageEncoder.cpp
+++ b/dom/base/ImageEncoder.cpp
@@ -84,17 +84,17 @@ public:
   explicit EncodingCompleteEvent(EncodeCompleteCallback* aEncodeCompleteCallback)
     : CancelableRunnable("EncodingCompleteEvent")
     , mImgSize(0)
     , mType()
     , mImgData(nullptr)
     , mEncodeCompleteCallback(aEncodeCompleteCallback)
     , mFailed(false)
   {
-    if (!NS_IsMainThread() && workers::GetCurrentThreadWorkerPrivate()) {
+    if (!NS_IsMainThread() && GetCurrentThreadWorkerPrivate()) {
       mCreationEventTarget = GetCurrentThreadEventTarget();
     } else {
       mCreationEventTarget = GetMainThreadEventTarget();
     }
   }
 
   NS_IMETHOD Run() override
   {
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -2439,19 +2439,19 @@ nsContentUtils::CalcRoundedWindowSizeFor
 
   *aOutputWidth = resultWidth;
   *aOutputHeight = resultHeight;
 }
 
 bool
 nsContentUtils::ThreadsafeIsCallerChrome()
 {
-  return NS_IsMainThread() ?
-    IsCallerChrome() :
-    workers::IsCurrentThreadRunningChromeWorker();
+  return NS_IsMainThread()
+           ? IsCallerChrome()
+           : IsCurrentThreadRunningChromeWorker();
 }
 
 bool
 nsContentUtils::IsCallerContentXBL()
 {
   JSContext *cx = GetCurrentJSContext();
   if (!cx)
     return false;
@@ -2480,17 +2480,17 @@ nsContentUtils::IsSystemCaller(JSContext
 
 bool
 nsContentUtils::ThreadsafeIsSystemCaller(JSContext* aCx)
 {
   if (NS_IsMainThread()) {
     return IsSystemCaller(aCx);
   }
 
-  return workers::GetWorkerPrivateFromContext(aCx)->UsesSystemPrincipal();
+  return GetWorkerPrivateFromContext(aCx)->UsesSystemPrincipal();
 }
 
 // static
 bool
 nsContentUtils::LookupBindingMember(JSContext* aCx, nsIContent *aContent,
                                     JS::Handle<jsid> aId,
                                     JS::MutableHandle<JS::PropertyDescriptor> aDesc)
 {
@@ -6139,17 +6139,17 @@ nsContentUtils::GetCurrentJSContext()
 /* static */
 JSContext *
 nsContentUtils::GetCurrentJSContextForThread()
 {
   MOZ_ASSERT(IsInitialized());
   if (MOZ_LIKELY(NS_IsMainThread())) {
     return GetCurrentJSContext();
   }
-  return workers::GetCurrentThreadJSContext();
+  return GetCurrentWorkerThreadJSContext();
 }
 
 template<typename StringType, typename CharType>
 void
 _ASCIIToLowerInSitu(StringType& aStr)
 {
   CharType* iter = aStr.BeginWriting();
   CharType* end = aStr.EndWriting();
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -1263,17 +1263,17 @@ nsGlobalWindowInner::FreeInnerObjects()
   NotifyDOMWindowDestroyed(this);
   if (auto* reporter = nsWindowMemoryReporter::Get()) {
     reporter->ObserveDOMWindowDetached(this);
   }
 
   mInnerObjectsFreed = true;
 
   // Kill all of the workers for this window.
-  mozilla::dom::workers::CancelWorkersForWindow(this);
+  CancelWorkersForWindow(this);
 
   if (mTimeoutManager) {
     mTimeoutManager->ClearAllTimeouts();
   }
 
   if (mIdleTimer) {
     mIdleTimer->Cancel();
     mIdleTimer = nullptr;
@@ -6095,17 +6095,17 @@ nsGlobalWindowInner::Suspend()
   nsCOMPtr<nsIDeviceSensors> ac = do_GetService(NS_DEVICE_SENSORS_CONTRACTID);
   if (ac) {
     for (uint32_t i = 0; i < mEnabledSensors.Length(); i++)
       ac->RemoveWindowListener(mEnabledSensors[i], this);
   }
   DisableGamepadUpdates();
   DisableVRUpdates();
 
-  mozilla::dom::workers::SuspendWorkersForWindow(this);
+  SuspendWorkersForWindow(this);
 
   SuspendIdleRequests();
 
   mTimeoutManager->Suspend();
 
   // Suspend all of the AudioContexts for this window
   for (uint32_t i = 0; i < mAudioContexts.Length(); ++i) {
     ErrorResult dummy;
@@ -6157,17 +6157,17 @@ nsGlobalWindowInner::Resume()
 
   mTimeoutManager->Resume();
 
   ResumeIdleRequests();
 
   // Resume all of the workers for this window.  We must do this
   // after timeouts since workers may have queued events that can trigger
   // a setTimeout().
-  mozilla::dom::workers::ResumeWorkersForWindow(this);
+  ResumeWorkersForWindow(this);
 }
 
 bool
 nsGlobalWindowInner::IsSuspended() const
 {
   MOZ_ASSERT(NS_IsMainThread());
   return mSuspendDepth != 0;
 }
@@ -6190,17 +6190,17 @@ nsGlobalWindowInner::FreezeInternal()
   CallOnChildren(&nsGlobalWindowInner::FreezeInternal);
 
   mFreezeDepth += 1;
   MOZ_ASSERT(mSuspendDepth >= mFreezeDepth);
   if (mFreezeDepth != 1) {
     return;
   }
 
-  mozilla::dom::workers::FreezeWorkersForWindow(this);
+  FreezeWorkersForWindow(this);
 
   mTimeoutManager->Freeze();
   if (mClientSource) {
     mClientSource->Freeze();
   }
 
   NotifyDOMWindowFrozen(this);
 }
@@ -6229,17 +6229,17 @@ nsGlobalWindowInner::ThawInternal()
     return;
   }
 
   if (mClientSource) {
     mClientSource->Thaw();
   }
   mTimeoutManager->Thaw();
 
-  mozilla::dom::workers::ThawWorkersForWindow(this);
+  ThawWorkersForWindow(this);
 
   NotifyDOMWindowThawed(this);
 }
 
 bool
 nsGlobalWindowInner::IsFrozen() const
 {
   MOZ_ASSERT(NS_IsMainThread());
--- a/dom/base/nsJSTimeoutHandler.cpp
+++ b/dom/base/nsJSTimeoutHandler.cpp
@@ -18,17 +18,16 @@
 #include "nsIContentSecurityPolicy.h"
 #include "nsIDocument.h"
 #include "nsIScriptTimeoutHandler.h"
 #include "nsIXPConnect.h"
 #include "nsJSUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
-using namespace mozilla::dom::workers;
 
 // Our JS nsIScriptTimeoutHandler implementation.
 class nsJSScriptTimeoutHandler final : public nsIScriptTimeoutHandler
 {
 public:
   // nsISupports
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsJSScriptTimeoutHandler)
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -59,18 +59,16 @@
 #include "ipc/ErrorIPCUtils.h"
 #include "mozilla/UseCounter.h"
 #include "mozilla/dom/DocGroup.h"
 #include "nsXULElement.h"
 
 namespace mozilla {
 namespace dom {
 
-using namespace workers;
-
 // Forward declare GetConstructorObject methods.
 #define HTML_TAG(_tag, _classname, _interfacename)                             \
 namespace HTML##_interfacename##ElementBinding {                               \
   JSObject* GetConstructorObject(JSContext*);                                  \
 }
 #define HTML_OTHER(_tag)
 #include "nsHTMLTagList.h"
 #undef HTML_TAG
--- a/dom/broadcastchannel/BroadcastChannel.cpp
+++ b/dom/broadcastchannel/BroadcastChannel.cpp
@@ -27,17 +27,16 @@
 #endif
 
 namespace mozilla {
 
 using namespace ipc;
 
 namespace dom {
 
-using namespace workers;
 using namespace ipc;
 
 class BroadcastChannelMessage final : public StructuredCloneDataNoTransfers
 {
 public:
   NS_INLINE_DECL_REFCOUNTING(BroadcastChannelMessage)
 
   BroadcastChannelMessage()
--- a/dom/broadcastchannel/BroadcastChannelChild.cpp
+++ b/dom/broadcastchannel/BroadcastChannelChild.cpp
@@ -18,18 +18,16 @@
 #include "mozilla/dom/WorkerPrivate.h"
 
 namespace mozilla {
 
 using namespace ipc;
 
 namespace dom {
 
-using namespace workers;
-
 BroadcastChannelChild::BroadcastChannelChild(const nsACString& aOrigin)
   : mBC(nullptr)
   , mActorDestroyed(false)
 {
   CopyUTF8toUTF16(aOrigin, mOrigin);
 }
 
 BroadcastChannelChild::~BroadcastChannelChild()
--- a/dom/canvas/ImageBitmap.cpp
+++ b/dom/canvas/ImageBitmap.cpp
@@ -21,18 +21,16 @@
 #include "imgTools.h"
 
 using namespace mozilla::gfx;
 using namespace mozilla::layers;
 
 namespace mozilla {
 namespace dom {
 
-using namespace workers;
-
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(ImageBitmap, mParent)
 NS_IMPL_CYCLE_COLLECTING_ADDREF(ImageBitmap)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(ImageBitmap)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ImageBitmap)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
--- a/dom/canvas/ImageBitmap.h
+++ b/dom/canvas/ImageBitmap.h
@@ -34,20 +34,16 @@ class SourceSurface;
 
 namespace layers {
 class Image;
 }
 
 namespace dom {
 class OffscreenCanvas;
 
-namespace workers {
-class WorkerStructuredCloneClosure;
-}
-
 class ArrayBufferViewOrArrayBuffer;
 class CanvasRenderingContext2D;
 struct ChannelPixelLayout;
 class CreateImageBitmapFromBlob;
 class CreateImageBitmapFromBlobTask;
 class CreateImageBitmapFromBlobWorkerTask;
 class File;
 class HTMLCanvasElement;
--- a/dom/clients/api/Client.cpp
+++ b/dom/clients/api/Client.cpp
@@ -14,17 +14,16 @@
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/WorkerPrivate.h"
 #include "mozilla/dom/WorkerScope.h"
 #include "nsIGlobalObject.h"
 
 namespace mozilla {
 namespace dom {
 
-using namespace workers;
 using mozilla::dom::ipc::StructuredCloneData;
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(mozilla::dom::Client);
 NS_IMPL_CYCLE_COLLECTING_RELEASE(mozilla::dom::Client);
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(mozilla::dom::Client, mGlobal);
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(mozilla::dom::Client)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
--- a/dom/clients/api/ClientDOMUtil.h
+++ b/dom/clients/api/ClientDOMUtil.h
@@ -21,18 +21,18 @@ namespace dom {
 // if the thread is shutting down.
 template<typename Func, typename Arg, typename Resolve, typename Reject>
 void
 StartClientManagerOp(Func aFunc, const Arg& aArg, nsISerialEventTarget* aTarget,
                      Resolve aResolve, Reject aReject)
 {
   RefPtr<WorkerHolderToken> token;
   if (!NS_IsMainThread()) {
-    token = WorkerHolderToken::Create(workers::GetCurrentThreadWorkerPrivate(),
-                                      mozilla::dom::WorkerStatus::Closing);
+    token = WorkerHolderToken::Create(GetCurrentThreadWorkerPrivate(),
+                                      WorkerStatus::Closing);
   }
 
   RefPtr<ClientOpPromise> promise = aFunc(aArg, aTarget);
   promise->Then(aTarget, __func__,
     [aResolve, token](const ClientOpResult& aResult) {
       if (token && token->IsShuttingDown()) {
         return;
       }
--- a/dom/clients/api/Clients.cpp
+++ b/dom/clients/api/Clients.cpp
@@ -16,17 +16,16 @@
 #include "mozilla/dom/WorkerPrivate.h"
 #include "mozilla/SystemGroup.h"
 #include "nsIGlobalObject.h"
 #include "nsString.h"
 
 namespace mozilla {
 namespace dom {
 
-using namespace workers;
 using mozilla::ipc::PrincipalInfo;
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(Clients);
 NS_IMPL_CYCLE_COLLECTING_RELEASE(Clients);
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Clients, mGlobal);
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Clients)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
--- a/dom/clients/manager/ClientManager.cpp
+++ b/dom/clients/manager/ClientManager.cpp
@@ -37,17 +37,17 @@ ClientManager::ClientManager()
   PBackgroundChild* parentActor = BackgroundChild::GetOrCreateForCurrentThread();
   if (NS_WARN_IF(!parentActor)) {
     Shutdown();
     return;
   }
 
   RefPtr<WorkerHolderToken> workerHolderToken;
   if (!NS_IsMainThread()) {
-    WorkerPrivate* workerPrivate = workers::GetCurrentThreadWorkerPrivate();
+    WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
     MOZ_DIAGNOSTIC_ASSERT(workerPrivate);
 
     workerHolderToken =
       WorkerHolderToken::Create(workerPrivate, Closing,
                                 WorkerHolderToken::AllowIdleShutdownStart);
     if (NS_WARN_IF(!workerHolderToken)) {
       Shutdown();
       return;
--- a/dom/console/Console.cpp
+++ b/dom/console/Console.cpp
@@ -58,17 +58,16 @@
 // This tags are used in the Structured Clone Algorithm to move js values from
 // worker thread to main thread
 #define CONSOLE_TAG_BLOB   JS_SCTAG_USER_MIN
 
 // This value is taken from ConsoleAPIStorage.js
 #define STORAGE_MAX_EVENTS 1000
 
 using namespace mozilla::dom::exceptions;
-using namespace mozilla::dom::workers;
 
 namespace mozilla {
 namespace dom {
 
 struct
 ConsoleStructuredCloneData
 {
   nsCOMPtr<nsISupports> mParent;
--- a/dom/crypto/WebCryptoTask.cpp
+++ b/dom/crypto/WebCryptoTask.cpp
@@ -148,17 +148,17 @@ class WebCryptoTask::InternalWorkerHolde
     // worker automatically.
   }
 
 public:
   static already_AddRefed<InternalWorkerHolder>
   Create()
   {
     MOZ_ASSERT(!NS_IsMainThread());
-    WorkerPrivate* workerPrivate = workers::GetCurrentThreadWorkerPrivate();
+    WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
     MOZ_ASSERT(workerPrivate);
     RefPtr<InternalWorkerHolder> ref = new InternalWorkerHolder();
     if (NS_WARN_IF(!ref->HoldWorker(workerPrivate, Canceling))) {
       return nullptr;
     }
     return ref.forget();
   }
 
--- a/dom/events/Event.cpp
+++ b/dom/events/Event.cpp
@@ -329,17 +329,17 @@ Event::SetTrusted(bool aTrusted)
 {
   mEvent->mFlags.mIsTrusted = aTrusted;
 }
 
 bool
 Event::Init(mozilla::dom::EventTarget* aGlobal)
 {
   if (!mIsMainThreadEvent) {
-    return workers::IsCurrentThreadRunningChromeWorker();
+    return IsCurrentThreadRunningChromeWorker();
   }
   bool trusted = false;
   nsCOMPtr<nsPIDOMWindowInner> w = do_QueryInterface(aGlobal);
   if (w) {
     nsCOMPtr<nsIDocument> d = w->GetExtantDoc();
     if (d) {
       trusted = nsContentUtils::IsChromeDoc(d);
       nsIPresShell* s = d->GetShell();
@@ -1113,17 +1113,17 @@ Event::TimeStampImpl() const
     Performance* perf = win->GetPerformance();
     if (NS_WARN_IF(!perf)) {
       return 0.0;
     }
 
     return perf->GetDOMTiming()->TimeStampToDOMHighRes(mEvent->mTimeStamp);
   }
 
-  WorkerPrivate* workerPrivate = workers::GetCurrentThreadWorkerPrivate();
+  WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
   MOZ_ASSERT(workerPrivate);
 
   return workerPrivate->TimeStampToDOMHighRes(mEvent->mTimeStamp);
 }
 
 double
 Event::TimeStamp() const
 {
--- a/dom/events/EventDispatcher.cpp
+++ b/dom/events/EventDispatcher.cpp
@@ -914,17 +914,17 @@ EventDispatcher::DispatchDOMEvent(nsISup
       innerEvent->mOriginalTarget = nullptr;
     } else {
       aDOMEvent->GetIsTrusted(&dontResetTrusted);
     }
 
     if (!dontResetTrusted) {
       //Check security state to determine if dispatcher is trusted
       bool trusted = NS_IsMainThread() ? nsContentUtils::LegacyIsCallerChromeOrNativeCode()
-                                       : mozilla::dom::workers::IsCurrentThreadRunningChromeWorker();
+                                       : IsCurrentThreadRunningChromeWorker();
       aDOMEvent->SetTrusted(trusted);
     }
 
     return EventDispatcher::Dispatch(aTarget, aPresContext, innerEvent,
                                      aDOMEvent, aEventStatus);
   } else if (aEvent) {
     return EventDispatcher::Dispatch(aTarget, aPresContext, aEvent,
                                      aDOMEvent, aEventStatus);
--- a/dom/events/JSEventHandler.cpp
+++ b/dom/events/JSEventHandler.cpp
@@ -121,17 +121,17 @@ JSEventHandler::HandleEvent(nsIDOMEvent*
 
   Event* event = aEvent->InternalDOMEvent();
   bool isMainThread = event->IsMainThreadEvent();
   bool isChromeHandler =
     isMainThread ?
       nsContentUtils::ObjectPrincipal(
         GetTypedEventHandler().Ptr()->CallbackPreserveColor()) ==
         nsContentUtils::GetSystemPrincipal() :
-      mozilla::dom::workers::IsCurrentThreadRunningChromeWorker();
+      mozilla::dom::IsCurrentThreadRunningChromeWorker();
 
   if (mTypedHandler.Type() == TypedEventHandler::eOnError) {
     MOZ_ASSERT_IF(mEventName, mEventName == nsGkAtoms::onerror);
 
     nsString errorMsg, file;
     EventOrString msgOrEvent;
     Optional<nsAString> fileName;
     Optional<uint32_t> lineNumber;
--- a/dom/fetch/Fetch.cpp
+++ b/dom/fetch/Fetch.cpp
@@ -48,18 +48,16 @@
 #include "mozilla/dom/WorkerCommon.h"
 #include "mozilla/dom/WorkerPrivate.h"
 #include "mozilla/dom/WorkerRunnable.h"
 #include "mozilla/dom/WorkerScope.h"
 
 namespace mozilla {
 namespace dom {
 
-using namespace workers;
-
 namespace {
 
 void
 AbortStream(JSContext* aCx, JS::Handle<JSObject*> aStream)
 {
   if (!JS::ReadableStreamIsReadable(aStream)) {
     return;
   }
--- a/dom/fetch/FetchConsumer.cpp
+++ b/dom/fetch/FetchConsumer.cpp
@@ -13,18 +13,16 @@
 #include "mozilla/dom/WorkerScope.h"
 #include "mozilla/ipc/PBackgroundSharedTypes.h"
 #include "nsIInputStreamPump.h"
 #include "nsProxyRelease.h"
 
 namespace mozilla {
 namespace dom {
 
-using namespace workers;
-
 namespace {
 
 template <class Derived>
 class FetchBodyWorkerHolder final : public WorkerHolder
 {
   RefPtr<FetchBodyConsumer<Derived>> mConsumer;
   bool mWasNotified;
 
--- a/dom/fetch/FetchDriver.cpp
+++ b/dom/fetch/FetchDriver.cpp
@@ -193,17 +193,17 @@ AlternativeDataStreamListener::GetCacheI
   nsCOMPtr<nsICacheInfoChannel> channel = mCacheInfoChannel;
   return channel.forget();
 }
 
 NS_IMETHODIMP
 AlternativeDataStreamListener::OnStartRequest(nsIRequest* aRequest,
                                               nsISupports* aContext)
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
   MOZ_ASSERT(!mAlternativeDataType.IsEmpty());
   // Checking the alternative data type is the same between we asked and the
   // saved in the channel.
   nsAutoCString alternativeDataType;
   nsCOMPtr<nsICacheInfoChannel> cic = do_QueryInterface(aRequest);
   mStatus = AlternativeDataStreamListener::LOADING;
   if (cic &&
       NS_SUCCEEDED(cic->GetAlternativeDataType(alternativeDataType)) &&
@@ -269,17 +269,17 @@ AlternativeDataStreamListener::OnDataAva
   return NS_OK;
 }
 
 NS_IMETHODIMP
 AlternativeDataStreamListener::OnStopRequest(nsIRequest* aRequest,
                                              nsISupports* aContext,
                                              nsresult aStatusCode)
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
 
   // Alternative data loading is going to finish, breaking the reference cycle
   // here by taking the ownership to a loacl variable.
   RefPtr<FetchDriver> fetchDriver = mFetchDriver.forget();
 
   if (mStatus == AlternativeDataStreamListener::CANCELED) {
     // do nothing
     return NS_OK;
@@ -358,17 +358,17 @@ FetchDriver::~FetchDriver()
   // We assert this since even on failures, we should call
   // FailWithNetworkError().
   MOZ_ASSERT(mResponseAvailableCalled);
 }
 
 nsresult
 FetchDriver::Fetch(AbortSignal* aSignal, FetchDriverObserver* aObserver)
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
 #ifdef DEBUG
   MOZ_ASSERT(!mFetchCalled);
   mFetchCalled = true;
 #endif
 
   mObserver = aObserver;
 
   Telemetry::Accumulate(Telemetry::SERVICE_WORKER_REQUEST_PASSTHROUGH,
@@ -766,17 +766,17 @@ FetchDriver::BeginAndGetFilteredResponse
   }
 
   return filteredResponse.forget();
 }
 
 void
 FetchDriver::FailWithNetworkError(nsresult rv)
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
   RefPtr<InternalResponse> error = InternalResponse::NetworkError(rv);
   if (mObserver) {
     mObserver->OnResponseAvailable(error);
 #ifdef DEBUG
     mResponseAvailableCalled = true;
 #endif
     mObserver->OnResponseEnd(FetchDriverObserver::eByNetworking);
     mObserver = nullptr;
@@ -784,17 +784,17 @@ FetchDriver::FailWithNetworkError(nsresu
 
   mChannel = nullptr;
 }
 
 NS_IMETHODIMP
 FetchDriver::OnStartRequest(nsIRequest* aRequest,
                             nsISupports* aContext)
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
 
   // Note, this can be called multiple times if we are doing an opaqueredirect.
   // In that case we will get a simulated OnStartRequest() and then the real
   // channel will call in with an errored OnStartRequest().
 
   nsresult rv;
   aRequest->GetStatus(&rv);
   if (NS_FAILED(rv)) {
@@ -1146,17 +1146,17 @@ FetchDriver::OnDataAvailable(nsIRequest*
   return rv;
 }
 
 NS_IMETHODIMP
 FetchDriver::OnStopRequest(nsIRequest* aRequest,
                            nsISupports* aContext,
                            nsresult aStatusCode)
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
 
   MOZ_DIAGNOSTIC_ASSERT(!mOnStopRequestCalled);
   mOnStopRequestCalled = true;
 
   // main data loading is going to finish, breaking the reference cycle.
   RefPtr<AlternativeDataStreamListener> altDataListener = mAltDataListener.forget();
 
   // We need to check mObserver, which is nulled by FailWithNetworkError(),
@@ -1212,17 +1212,17 @@ FetchDriver::OnStopRequest(nsIRequest* a
   }
 
   return FinishOnStopRequest(altDataListener);
 }
 
 nsresult
 FetchDriver::FinishOnStopRequest(AlternativeDataStreamListener* aAltDataListener)
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
   // OnStopRequest is not called from channel, that means the main data loading
   // does not finish yet. Reaching here since alternative data loading finishes.
   if (!mOnStopRequestCalled) {
     return NS_OK;
   }
 
   MOZ_DIAGNOSTIC_ASSERT(!mAltDataListener);
   // Wait for alternative data loading finish if we needed it.
--- a/dom/fetch/FetchStream.cpp
+++ b/dom/fetch/FetchStream.cpp
@@ -15,18 +15,16 @@
 #define FETCH_STREAM_FLAG 0
 
 static NS_DEFINE_CID(kStreamTransportServiceCID,
                      NS_STREAMTRANSPORTSERVICE_CID);
 
 namespace mozilla {
 namespace dom {
 
-using namespace workers;
-
 namespace {
 
 class FetchStreamWorkerHolder final : public WorkerHolder
 {
 public:
   explicit FetchStreamWorkerHolder(FetchStream* aStream)
     : WorkerHolder("FetchStreamWorkerHolder",
                    WorkerHolder::Behavior::AllowIdleShutdownStart)
--- a/dom/fetch/FetchStreamReader.cpp
+++ b/dom/fetch/FetchStreamReader.cpp
@@ -11,18 +11,16 @@
 #include "mozilla/TaskCategory.h"
 #include "nsContentUtils.h"
 #include "nsIScriptError.h"
 #include "nsPIDOMWindow.h"
 
 namespace mozilla {
 namespace dom {
 
-using namespace workers;
-
 namespace {
 
 class FetchStreamReaderWorkerHolder final : public WorkerHolder
 {
 public:
   explicit FetchStreamReaderWorkerHolder(FetchStreamReader* aReader)
     : WorkerHolder("FetchStreamReaderWorkerHolder",
                    WorkerHolder::Behavior::AllowIdleShutdownStart)
--- a/dom/file/FileBlobImpl.cpp
+++ b/dom/file/FileBlobImpl.cpp
@@ -164,17 +164,17 @@ FileBlobImpl::GetType(nsAString& aType)
 {
   aType.Truncate();
 
   if (mContentType.IsVoid()) {
     MOZ_ASSERT(mWholeFile,
                "Should only use lazy ContentType when using the whole file");
 
     if (!NS_IsMainThread()) {
-      WorkerPrivate* workerPrivate = workers::GetCurrentThreadWorkerPrivate();
+      WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
       if (!workerPrivate) {
         // I have no idea in which thread this method is called. We cannot
         // return any valid value.
         return;
       }
 
       RefPtr<GetTypeRunnable> runnable =
         new GetTypeRunnable(workerPrivate, this);
--- a/dom/file/FileReader.cpp
+++ b/dom/file/FileReader.cpp
@@ -134,17 +134,17 @@ FileReader::~FileReader()
 /* static */ already_AddRefed<FileReader>
 FileReader::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
 {
   nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
   WorkerPrivate* workerPrivate = nullptr;
 
   if (!NS_IsMainThread()) {
     JSContext* cx = aGlobal.Context();
-    workerPrivate = workers::GetWorkerPrivateFromContext(cx);
+    workerPrivate = GetWorkerPrivateFromContext(cx);
     MOZ_ASSERT(workerPrivate);
   }
 
   RefPtr<FileReader> fileReader = new FileReader(global, workerPrivate);
 
   return fileReader.forget();
 }
 
--- a/dom/file/FileReaderSync.cpp
+++ b/dom/file/FileReaderSync.cpp
@@ -436,17 +436,17 @@ FileReaderSync::SyncRead(nsIInputStream*
   }
 
   // We need to proceed async.
   nsCOMPtr<nsIAsyncInputStream> asyncStream = do_QueryInterface(aStream);
   if (!asyncStream) {
     return rv;
   }
 
-  WorkerPrivate* workerPrivate = workers::GetCurrentThreadWorkerPrivate();
+  WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
   MOZ_ASSERT(workerPrivate);
 
   AutoSyncLoopHolder syncLoop(workerPrivate, Closing);
 
   nsCOMPtr<nsIEventTarget> syncLoopTarget = syncLoop.GetEventTarget();
   if (!syncLoopTarget) {
     // SyncLoop creation can fail if the worker is shutting down.
     return NS_ERROR_DOM_INVALID_STATE_ERR;
--- a/dom/file/ipc/IPCBlobInputStreamChild.cpp
+++ b/dom/file/ipc/IPCBlobInputStreamChild.cpp
@@ -10,18 +10,16 @@
 #include "mozilla/ipc/IPCStreamUtils.h"
 #include "mozilla/dom/WorkerHolder.h"
 #include "mozilla/dom/WorkerPrivate.h"
 #include "mozilla/dom/WorkerRunnable.h"
 
 namespace mozilla {
 namespace dom {
 
-using namespace workers;
-
 namespace {
 
 // This runnable is used in case the last stream is forgotten on the 'wrong'
 // thread.
 class ShutdownRunnable final : public CancelableRunnable
 {
 public:
   explicit ShutdownRunnable(IPCBlobInputStreamChild* aActor)
--- a/dom/indexedDB/ActorsChild.cpp
+++ b/dom/indexedDB/ActorsChild.cpp
@@ -67,18 +67,16 @@
 #endif // DEBUG || GC_ON_IPC_MESSAGES
 
 namespace mozilla {
 
 using ipc::PrincipalInfo;
 
 namespace dom {
 
-using namespace workers;
-
 namespace indexedDB {
 
 /*******************************************************************************
  * ThreadLocal
  ******************************************************************************/
 
 ThreadLocal::ThreadLocal(const nsID& aBackgroundChildLoggingId)
   : mLoggingInfo(aBackgroundChildLoggingId, 1, -1, 1)
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -58,17 +58,16 @@
 // Include this last to avoid path problems on Windows.
 #include "ActorsChild.h"
 
 namespace mozilla {
 namespace dom {
 
 using namespace mozilla::dom::indexedDB;
 using namespace mozilla::dom::quota;
-using namespace mozilla::dom::workers;
 using namespace mozilla::ipc;
 
 struct IDBObjectStore::StructuredCloneWriteInfo
 {
   JSAutoStructuredCloneBuffer mCloneBuffer;
   nsTArray<StructuredCloneFile> mFiles;
   IDBDatabase* mDatabase;
   uint64_t mOffsetToKeyProp;
--- a/dom/indexedDB/IDBRequest.cpp
+++ b/dom/indexedDB/IDBRequest.cpp
@@ -35,17 +35,16 @@
 
 // Include this last to avoid path problems on Windows.
 #include "ActorsChild.h"
 
 namespace mozilla {
 namespace dom {
 
 using namespace mozilla::dom::indexedDB;
-using namespace mozilla::dom::workers;
 using namespace mozilla::ipc;
 
 namespace {
 
 NS_DEFINE_IID(kIDBRequestIID, PRIVATE_IDBREQUEST_IID);
 
 } // namespace
 
--- a/dom/indexedDB/IDBTransaction.cpp
+++ b/dom/indexedDB/IDBTransaction.cpp
@@ -28,17 +28,16 @@
 
 // Include this last to avoid path problems on Windows.
 #include "ActorsChild.h"
 
 namespace mozilla {
 namespace dom {
 
 using namespace mozilla::dom::indexedDB;
-using namespace mozilla::dom::workers;
 using namespace mozilla::ipc;
 
 class IDBTransaction::WorkerHolder final : public mozilla::dom::WorkerHolder
 {
   WorkerPrivate* mWorkerPrivate;
 
   // The IDBTransaction owns this object so we only need a weak reference back
   // to it.
--- a/dom/indexedDB/IndexedDatabaseManager.cpp
+++ b/dom/indexedDB/IndexedDatabaseManager.cpp
@@ -68,17 +68,16 @@
 #define LOW_DISK_SPACE_DATA_FULL "full"
 #define LOW_DISK_SPACE_DATA_FREE "free"
 
 namespace mozilla {
 namespace dom {
 namespace indexedDB {
 
 using namespace mozilla::dom::quota;
-using namespace mozilla::dom::workers;
 using namespace mozilla::ipc;
 
 class FileManagerInfo
 {
 public:
   already_AddRefed<FileManager>
   GetFileManager(PersistenceType aPersistenceType,
                  const nsAString& aName) const;
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -229,17 +229,16 @@
 
 #ifdef MOZ_CODE_COVERAGE
 #include "mozilla/CodeCoverageHandler.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::docshell;
 using namespace mozilla::dom::ipc;
-using namespace mozilla::dom::workers;
 using namespace mozilla::media;
 using namespace mozilla::embedding;
 using namespace mozilla::gmp;
 using namespace mozilla::hal_sandbox;
 using namespace mozilla::ipc;
 using namespace mozilla::intl;
 using namespace mozilla::layers;
 using namespace mozilla::layout;
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -142,17 +142,16 @@
     NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js")
 
 #define TABC_LOG(...)
 // #define TABC_LOG(...) printf_stderr("TABC: " __VA_ARGS__)
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::dom::ipc;
-using namespace mozilla::dom::workers;
 using namespace mozilla::ipc;
 using namespace mozilla::layers;
 using namespace mozilla::layout;
 using namespace mozilla::docshell;
 using namespace mozilla::widget;
 using namespace mozilla::jsipc;
 using mozilla::layers::GeckoContentController;
 
--- a/dom/messagechannel/MessagePort.cpp
+++ b/dom/messagechannel/MessagePort.cpp
@@ -37,18 +37,16 @@
 #include "nsIPresShell.h"
 #include "nsISupportsPrimitives.h"
 #include "nsServiceManagerUtils.h"
 
 #ifdef XP_WIN
 #undef PostMessage
 #endif
 
-using namespace mozilla::dom::workers;
-
 namespace mozilla {
 namespace dom {
 
 class PostMessageRunnable final : public CancelableRunnable
 {
   friend class MessagePort;
 
 public:
--- a/dom/notification/Notification.cpp
+++ b/dom/notification/Notification.cpp
@@ -56,18 +56,16 @@
 #include "nsStructuredCloneContainer.h"
 #include "nsThreadUtils.h"
 #include "nsToolkitCompsCID.h"
 #include "nsXULAppAPI.h"
 
 namespace mozilla {
 namespace dom {
 
-using namespace workers;
-
 struct NotificationStrings
 {
   const nsString mID;
   const nsString mTitle;
   const nsString mDir;
   const nsString mLang;
   const nsString mBody;
   const nsString mTag;
--- a/dom/notification/Notification.h
+++ b/dom/notification/Notification.h
@@ -365,17 +365,17 @@ protected:
     }
     return NotificationDirection::Auto;
   }
 
   static nsresult GetOrigin(nsIPrincipal* aPrincipal, nsString& aOrigin);
 
   void GetAlertName(nsAString& aRetval)
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     if (mAlertName.IsEmpty()) {
       SetAlertName();
     }
     aRetval = mAlertName;
   }
 
   void GetScope(nsAString& aScope)
   {
--- a/dom/performance/Performance.cpp
+++ b/dom/performance/Performance.cpp
@@ -536,17 +536,17 @@ Performance::QueueEntry(PerformanceEntry
 
 /* static */ bool
 Performance::IsObserverEnabled(JSContext* aCx, JSObject* aGlobal)
 {
   if (NS_IsMainThread()) {
     return Preferences::GetBool("dom.enable_performance_observer", false);
   }
 
-  WorkerPrivate* workerPrivate = workers::GetCurrentThreadWorkerPrivate();
+  WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
   MOZ_ASSERT(workerPrivate);
   workerPrivate->AssertIsOnWorkerThread();
 
   RefPtr<PrefEnabledRunnable> runnable =
     new PrefEnabledRunnable(workerPrivate,
                             NS_LITERAL_CSTRING("dom.enable_performance_observer"));
 
   return runnable->Dispatch() && runnable->IsEnabled();
--- a/dom/performance/PerformanceObserver.cpp
+++ b/dom/performance/PerformanceObserver.cpp
@@ -83,17 +83,17 @@ PerformanceObserver::Constructor(const G
     }
 
     RefPtr<PerformanceObserver> observer =
       new PerformanceObserver(ownerWindow, aCb);
     return observer.forget();
   }
 
   JSContext* cx = aGlobal.Context();
-  WorkerPrivate* workerPrivate = workers::GetWorkerPrivateFromContext(cx);
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(cx);
   MOZ_ASSERT(workerPrivate);
 
   RefPtr<PerformanceObserver> observer =
     new PerformanceObserver(workerPrivate, aCb);
   return observer.forget();
 }
 
 JSObject*
--- a/dom/promise/Promise.cpp
+++ b/dom/promise/Promise.cpp
@@ -489,17 +489,17 @@ Promise::ReportRejectedPromise(JSContext
   if (!report.init(aCx, result, js::ErrorReport::NoSideEffects)) {
     JS_ClearPendingException(aCx);
     return;
   }
 
   RefPtr<xpc::ErrorReport> xpcReport = new xpc::ErrorReport();
   bool isMainThread = MOZ_LIKELY(NS_IsMainThread());
   bool isChrome = isMainThread ? nsContentUtils::IsSystemPrincipal(nsContentUtils::ObjectPrincipal(aPromise))
-                               : workers::GetCurrentThreadWorkerPrivate()->IsChromeWorker();
+                               : GetCurrentThreadWorkerPrivate()->IsChromeWorker();
   nsGlobalWindowInner* win = isMainThread
     ? xpc::WindowGlobalOrNull(aPromise)
     : nullptr;
   xpcReport->Init(report.report(), report.toStringResult().c_str(), isChrome,
                   win ? win->AsInner()->WindowID() : 0);
 
   // Now post an event to do the real reporting async
   NS_DispatchToMainThread(new AsyncErrorReporter(xpcReport));
@@ -757,17 +757,17 @@ PromiseWorkerProxy::~PromiseWorkerProxy(
   MOZ_ASSERT(!mWorkerPromise);
   MOZ_ASSERT(!mWorkerPrivate);
 }
 
 void
 PromiseWorkerProxy::CleanProperties()
 {
 #ifdef DEBUG
-  WorkerPrivate* worker = workers::GetCurrentThreadWorkerPrivate();
+  WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
   MOZ_ASSERT(worker);
   worker->AssertIsOnWorkerThread();
 #endif
   // Ok to do this unprotected from Create().
   // CleanUp() holds the lock before calling this.
   mCleanedUp = true;
   mWorkerPromise = nullptr;
   mWorkerPrivate = nullptr;
@@ -810,17 +810,17 @@ PromiseWorkerProxy::GetWorkerPrivate() c
 
   return mWorkerPrivate;
 }
 
 Promise*
 PromiseWorkerProxy::WorkerPromise() const
 {
 #ifdef DEBUG
-  WorkerPrivate* worker = workers::GetCurrentThreadWorkerPrivate();
+  WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
   MOZ_ASSERT(worker);
   worker->AssertIsOnWorkerThread();
 #endif
   MOZ_ASSERT(mWorkerPromise);
   return mWorkerPromise;
 }
 
 void
--- a/dom/push/PushManager.cpp
+++ b/dom/push/PushManager.cpp
@@ -27,19 +27,16 @@
 #include "nsIPushService.h"
 
 #include "nsComponentManagerUtils.h"
 #include "nsContentUtils.h"
 
 namespace mozilla {
 namespace dom {
 
-using namespace workers;
-using workers::AssertIsOnMainThread;
-
 namespace {
 
 nsresult
 GetPermissionState(nsIPrincipal* aPrincipal,
                    PushPermissionState& aState)
 {
   nsCOMPtr<nsIPermissionManager> permManager =
     mozilla::services::GetPermissionManager();
--- a/dom/push/PushNotifier.cpp
+++ b/dom/push/PushNotifier.cpp
@@ -19,18 +19,16 @@
 
 #include "mozilla/dom/BodyUtil.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/ContentParent.h"
 
 namespace mozilla {
 namespace dom {
 
-using workers::AssertIsOnMainThread;
-
 PushNotifier::PushNotifier()
 {}
 
 PushNotifier::~PushNotifier()
 {}
 
 NS_IMPL_CYCLE_COLLECTION_0(PushNotifier)
 
--- a/dom/push/PushSubscription.cpp
+++ b/dom/push/PushSubscription.cpp
@@ -18,18 +18,16 @@
 #include "mozilla/dom/PushUtil.h"
 #include "mozilla/dom/WorkerCommon.h"
 #include "mozilla/dom/WorkerPrivate.h"
 #include "mozilla/dom/WorkerScope.h"
 
 namespace mozilla {
 namespace dom {
 
-using namespace workers;
-
 namespace {
 
 class UnsubscribeResultCallback final : public nsIUnsubscribeResultCallback
 {
 public:
   NS_DECL_ISUPPORTS
 
   explicit UnsubscribeResultCallback(Promise* aPromise)
--- a/dom/quota/StorageManager.cpp
+++ b/dom/quota/StorageManager.cpp
@@ -14,18 +14,16 @@
 #include "mozilla/ErrorResult.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/Telemetry.h"
 #include "nsContentPermissionHelper.h"
 #include "nsIQuotaCallbacks.h"
 #include "nsIQuotaRequests.h"
 #include "nsPIDOMWindow.h"
 
-using namespace mozilla::dom::workers;
-
 namespace mozilla {
 namespace dom {
 
 namespace {
 
 // This class is used to get quota usage, request persist and check persisted
 // status callbacks.
 class RequestResolver final
--- a/dom/script/ScriptSettings.cpp
+++ b/dom/script/ScriptSettings.cpp
@@ -539,17 +539,17 @@ WarningOnlyErrorReporter(JSContext* aCx,
   if (!NS_IsMainThread()) {
     // Reporting a warning on workers is a bit complicated because we have to
     // climb our parent chain until we get to the main thread.  So go ahead and
     // just go through the worker ReportError codepath here.
     //
     // That said, it feels like we should be able to short-circuit things a bit
     // here by posting an appropriate runnable to the main thread directly...
     // Worth looking into sometime.
-    WorkerPrivate* worker = workers::GetWorkerPrivateFromContext(aCx);
+    WorkerPrivate* worker = GetWorkerPrivateFromContext(aCx);
     MOZ_ASSERT(worker);
 
     worker->ReportError(aCx, JS::ConstUTF8CharsZ(), aRep);
     return;
   }
 
   RefPtr<xpc::ErrorReport> xpcReport = new xpc::ErrorReport();
   nsGlobalWindowInner* win = xpc::CurrentWindowOrNull(aCx);
@@ -576,17 +576,17 @@ AutoJSAPI::ReportException()
   // requires us to be in a compartment when we fetch the pending exception.
   // In this case, we enter the privileged junk scope and don't dispatch any
   // error events.
   JS::Rooted<JSObject*> errorGlobal(cx(), JS::CurrentGlobalOrNull(cx()));
   if (!errorGlobal) {
     if (mIsMainThread) {
       errorGlobal = xpc::PrivilegedJunkScope();
     } else {
-      errorGlobal = workers::GetCurrentThreadWorkerGlobal();
+      errorGlobal = GetCurrentThreadWorkerGlobal();
     }
   }
   JSAutoCompartment ac(cx(), errorGlobal);
   JS::Rooted<JS::Value> exn(cx());
   js::ErrorReport jsReport(cx());
   if (StealException(&exn) &&
       jsReport.init(cx(), exn, js::ErrorReport::WithSideEffects)) {
     if (mIsMainThread) {
@@ -612,17 +612,17 @@ AutoJSAPI::ReportException()
           xpc::FindExceptionStackForConsoleReport(inner, exn));
         xpcReport->LogToConsoleWithStack(stack);
       }
     } else {
       // On a worker, we just use the worker error reporting mechanism and don't
       // bother with xpc::ErrorReport.  This will ensure that all the right
       // events (which are a lot more complicated than in the window case) get
       // fired.
-      WorkerPrivate* worker = workers::GetCurrentThreadWorkerPrivate();
+      WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
       MOZ_ASSERT(worker);
       MOZ_ASSERT(worker->GetJSContext() == cx());
       // Before invoking ReportError, put the exception back on the context,
       // because it may want to put it in its error events and has no other way
       // to get hold of it.  After we invoke ReportError, clear the exception on
       // cx(), just in case ReportError didn't.
       JS_SetPendingException(cx(), exn);
       worker->ReportError(cx(), jsReport.toStringResult(), jsReport.report());
--- a/dom/serviceworkers/ServiceWorkerEvents.cpp
+++ b/dom/serviceworkers/ServiceWorkerEvents.cpp
@@ -46,17 +46,16 @@
 #include "mozilla/dom/WorkerPrivate.h"
 
 #include "js/Conversions.h"
 #include "js/TypeDecls.h"
 #include "xpcpublic.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
-using namespace mozilla::dom::workers;
 
 namespace {
 
 void
 AsyncLog(nsIInterceptedChannel *aInterceptedChannel,
          const nsACString& aRespondWithScriptSpec,
          uint32_t aRespondWithLineNumber, uint32_t aRespondWithColumnNumber,
          const nsACString& aMessageName, const nsTArray<nsString>& aParams)
--- a/dom/serviceworkers/ServiceWorkerRegistration.cpp
+++ b/dom/serviceworkers/ServiceWorkerRegistration.cpp
@@ -27,18 +27,16 @@
 #include "ServiceWorkerManager.h"
 
 #include "nsIDocument.h"
 #include "nsIServiceWorkerManager.h"
 #include "nsISupportsPrimitives.h"
 #include "nsPIDOMWindow.h"
 #include "nsContentUtils.h"
 
-using namespace mozilla::dom::workers;
-
 namespace mozilla {
 namespace dom {
 
 ////////////////////////////////////////////////////
 // Main Thread implementation
 
 class ServiceWorkerRegistrationMainThread final : public ServiceWorkerRegistration,
                                                   public ServiceWorkerRegistrationListener
--- a/dom/url/URLWorker.cpp
+++ b/dom/url/URLWorker.cpp
@@ -15,19 +15,16 @@
 #include "nsURLHelper.h"
 
 namespace mozilla {
 
 using net::nsStandardURL;
 
 namespace dom {
 
-using namespace workers;
-using workers::AssertIsOnMainThread;
-
 // Proxy class to forward all the requests to a URLMainThread object.
 class URLWorker::URLProxy final
 {
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(URLProxy)
 
   explicit URLProxy(already_AddRefed<URLMainThread> aURL)
     : mURL(aURL)
--- a/dom/websocket/WebSocket.cpp
+++ b/dom/websocket/WebSocket.cpp
@@ -63,17 +63,16 @@
 #include "nsWeakReference.h"
 
 #define OPEN_EVENT_STRING NS_LITERAL_STRING("open")
 #define MESSAGE_EVENT_STRING NS_LITERAL_STRING("message")
 #define ERROR_EVENT_STRING NS_LITERAL_STRING("error")
 #define CLOSE_EVENT_STRING NS_LITERAL_STRING("close")
 
 using namespace mozilla::net;
-using namespace mozilla::dom::workers;
 
 namespace mozilla {
 namespace dom {
 
 class WebSocketImpl final : public nsIInterfaceRequestor
                           , public nsIWebSocketListener
                           , public nsIObserver
                           , public nsSupportsWeakReference
--- a/dom/workers/MessageEventRunnable.cpp
+++ b/dom/workers/MessageEventRunnable.cpp
@@ -125,17 +125,17 @@ MessageEventRunnable::WorkerRun(JSContex
     }
 
     aWorkerPrivate->AssertInnerWindowIsCorrect();
 
     return DispatchDOMEvent(aCx, aWorkerPrivate, aWorkerPrivate,
                             !aWorkerPrivate->GetParent());
   }
 
-  MOZ_ASSERT(aWorkerPrivate == workers::GetWorkerPrivateFromContext(aCx));
+  MOZ_ASSERT(aWorkerPrivate == GetWorkerPrivateFromContext(aCx));
 
   return DispatchDOMEvent(aCx, aWorkerPrivate, aWorkerPrivate->GlobalScope(),
                           false);
 }
 
 void
 MessageEventRunnable::DispatchError(JSContext* aCx,
                                     DOMEventTargetHelper* aTarget)
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -79,17 +79,16 @@
 #define WORKERS_SHUTDOWN_TOPIC "web-workers-shutdown"
 
 namespace mozilla {
 
 using namespace ipc;
 
 namespace dom {
 
-using namespace workers;
 using namespace workerinternals;
 
 namespace workerinternals {
 
 // The size of the worker runtime heaps in bytes. May be changed via pref.
 #define WORKER_DEFAULT_RUNTIME_HEAPSIZE 32 * 1024 * 1024
 
 // The size of the generational GC nursery for workers, in bytes.
@@ -130,17 +129,17 @@ static_assert(MAX_WORKERS_PER_DOMAIN >= 
 #define GC_REQUEST_OBSERVER_TOPIC "child-gc-request"
 #define CC_REQUEST_OBSERVER_TOPIC "child-cc-request"
 #define MEMORY_PRESSURE_OBSERVER_TOPIC "memory-pressure"
 
 #define BROADCAST_ALL_WORKERS(_func, ...)                                      \
   PR_BEGIN_MACRO                                                               \
     AssertIsOnMainThread();                                                    \
                                                                                \
-    AutoTArray<WorkerPrivate*, 100> workers;                                 \
+    AutoTArray<WorkerPrivate*, 100> workers;                                   \
     {                                                                          \
       MutexAutoLock lock(mMutex);                                              \
                                                                                \
       AddAllTopLevelWorkersToArray(workers);                                   \
     }                                                                          \
                                                                                \
     if (!workers.IsEmpty()) {                                                  \
       for (uint32_t index = 0; index < workers.Length(); index++) {            \
@@ -930,24 +929,26 @@ PreserveWrapper(JSContext *cx, JSObject 
 
     return mozilla::dom::TryPreserveWrapper(obj);
 }
 
 JSObject*
 Wrap(JSContext *cx, JS::HandleObject existing, JS::HandleObject obj)
 {
   JSObject* targetGlobal = JS::CurrentGlobalOrNull(cx);
-  if (!IsDebuggerGlobal(targetGlobal) && !IsDebuggerSandbox(targetGlobal)) {
+  if (!IsWorkerDebuggerGlobal(targetGlobal) &&
+      !IsWorkerDebuggerSandbox(targetGlobal)) {
     MOZ_CRASH("There should be no edges from the debuggee to the debugger.");
   }
 
   JSObject* originGlobal = js::GetGlobalForObjectCrossCompartment(obj);
 
   const js::Wrapper* wrapper = nullptr;
-  if (IsDebuggerGlobal(originGlobal) || IsDebuggerSandbox(originGlobal)) {
+  if (IsWorkerDebuggerGlobal(originGlobal) ||
+      IsWorkerDebuggerSandbox(originGlobal)) {
     wrapper = &js::CrossCompartmentWrapper::singleton;
   } else {
     wrapper = &js::OpaqueCrossCompartmentWrapper::singleton;
   }
 
   if (existing) {
     js::Wrapper::Renew(existing, obj, wrapper);
   }
@@ -1118,30 +1119,31 @@ public:
   {
     RefPtr<nsIRunnable> runnable(aRunnable);
 
     MOZ_ASSERT(!NS_IsMainThread());
     MOZ_ASSERT(runnable);
 
     std::queue<nsCOMPtr<nsIRunnable>>* microTaskQueue = nullptr;
 
-    JSContext* cx = GetCurrentThreadJSContext();
+    JSContext* cx = GetCurrentWorkerThreadJSContext();
     NS_ASSERTION(cx, "This should never be null!");
 
     JS::Rooted<JSObject*> global(cx, JS::CurrentGlobalOrNull(cx));
     NS_ASSERTION(global, "This should never be null!");
 
     // On worker threads, if the current global is the worker global, we use the
     // main promise micro task queue. Otherwise, the current global must be
     // either the debugger global or a debugger sandbox, and we use the debugger
     // promise micro task queue instead.
     if (IsWorkerGlobal(global)) {
       microTaskQueue = &mPromiseMicroTaskQueue;
     } else {
-      MOZ_ASSERT(IsDebuggerGlobal(global) || IsDebuggerSandbox(global));
+      MOZ_ASSERT(IsWorkerDebuggerGlobal(global) ||
+                 IsWorkerDebuggerSandbox(global));
 
       microTaskQueue = &mDebuggerPromiseMicroTaskQueue;
     }
 
     microTaskQueue->push(runnable.forget());
   }
 
 private:
@@ -2807,18 +2809,16 @@ WorkerThreadPrimaryRunnable::FinishedRun
     MOZ_ALWAYS_SUCCEEDS(thread->Shutdown());
   }
 
   return NS_OK;
 }
 
 } // workerinternals namespace
 
-namespace workers {
-
 void
 CancelWorkersForWindow(nsPIDOMWindowInner* aWindow)
 {
   AssertIsOnMainThread();
   RuntimeService* runtime = RuntimeService::GetService();
   if (runtime) {
     runtime->CancelWorkersForWindow(aWindow);
   }
@@ -2901,17 +2901,17 @@ GetCurrentThreadWorkerPrivate()
 
 bool
 IsCurrentThreadRunningChromeWorker()
 {
   return GetCurrentThreadWorkerPrivate()->UsesSystemPrincipal();
 }
 
 JSContext*
-GetCurrentThreadJSContext()
+GetCurrentWorkerThreadJSContext()
 {
   WorkerPrivate* wp = GetCurrentThreadWorkerPrivate();
   if (!wp) {
     return nullptr;
   }
   return wp->GetJSContext();
 }
 
@@ -2924,22 +2924,10 @@ GetCurrentThreadWorkerGlobal()
   }
   WorkerGlobalScope* scope = wp->GlobalScope();
   if (!scope) {
     return nullptr;
   }
   return scope->GetGlobalJSObject();
 }
 
-#ifdef DEBUG
-
-void
-AssertIsOnMainThread()
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
-}
-
-#endif
-
-} // workers namespace
-
 } // dom namespace
 } // mozilla namespace
--- a/dom/workers/RuntimeService.h
+++ b/dom/workers/RuntimeService.h
@@ -168,24 +168,24 @@ public:
   }
 
   void
   NoteIdleThread(WorkerThread* aThread);
 
   static void
   GetDefaultJSSettings(workerinternals::JSSettings& aSettings)
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     aSettings = sDefaultJSSettings;
   }
 
   static void
   SetDefaultContextOptions(const JS::ContextOptions& aContextOptions)
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     sDefaultJSSettings.contextOptions = aContextOptions;
   }
 
   void
   UpdateAppNameOverridePreference(const nsAString& aValue);
 
   void
   UpdateAppVersionOverridePreference(const nsAString& aValue);
@@ -197,28 +197,28 @@ public:
   UpdateAllWorkerContextOptions();
 
   void
   UpdateAllWorkerLanguages(const nsTArray<nsString>& aLanguages);
 
   static void
   SetDefaultJSGCSettings(JSGCParamKey aKey, uint32_t aValue)
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     sDefaultJSSettings.ApplyGCSetting(aKey, aValue);
   }
 
   void
   UpdateAllWorkerMemoryParameter(JSGCParamKey aKey, uint32_t aValue);
 
 #ifdef JS_GC_ZEAL
   static void
   SetDefaultGCZeal(uint8_t aGCZeal, uint32_t aFrequency)
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     sDefaultJSSettings.gcZeal = aGCZeal;
     sDefaultJSSettings.gcZealFrequency = aFrequency;
   }
 
   void
   UpdateAllWorkerGCZeal();
 #endif
 
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -75,18 +75,16 @@
 
 using mozilla::dom::cache::Cache;
 using mozilla::dom::cache::CacheStorage;
 using mozilla::ipc::PrincipalInfo;
 
 namespace mozilla {
 namespace dom {
 
-using namespace workers;
-
 namespace {
 
 nsIURI*
 GetBaseURI(bool aIsMainScript, WorkerPrivate* aWorkerPrivate)
 {
   MOZ_ASSERT(aWorkerPrivate);
   nsIURI* baseURI;
   WorkerPrivate* parentWorker = aWorkerPrivate->GetParent();
--- a/dom/workers/WorkerCommon.h
+++ b/dom/workers/WorkerCommon.h
@@ -13,40 +13,29 @@
 
 class nsPIDOMWindowInner;
 
 namespace mozilla {
 namespace dom {
 
 class WorkerPrivate;
 
-namespace workers {
-
 // All of these are implemented in RuntimeService.cpp
 
-#ifdef DEBUG
-void
-AssertIsOnMainThread();
-#else
-inline void
-AssertIsOnMainThread()
-{ }
-#endif
-
 WorkerPrivate*
 GetWorkerPrivateFromContext(JSContext* aCx);
 
 WorkerPrivate*
 GetCurrentThreadWorkerPrivate();
 
 bool
 IsCurrentThreadRunningChromeWorker();
 
 JSContext*
-GetCurrentThreadJSContext();
+GetCurrentWorkerThreadJSContext();
 
 JSObject*
 GetCurrentThreadWorkerGlobal();
 
 void
 CancelWorkersForWindow(nsPIDOMWindowInner* aWindow);
 
 void
@@ -62,18 +51,17 @@ void
 ResumeWorkersForWindow(nsPIDOMWindowInner* aWindow);
 
 // All of these are implemented in WorkerScope.cpp
 
 bool
 IsWorkerGlobal(JSObject* global);
 
 bool
-IsDebuggerGlobal(JSObject* global);
+IsWorkerDebuggerGlobal(JSObject* global);
 
 bool
-IsDebuggerSandbox(JSObject* object);
+IsWorkerDebuggerSandbox(JSObject* object);
 
-} // workers namespace
 } // dom namespace
 } // mozilla namespace
 
 #endif // mozilla_dom_workers_WorkerCommon_h
--- a/dom/workers/WorkerError.cpp
+++ b/dom/workers/WorkerError.cpp
@@ -95,17 +95,17 @@ public:
           WorkerGlobalScope* globalScope = nullptr;
           UNWRAP_OBJECT(WorkerGlobalScope, &global, globalScope);
 
           if (!globalScope) {
             WorkerDebuggerGlobalScope* globalScope = nullptr;
             UNWRAP_OBJECT(WorkerDebuggerGlobalScope, &global, globalScope);
 
             MOZ_ASSERT_IF(globalScope, globalScope->GetWrapperPreserveColor() == global);
-            if (globalScope || IsDebuggerSandbox(global)) {
+            if (globalScope || IsWorkerDebuggerSandbox(global)) {
               aWorkerPrivate->ReportErrorToDebugger(aReport.mFilename, aReport.mLineNumber,
                                                     aReport.mMessage);
               return;
             }
 
             MOZ_ASSERT(SimpleGlobalObject::SimpleGlobalType(global) ==
                          SimpleGlobalObject::GlobalType::BindingDetail);
             // XXXbz We should really log this to console, but unwinding out of
@@ -351,17 +351,17 @@ WorkerErrorReport::ReportError(JSContext
         WorkerGlobalScope* globalScope = nullptr;
         UNWRAP_OBJECT(WorkerGlobalScope, &global, globalScope);
 
         if (!globalScope) {
           WorkerDebuggerGlobalScope* globalScope = nullptr;
           UNWRAP_OBJECT(WorkerDebuggerGlobalScope, &global, globalScope);
 
           MOZ_ASSERT_IF(globalScope, globalScope->GetWrapperPreserveColor() == global);
-          if (globalScope || IsDebuggerSandbox(global)) {
+          if (globalScope || IsWorkerDebuggerSandbox(global)) {
             aWorkerPrivate->ReportErrorToDebugger(aReport.mFilename, aReport.mLineNumber,
                                                   aReport.mMessage);
             return;
           }
 
           MOZ_ASSERT(SimpleGlobalObject::SimpleGlobalType(global) ==
                        SimpleGlobalObject::GlobalType::BindingDetail);
           // XXXbz We should really log this to console, but unwinding out of
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -91,17 +91,16 @@ TimeoutsLog()
 #define LOG(log, _args) MOZ_LOG(log, LogLevel::Debug, _args);
 
 namespace mozilla {
 
 using namespace ipc;
 
 namespace dom {
 
-using namespace workers;
 using namespace workerinternals;
 
 MOZ_DEFINE_MALLOC_SIZE_OF(JsWorkerMallocSizeOf)
 
 namespace {
 
 #ifdef DEBUG
 
--- a/dom/workers/WorkerPrivate.h
+++ b/dom/workers/WorkerPrivate.h
@@ -401,17 +401,17 @@ public:
   {
     mMutex.AssertCurrentThreadOwns();
     return mParentStatus;
   }
 
   nsIScriptContext*
   GetScriptContext() const
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     return mLoadInfo.mScriptContext;
   }
 
   const nsString&
   ScriptURL() const
   {
     return mScriptURL;
   }
@@ -450,35 +450,35 @@ public:
   ServiceWorkerScope() const
   {
     return GetServiceWorkerDescriptor().Scope();
   }
 
   nsIURI*
   GetBaseURI() const
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     return mLoadInfo.mBaseURI;
   }
 
   void
   SetBaseURI(nsIURI* aBaseURI);
 
   nsIURI*
   GetResolvedScriptURI() const
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     return mLoadInfo.mResolvedScriptURI;
   }
 
   const nsString&
   ServiceWorkerCacheName() const
   {
     MOZ_DIAGNOSTIC_ASSERT(IsServiceWorker());
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     return mLoadInfo.mServiceWorkerCacheName;
   }
 
   const ServiceWorkerDescriptor&
   GetServiceWorkerDescriptor() const
   {
     MOZ_DIAGNOSTIC_ASSERT(IsServiceWorker());
     MOZ_DIAGNOSTIC_ASSERT(mLoadInfo.mServiceWorkerDescriptor.isSome());
@@ -503,17 +503,17 @@ public:
   GetChannelInfo() const
   {
     return mLoadInfo.mChannelInfo;
   }
 
   void
   SetChannelInfo(const ChannelInfo& aChannelInfo)
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     MOZ_ASSERT(!mLoadInfo.mChannelInfo.IsInitialized());
     MOZ_ASSERT(aChannelInfo.IsInitialized());
     mLoadInfo.mChannelInfo = aChannelInfo;
   }
 
   void
   InitChannelInfo(nsIChannel* aChannel)
   {
@@ -564,36 +564,36 @@ public:
     MOZ_ASSERT(!aTimeStamp.IsNull());
     TimeDuration duration = aTimeStamp - mCreationTimeStamp;
     return duration.ToMilliseconds();
   }
 
   nsIPrincipal*
   GetPrincipal() const
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     return mLoadInfo.mPrincipal;
   }
 
   nsIPrincipal*
   GetLoadingPrincipal() const
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     return mLoadInfo.mLoadingPrincipal;
   }
 
   const nsAString& Origin() const
   {
     return mLoadInfo.mOrigin;
   }
 
   nsILoadGroup*
   GetLoadGroup() const
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     return mLoadInfo.mLoadGroup;
   }
 
   // This method allows the principal to be retrieved off the main thread.
   // Principals are main-thread objects so the caller must ensure that all
   // access occurs on the main thread.
   nsIPrincipal*
   GetPrincipalDontAssertMainThread() const
@@ -625,33 +625,33 @@ public:
   GetPrincipalInfo() const
   {
     return *mLoadInfo.mPrincipalInfo;
   }
 
   already_AddRefed<nsIChannel>
   ForgetWorkerChannel()
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     return mLoadInfo.mChannel.forget();
   }
 
   nsIDocument* GetDocument() const;
 
   nsPIDOMWindowInner*
   GetWindow()
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     return mLoadInfo.mWindow;
   }
 
   nsIContentSecurityPolicy*
   GetCSP() const
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     return mLoadInfo.mCSP;
   }
 
   void
   SetCSP(nsIContentSecurityPolicy* aCSP);
 
   nsresult
   SetCSPFromHeaderValues(const nsACString& aCSPHeaderValue,
@@ -1002,26 +1002,26 @@ public:
   // ServiceWorker and the loading principal for any other type.
   static void
   OverrideLoadInfoLoadGroup(WorkerLoadInfo& aLoadInfo,
                             nsIPrincipal* aPrincipal);
 
   bool
   IsDebuggerRegistered()
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
 
     // No need to lock here since this is only ever modified by the same thread.
     return mDebuggerRegistered;
   }
 
   void
   SetIsDebuggerRegistered(bool aDebuggerRegistered)
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
 
     MutexAutoLock lock(mMutex);
 
     MOZ_ASSERT(mDebuggerRegistered != aDebuggerRegistered);
     mDebuggerRegistered = aDebuggerRegistered;
 
     mCondVar.Notify();
   }
@@ -1038,26 +1038,26 @@ public:
     while (mDebuggerRegistered != aDebuggerRegistered) {
       mCondVar.Wait();
     }
   }
 
   WorkerDebugger*
   Debugger() const
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
 
     MOZ_ASSERT(mDebugger);
     return mDebugger;
   }
 
   void
   SetDebugger(WorkerDebugger* aDebugger)
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
 
     MOZ_ASSERT(mDebugger != aDebugger);
     mDebugger = aDebugger;
   }
 
   JS::UniqueChars
   AdoptDefaultLocale()
   {
--- a/dom/workers/WorkerRunnable.cpp
+++ b/dom/workers/WorkerRunnable.cpp
@@ -279,17 +279,17 @@ WorkerRunnable::Run()
   }
 
   // Track down the appropriate global, if any, to use for the AutoEntryScript.
   nsCOMPtr<nsIGlobalObject> globalObject;
   bool isMainThread = !targetIsWorkerThread && !mWorkerPrivate->GetParent();
   MOZ_ASSERT(isMainThread == NS_IsMainThread());
   RefPtr<WorkerPrivate> kungFuDeathGrip;
   if (targetIsWorkerThread) {
-    JSContext* cx = GetCurrentThreadJSContext();
+    JSContext* cx = GetCurrentWorkerThreadJSContext();
     if (NS_WARN_IF(!cx)) {
       return NS_ERROR_FAILURE;
     }
 
     JSObject* global = JS::CurrentGlobalOrNull(cx);
     if (global) {
       globalObject = xpc::NativeGlobal(global);
     } else {
@@ -468,17 +468,17 @@ MainThreadWorkerSyncRunnable::PostDispat
 }
 
 MainThreadStopSyncLoopRunnable::MainThreadStopSyncLoopRunnable(
                                WorkerPrivate* aWorkerPrivate,
                                already_AddRefed<nsIEventTarget>&& aSyncLoopTarget,
                                bool aResult)
 : WorkerSyncRunnable(aWorkerPrivate, Move(aSyncLoopTarget)), mResult(aResult)
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
 #ifdef DEBUG
   mWorkerPrivate->AssertValidSyncLoop(mSyncLoopTarget);
 #endif
 }
 
 nsresult
 MainThreadStopSyncLoopRunnable::Cancel()
 {
@@ -602,17 +602,17 @@ WorkerMainThreadRunnable::Dispatch(Worke
   if (!success) {
     aRv.ThrowUncatchableException();
   }
 }
 
 NS_IMETHODIMP
 WorkerMainThreadRunnable::Run()
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
 
   bool runResult = MainThreadRun();
 
   RefPtr<MainThreadStopSyncLoopRunnable> response =
     new MainThreadStopSyncLoopRunnable(mWorkerPrivate,
                                        mSyncLoopTarget.forget(),
                                        runResult);
 
@@ -694,17 +694,17 @@ WorkerProxyToMainThreadRunnable::Dispatc
   }
 
   return true;
 }
 
 NS_IMETHODIMP
 WorkerProxyToMainThreadRunnable::Run()
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
   RunOnMainThread();
   PostDispatchOnMainThread();
   return NS_OK;
 }
 
 void
 WorkerProxyToMainThreadRunnable::PostDispatchOnMainThread()
 {
--- a/dom/workers/WorkerRunnable.h
+++ b/dom/workers/WorkerRunnable.h
@@ -140,23 +140,24 @@ protected:
   // value will be passed to PostRun().  The JSContext passed in here comes from
   // an AutoJSAPI (or AutoEntryScript) that we set up on the stack.  If
   // mBehavior is ParentThreadUnchangedBusyCount, it is in the compartment of
   // mWorkerPrivate's reflector (i.e. the worker object in the parent thread),
   // unless that reflector is null, in which case it's in the compartment of the
   // parent global (which is the compartment reflector would have been in), or
   // in the null compartment if there is no parent global.  For other mBehavior
   // values, we're running on the worker thread and aCx is in whatever
-  // compartment GetCurrentThreadJSContext() was in when nsIRunnable::Run() got
-  // called.  This is actually important for cases when a runnable spins a
-  // syncloop and wants everything that happens during the syncloop to happen in
-  // the compartment that runnable set up (which may, for example, be a debugger
-  // sandbox compartment!).  If aCx wasn't in a compartment to start with, aCx
-  // will be in either the debugger global's compartment or the worker's
-  // global's compartment depending on whether IsDebuggerRunnable() is true.
+  // compartment GetCurrentWorkerThreadJSContext() was in when
+  // nsIRunnable::Run() got called.  This is actually important for cases when a
+  // runnable spins a syncloop and wants everything that happens during the
+  // syncloop to happen in the compartment that runnable set up (which may, for
+  // example, be a debugger sandbox compartment!).  If aCx wasn't in a
+  // compartment to start with, aCx will be in either the debugger global's
+  // compartment or the worker's global's compartment depending on whether
+  // IsDebuggerRunnable() is true.
   //
   // Immediately after WorkerRun returns, the caller will assert that either it
   // returns false or there is no exception pending on aCx.  Then it will report
   // any pending exceptions on aCx.
   virtual bool
   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) = 0;
 
   // By default asserts that Run() (and WorkerRun()) were called on the correct
@@ -196,17 +197,17 @@ private:
   IsDebuggerRunnable() const override
   {
     return true;
   }
 
   virtual bool
   PreDispatch(WorkerPrivate* aWorkerPrivate) override final
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
 
     return true;
   }
 
   virtual void
   PostDispatch(WorkerPrivate* aWorkerPrivate,
                bool aDispatchResult) override;
 };
@@ -238,34 +239,34 @@ class MainThreadWorkerSyncRunnable : pub
 {
 protected:
   // Passing null for aSyncLoopTarget is allowed and will result in the behavior
   // of a normal WorkerRunnable.
   MainThreadWorkerSyncRunnable(WorkerPrivate* aWorkerPrivate,
                                nsIEventTarget* aSyncLoopTarget)
   : WorkerSyncRunnable(aWorkerPrivate, aSyncLoopTarget)
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
   }
 
   MainThreadWorkerSyncRunnable(WorkerPrivate* aWorkerPrivate,
                                already_AddRefed<nsIEventTarget>&& aSyncLoopTarget)
   : WorkerSyncRunnable(aWorkerPrivate, Move(aSyncLoopTarget))
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
   }
 
   virtual ~MainThreadWorkerSyncRunnable()
   { }
 
 private:
   virtual bool
   PreDispatch(WorkerPrivate* aWorkerPrivate) override
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     return true;
   }
 
   virtual void
   PostDispatch(WorkerPrivate* aWorkerPrivate,
                bool aDispatchResult) override;
 };
 
@@ -308,34 +309,34 @@ private:
 // A convenience class for WorkerRunnables that are originated on the main
 // thread.
 class MainThreadWorkerRunnable : public WorkerRunnable
 {
 protected:
   explicit MainThreadWorkerRunnable(WorkerPrivate* aWorkerPrivate)
   : WorkerRunnable(aWorkerPrivate, WorkerThreadUnchangedBusyCount)
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
   }
 
   virtual ~MainThreadWorkerRunnable()
   {}
 
   virtual bool
   PreDispatch(WorkerPrivate* aWorkerPrivate) override
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     return true;
   }
 
   virtual void
   PostDispatch(WorkerPrivate* aWorkerPrivate,
                bool aDispatchResult) override
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
   }
 };
 
 // A convenience class for WorkerControlRunnables that originate on the main
 // thread.
 class MainThreadWorkerControlRunnable : public WorkerControlRunnable
 {
 protected:
@@ -344,25 +345,25 @@ protected:
   { }
 
   virtual ~MainThreadWorkerControlRunnable()
   { }
 
   virtual bool
   PreDispatch(WorkerPrivate* aWorkerPrivate) override
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     return true;
   }
 
   virtual void
   PostDispatch(WorkerPrivate* aWorkerPrivate,
                bool aDispatchResult) override
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
   }
 };
 
 // A WorkerRunnable that should be dispatched from the worker to itself for
 // async tasks. This will increment the busy count PostDispatch() (only if
 // dispatch was successful) and decrement it in PostRun().
 //
 // Async tasks will almost always want to use this since
@@ -500,17 +501,17 @@ public:
 protected:
   virtual ~MainThreadStopSyncLoopRunnable()
   { }
 
 private:
   virtual bool
   PreDispatch(WorkerPrivate* aWorkerPrivate) override final
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     return true;
   }
 
   virtual void
   PostDispatch(WorkerPrivate* aWorkerPrivate,
                bool aDispatchResult) override;
 
   virtual bool
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -979,17 +979,17 @@ WorkerDebuggerGlobalScope::LoadSubScript
                                          const Optional<JS::Handle<JSObject*>>& aSandbox,
                                          ErrorResult& aRv)
 {
   mWorkerPrivate->AssertIsOnWorkerThread();
 
   Maybe<JSAutoCompartment> ac;
   if (aSandbox.WasPassed()) {
     JS::Rooted<JSObject*> sandbox(aCx, js::CheckedUnwrap(aSandbox.Value()));
-    if (!IsDebuggerSandbox(sandbox)) {
+    if (!IsWorkerDebuggerSandbox(sandbox)) {
       aRv.Throw(NS_ERROR_INVALID_ARG);
       return;
     }
 
     ac.emplace(aCx, sandbox);
   }
 
   nsTArray<nsString> urls;
@@ -1112,32 +1112,29 @@ WorkerDebuggerGlobalScope::EventTargetFo
 }
 
 AbstractThread*
 WorkerDebuggerGlobalScope::AbstractMainThreadFor(TaskCategory aCategory)
 {
   MOZ_CRASH("AbstractMainThreadFor not supported for workers.");
 }
 
-namespace workers {
-
 bool
 IsWorkerGlobal(JSObject* object)
 {
   return IS_INSTANCE_OF(WorkerGlobalScope, object);
 }
 
 bool
-IsDebuggerGlobal(JSObject* object)
+IsWorkerDebuggerGlobal(JSObject* object)
 {
   return IS_INSTANCE_OF(WorkerDebuggerGlobalScope, object);
 }
 
 bool
-IsDebuggerSandbox(JSObject* object)
+IsWorkerDebuggerSandbox(JSObject* object)
 {
   return SimpleGlobalObject::SimpleGlobalType(object) ==
     SimpleGlobalObject::GlobalType::WorkerDebuggerSandbox;
 }
 
-} // workers namespace
 } // dom namespace
 } // mozilla namespace
--- a/dom/xhr/XMLHttpRequestWorker.cpp
+++ b/dom/xhr/XMLHttpRequestWorker.cpp
@@ -156,27 +156,27 @@ public:
   Teardown(bool aSendUnpin);
 
   bool
   AddRemoveEventListeners(bool aUpload, bool aAdd);
 
   void
   Reset()
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
 
     if (mUploadEventListenersAttached) {
       AddRemoveEventListeners(true, false);
     }
   }
 
   already_AddRefed<nsIEventTarget>
   GetEventTarget()
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
 
     nsCOMPtr<nsIEventTarget> target = mSyncEventResponseTarget ?
                                       mSyncEventResponseTarget :
                                       mSyncLoopTarget;
     return target.forget();
   }
 
 private:
@@ -367,17 +367,17 @@ public:
 
 private:
   ~AsyncTeardownRunnable()
   { }
 
   NS_IMETHOD
   Run() override
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
 
     // This means the XHR was GC'd, so we can't be pinned, and we don't need to
     // try to unpin.
     mProxy->Teardown(/* aSendUnpin */ false);
     mProxy = nullptr;
 
     return NS_OK;
   }
@@ -444,41 +444,41 @@ public:
     : Runnable("dom::LoadStartDetectionRunnable")
     , mWorkerPrivate(aProxy->mWorkerPrivate)
     , mProxy(aProxy)
     , mXHR(aProxy->mXHR)
     , mXMLHttpRequestPrivate(aXHRPrivate)
     , mChannelId(mProxy->mInnerChannelId)
     , mReceivedLoadStart(false)
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
     CopyASCIItoUTF16(sEventStrings[STRING_loadstart], mEventType);
   }
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIRUNNABLE
   NS_DECL_NSIDOMEVENTLISTENER
 
   bool
   RegisterAndDispatch()
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
 
     if (NS_FAILED(mXHR->AddEventListener(mEventType, this, false, false, 2))) {
       NS_WARNING("Failed to add event listener!");
       return false;
     }
 
     return NS_SUCCEEDED(mWorkerPrivate->DispatchToMainThread(this));
   }
 
 private:
   ~LoadStartDetectionRunnable()
   {
-    workers::AssertIsOnMainThread();
+    AssertIsOnMainThread();
   }
 };
 
 class EventRunnable final : public MainThreadProxyRunnable
                           , public StructuredCloneHolder
 {
   nsString mType;
   nsString mResponseType;
@@ -847,17 +847,17 @@ public:
   }
 };
 
 } // namespace
 
 bool
 Proxy::Init()
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
   MOZ_ASSERT(mWorkerPrivate);
 
   if (mXHR) {
     return true;
   }
 
   nsPIDOMWindowInner* ownerWindow = mWorkerPrivate->GetWindow();
   if (ownerWindow && !ownerWindow->IsCurrentInnerWindow()) {
@@ -890,17 +890,17 @@ Proxy::Init()
   }
 
   return true;
 }
 
 void
 Proxy::Teardown(bool aSendUnpin)
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
 
   if (mXHR) {
     Reset();
 
     // NB: We are intentionally dropping events coming from xhr.abort on the
     // floor.
     AddRemoveEventListeners(false, false);
 
@@ -940,17 +940,17 @@ Proxy::Teardown(bool aSendUnpin)
 
   MOZ_ASSERT(!mWorkerPrivate);
   MOZ_ASSERT(!mSyncLoopTarget);
 }
 
 bool
 Proxy::AddRemoveEventListeners(bool aUpload, bool aAdd)
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
 
   NS_ASSERTION(!aUpload ||
                (mUploadEventListenersAttached && !aAdd) ||
                (!mUploadEventListenersAttached && aAdd),
                "Messed up logic for upload listeners!");
 
   nsCOMPtr<nsIDOMEventTarget> target =
     aUpload ?
@@ -980,17 +980,17 @@ Proxy::AddRemoveEventListeners(bool aUpl
   return true;
 }
 
 NS_IMPL_ISUPPORTS(Proxy, nsIDOMEventListener)
 
 NS_IMETHODIMP
 Proxy::HandleEvent(nsIDOMEvent* aEvent)
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
 
   if (!mWorkerPrivate || !mXMLHttpRequestPrivate) {
     NS_ERROR("Shouldn't get here!");
     return NS_OK;
   }
 
   nsString type;
   if (NS_FAILED(aEvent->GetType(type))) {
@@ -1061,17 +1061,17 @@ Proxy::HandleEvent(nsIDOMEvent* aEvent)
 }
 
 NS_IMPL_ISUPPORTS_INHERITED(LoadStartDetectionRunnable, Runnable,
                                                         nsIDOMEventListener)
 
 NS_IMETHODIMP
 LoadStartDetectionRunnable::Run()
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
 
   if (NS_FAILED(mXHR->RemoveEventListener(mEventType, this, false))) {
     NS_WARNING("Failed to remove event listener!");
   }
 
   if (!mReceivedLoadStart) {
     if (mProxy->mOutstandingSendCount > 1) {
       mProxy->mOutstandingSendCount--;
@@ -1093,17 +1093,17 @@ LoadStartDetectionRunnable::Run()
   mXHR = nullptr;
   mXMLHttpRequestPrivate = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 LoadStartDetectionRunnable::HandleEvent(nsIDOMEvent* aEvent)
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
 
 #ifdef DEBUG
   {
     nsString type;
     if (NS_SUCCEEDED(aEvent->GetType(type))) {
       MOZ_ASSERT(type == mEventType);
     }
     else {
@@ -1114,17 +1114,17 @@ LoadStartDetectionRunnable::HandleEvent(
 
   mReceivedLoadStart = true;
   return NS_OK;
 }
 
 bool
 EventRunnable::PreDispatch(WorkerPrivate* /* unused */)
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
 
   AutoJSAPI jsapi;
   DebugOnly<bool> ok = jsapi.Init(xpc::NativeGlobal(mScopeObj));
   MOZ_ASSERT(ok);
   JSContext* cx = jsapi.cx();
   // Now keep the mScopeObj alive for the duration
   JS::Rooted<JSObject*> scopeObj(cx, mScopeObj);
   // And reset mScopeObj now, before we have a chance to run its destructor on
@@ -1369,17 +1369,17 @@ EventRunnable::WorkerRun(JSContext* aCx,
   }
 
   return true;
 }
 
 bool
 WorkerThreadProxySyncRunnable::MainThreadRun()
 {
-  workers::AssertIsOnMainThread();
+  AssertIsOnMainThread();
 
   nsCOMPtr<nsIEventTarget> tempTarget = mSyncLoopTarget;
 
   mProxy->mSyncEventResponseTarget.swap(tempTarget);
 
   ErrorResult rv;
   RunOnMainThread(rv);
   mErrorCode = rv.StealNSResult();
@@ -1584,17 +1584,17 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INH
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
 /* static */ already_AddRefed<XMLHttpRequest>
 XMLHttpRequestWorker::Construct(const GlobalObject& aGlobal,
                                 const MozXMLHttpRequestParameters& aParams,
                                 ErrorResult& aRv)
 {
   JSContext* cx = aGlobal.Context();
-  WorkerPrivate* workerPrivate = workers::GetWorkerPrivateFromContext(cx);
+  WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(cx);
   MOZ_ASSERT(workerPrivate);
 
   RefPtr<XMLHttpRequestWorker> xhr = new XMLHttpRequestWorker(workerPrivate);
 
   if (workerPrivate->XHRParamsAllowed()) {
     if (aParams.mMozSystem)
       xhr->mMozAnon = true;
     else
--- a/gfx/thebes/gfxUtils.cpp
+++ b/gfx/thebes/gfxUtils.cpp
@@ -1453,18 +1453,17 @@ private:
 };
 
 /* static */ nsresult
 gfxUtils::ThreadSafeGetFeatureStatus(const nsCOMPtr<nsIGfxInfo>& gfxInfo,
                                      int32_t feature, nsACString& failureId,
                                      int32_t* status)
 {
   if (!NS_IsMainThread()) {
-    dom::WorkerPrivate* workerPrivate =
-      dom::workers::GetCurrentThreadWorkerPrivate();
+    dom::WorkerPrivate* workerPrivate = dom::GetCurrentThreadWorkerPrivate();
 
     RefPtr<GetFeatureStatusRunnable> runnable =
       new GetFeatureStatusRunnable(workerPrivate, gfxInfo, feature, failureId,
                                    status);
 
     ErrorResult rv;
     runnable->Dispatch(dom::WorkerStatus::Terminating, rv);
     if (rv.Failed()) {
--- a/ipc/glue/BackgroundParentImpl.cpp
+++ b/ipc/glue/BackgroundParentImpl.cpp
@@ -65,25 +65,20 @@ using mozilla::dom::cache::PCacheParent;
 using mozilla::dom::cache::PCacheStorageParent;
 using mozilla::dom::cache::PCacheStreamControlParent;
 using mozilla::dom::FileSystemBase;
 using mozilla::dom::FileSystemRequestParent;
 using mozilla::dom::MessagePortParent;
 using mozilla::dom::PMessagePortParent;
 using mozilla::dom::UDPSocketParent;
 using mozilla::dom::WebAuthnTransactionParent;
+using mozilla::AssertIsOnMainThread;
 
 namespace {
 
-void
-AssertIsOnMainThread()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-}
-
 class TestParent final : public mozilla::ipc::PBackgroundTestParent
 {
   friend class mozilla::ipc::BackgroundParentImpl;
 
   TestParent()
   {
     MOZ_COUNT_CTOR(TestParent);
   }
--- a/ipc/glue/IPCStreamSource.cpp
+++ b/ipc/glue/IPCStreamSource.cpp
@@ -132,17 +132,17 @@ IPCStreamSource::Initialize()
   // A source can be used on any thread, but we only support IPCStream on
   // main thread, Workers and PBackground thread right now.  This is due
   // to the requirement  that the thread be guaranteed to live long enough to
   // receive messages. We can enforce this guarantee with a WorkerHolder on
   // worker threads, but not other threads. Main-thread and PBackground thread
   // do not need anything special in order to be kept alive.
   WorkerPrivate* workerPrivate = nullptr;
   if (!NS_IsMainThread()) {
-    workerPrivate = mozilla::dom::workers::GetCurrentThreadWorkerPrivate();
+    workerPrivate = mozilla::dom::GetCurrentThreadWorkerPrivate();
     if (workerPrivate) {
       bool result = HoldWorker(workerPrivate, WorkerStatus::Canceling);
       if (!result) {
         return false;
       }
 
       mWorkerPrivate = workerPrivate;
     } else {
--- a/js/src/devtools/rootAnalysis/annotations.js
+++ b/js/src/devtools/rootAnalysis/annotations.js
@@ -221,17 +221,17 @@ var ignoreFunctions = {
 
     // This calls any JSObjectMovedOp for the tenured object via an indirect call.
     "JSObject* js::TenuringTracer::moveToTenuredSlow(JSObject*)" : true,
 
     "void js::Nursery::freeMallocedBuffers()" : true,
 
     "void js::AutoEnterOOMUnsafeRegion::crash(uint64, int8*)" : true,
 
-    "void mozilla::dom::workers::WorkerPrivate::AssertIsOnWorkerThread() const" : true,
+    "void mozilla::dom::WorkerPrivate::AssertIsOnWorkerThread() const" : true,
 
     // It would be cool to somehow annotate that nsTHashtable<T> will use
     // nsTHashtable<T>::s_MatchEntry for its matchEntry function pointer, but
     // there is no mechanism for that. So we will just annotate a particularly
     // troublesome logging-related usage.
     "EntryType* nsTHashtable<EntryType>::PutEntry(nsTHashtable<EntryType>::KeyType, const fallible_t&) [with EntryType = nsBaseHashtableET<nsCharPtrHashKey, nsAutoPtr<mozilla::LogModule> >; nsTHashtable<EntryType>::KeyType = const char*; nsTHashtable<EntryType>::fallible_t = mozilla::fallible_t]" : true,
     "EntryType* nsTHashtable<EntryType>::GetEntry(nsTHashtable<EntryType>::KeyType) const [with EntryType = nsBaseHashtableET<nsCharPtrHashKey, nsAutoPtr<mozilla::LogModule> >; nsTHashtable<EntryType>::KeyType = const char*]" : true,
     "EntryType* nsTHashtable<EntryType>::PutEntry(nsTHashtable<EntryType>::KeyType) [with EntryType = nsBaseHashtableET<nsPtrHashKey<const mozilla::BlockingResourceBase>, nsAutoPtr<mozilla::DeadlockDetector<mozilla::BlockingResourceBase>::OrderingEntry> >; nsTHashtable<EntryType>::KeyType = const mozilla::BlockingResourceBase*]" : true,
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -1238,27 +1238,25 @@ IsChromeOrXBL(JSContext* cx, JSObject* /
     // compat and not security for remote XUL, we just always claim to be XBL.
     //
     // Note that, for performance, we don't check AllowXULXBLForPrincipal here,
     // and instead rely on the fact that AllowContentXBLScope() only returns false in
     // remote XUL situations.
     return AccessCheck::isChrome(c) || IsContentXBLCompartment(c) || !AllowContentXBLScope(realm);
 }
 
-namespace workers {
 extern bool IsCurrentThreadRunningChromeWorker();
-}
 
 bool
 ThreadSafeIsChromeOrXBL(JSContext* cx, JSObject* obj)
 {
     if (NS_IsMainThread()) {
         return IsChromeOrXBL(cx, obj);
     }
-    return workers::IsCurrentThreadRunningChromeWorker();
+    return IsCurrentThreadRunningChromeWorker();
 }
 
 } // namespace dom
 } // namespace mozilla
 
 void
 xpc::CreateCooperativeContext()
 {
--- a/xpcom/threads/MainThreadUtils.h
+++ b/xpcom/threads/MainThreadUtils.h
@@ -25,11 +25,25 @@ extern nsresult NS_GetMainThread(nsIThre
 // AddRef it.  Otherwise, you should only consider this pointer valid from code
 // running on the current thread.
 extern nsIThread* NS_GetCurrentThread();
 #endif
 
 #ifdef MOZILLA_INTERNAL_API
 bool NS_IsMainThreadTLSInitialized();
 bool NS_IsMainThread();
+
+namespace mozilla {
+
+#ifdef DEBUG
+void
+AssertIsOnMainThread();
+#else
+inline void
+AssertIsOnMainThread()
+{ }
+#endif
+
+} // mozilla namespace
+
 #endif
 
 #endif // MainThreadUtils_h_
--- a/xpcom/threads/nsThreadManager.cpp
+++ b/xpcom/threads/nsThreadManager.cpp
@@ -73,16 +73,30 @@ NS_UnsetMainThread()
 {
   MOZ_ASSERT(Scheduler::IsCooperativeThread());
 
   sTLSIsMainThread.set(false);
   MOZ_ASSERT(!NS_IsMainThread());
   gTlsCurrentVirtualThread.set(nullptr);
 }
 
+#ifdef DEBUG
+
+namespace mozilla {
+
+void
+AssertIsOnMainThread()
+{
+  MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
+}
+
+} // mozilla namespace
+
+#endif
+
 typedef nsTArray<NotNull<RefPtr<nsThread>>> nsThreadArray;
 
 //-----------------------------------------------------------------------------
 
 static void
 ReleaseObject(void* aData)
 {
   static_cast<nsISupports*>(aData)->Release();