Bug 1302448 part 1 - Rename CycleCollectedJSRuntime to CycleCollectedJSContext. r=mccr8
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 14 Sep 2016 15:47:32 +0200
changeset 313916 fff0c85df59096ad9245c127d36a3baa6a337b2d
parent 313915 87423892cc1ce99dc57f7f3395aac51afe21573f
child 313917 1d1db582972c2e14e1376489c6522b1c3cee05fc
push id81734
push userjandemooij@gmail.com
push dateWed, 14 Sep 2016 13:51:18 +0000
treeherdermozilla-inbound@b0675d0dcfb5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1302448
milestone51.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 1302448 part 1 - Rename CycleCollectedJSRuntime to CycleCollectedJSContext. r=mccr8
devtools/shared/heapsnapshot/HeapSnapshot.cpp
devtools/shared/heapsnapshot/tests/gtest/DevTools.h
dom/animation/Animation.cpp
dom/asmjscache/AsmJSCache.cpp
dom/base/ScriptSettings.cpp
dom/base/nsContentUtils.cpp
dom/base/nsFrameMessageManager.cpp
dom/base/nsJSEnvironment.cpp
dom/base/nsWrapperCache.cpp
dom/bindings/BindingUtils.h
dom/bindings/Exceptions.cpp
dom/events/EventListenerManager.cpp
dom/events/JSEventHandler.cpp
dom/promise/Promise.cpp
dom/promise/PromiseDebugging.cpp
dom/workers/RuntimeService.cpp
dom/workers/WorkerPrivate.cpp
dom/workers/WorkerThread.cpp
js/src/devtools/rootAnalysis/annotations.js
js/xpconnect/src/XPCJSRuntime.cpp
js/xpconnect/src/nsXPConnect.cpp
js/xpconnect/src/xpcprivate.h
layout/style/FontFace.cpp
xpcom/base/CycleCollectedJSContext.cpp
xpcom/base/CycleCollectedJSContext.h
xpcom/base/CycleCollectedJSRuntime.cpp
xpcom/base/CycleCollectedJSRuntime.h
xpcom/base/DebuggerOnGCRunnable.cpp
xpcom/base/DeferredFinalize.cpp
xpcom/base/HoldDropJSObjects.cpp
xpcom/base/moz.build
xpcom/base/nsCycleCollector.cpp
xpcom/base/nsCycleCollector.h
xpcom/glue/tests/gtest/TestGCPostBarriers.cpp
xpcom/threads/nsThread.cpp
xpcom/threads/nsThread.h
--- a/devtools/shared/heapsnapshot/HeapSnapshot.cpp
+++ b/devtools/shared/heapsnapshot/HeapSnapshot.cpp
@@ -11,17 +11,17 @@
 
 #include "js/Debug.h"
 #include "js/TypeDecls.h"
 #include "js/UbiNodeBreadthFirst.h"
 #include "js/UbiNodeCensus.h"
 #include "js/UbiNodeDominatorTree.h"
 #include "js/UbiNodeShortestPaths.h"
 #include "mozilla/Attributes.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/devtools/AutoMemMap.h"
 #include "mozilla/devtools/CoreDump.pb.h"
 #include "mozilla/devtools/DeserializedNode.h"
 #include "mozilla/devtools/DominatorTree.h"
 #include "mozilla/devtools/FileDescriptorOutputStream.h"
 #include "mozilla/devtools/HeapSnapshotTempFileHelperChild.h"
 #include "mozilla/devtools/ZeroCopyNSIOutputStream.h"
 #include "mozilla/dom/ChromeUtils.h"
@@ -57,19 +57,19 @@ using ::google::protobuf::io::GzipInputS
 using ::google::protobuf::io::ZeroCopyInputStream;
 
 using JS::ubi::AtomOrTwoByteChars;
 using JS::ubi::ShortestPaths;
 
 MallocSizeOf
 GetCurrentThreadDebuggerMallocSizeOf()
 {
-  auto ccrt = CycleCollectedJSRuntime::Get();
-  MOZ_ASSERT(ccrt);
-  auto cx = ccrt->Context();
+  auto ccjscx = CycleCollectedJSContext::Get();
+  MOZ_ASSERT(ccjscx);
+  auto cx = ccjscx->Context();
   MOZ_ASSERT(cx);
   auto mallocSizeOf = JS::dbg::GetDebuggerMallocSizeOf(cx);
   MOZ_ASSERT(mallocSizeOf);
   return mallocSizeOf;
 }
 
 /*** Cycle Collection Boilerplate *****************************************************************/
 
@@ -550,19 +550,19 @@ HeapSnapshot::DescribeNode(JSContext* cx
 }
 
 
 already_AddRefed<DominatorTree>
 HeapSnapshot::ComputeDominatorTree(ErrorResult& rv)
 {
   Maybe<JS::ubi::DominatorTree> maybeTree;
   {
-    auto ccrt = CycleCollectedJSRuntime::Get();
-    MOZ_ASSERT(ccrt);
-    auto cx = ccrt->Context();
+    auto ccjscx = CycleCollectedJSContext::Get();
+    MOZ_ASSERT(ccjscx);
+    auto cx = ccjscx->Context();
     MOZ_ASSERT(cx);
     JS::AutoCheckCannotGC nogc(cx);
     maybeTree = JS::ubi::DominatorTree::Create(cx, nogc, getRoot());
   }
 
   if (NS_WARN_IF(maybeTree.isNothing())) {
     rv.Throw(NS_ERROR_OUT_OF_MEMORY);
     return nullptr;
--- a/devtools/shared/heapsnapshot/tests/gtest/DevTools.h
+++ b/devtools/shared/heapsnapshot/tests/gtest/DevTools.h
@@ -10,17 +10,17 @@
 #include "jsapi.h"
 #include "jspubtd.h"
 #include "nsCRTGlue.h"
 
 #include "gtest/gtest.h"
 #include "gmock/gmock.h"
 #include "mozilla/devtools/HeapSnapshot.h"
 #include "mozilla/dom/ChromeUtils.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/Move.h"
 #include "js/Principals.h"
 #include "js/UbiNode.h"
 #include "js/UniquePtr.h"
 
 using namespace mozilla;
 using namespace mozilla::devtools;
 using namespace mozilla::dom;
@@ -55,17 +55,17 @@ struct DevTools : public ::testing::Test
 
     compartment = js::GetContextCompartment(cx);
     zone = js::GetContextZone(cx);
 
     _initialized = true;
   }
 
   JSContext* getContext() {
-    return CycleCollectedJSRuntime::Get()->Context();
+    return CycleCollectedJSContext::Get()->Context();
   }
 
   static void reportError(JSContext* cx, const char* message, JSErrorReport* report) {
     fprintf(stderr, "%s:%u:%s\n",
             report->filename ? report->filename : "<no filename>",
             (unsigned int) report->lineno,
             message);
   }
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -1330,24 +1330,24 @@ Animation::GetRenderedDocument() const
   }
 
   return mEffect->AsKeyframeEffect()->GetRenderedDocument();
 }
 
 void
 Animation::DoFinishNotification(SyncNotifyFlag aSyncNotifyFlag)
 {
-  CycleCollectedJSRuntime* runtime = CycleCollectedJSRuntime::Get();
+  CycleCollectedJSContext* context = CycleCollectedJSContext::Get();
 
   if (aSyncNotifyFlag == SyncNotifyFlag::Sync) {
     DoFinishNotificationImmediately();
   } else if (!mFinishNotificationTask.IsPending()) {
     RefPtr<nsRunnableMethod<Animation>> runnable =
       NewRunnableMethod(this, &Animation::DoFinishNotificationImmediately);
-    runtime->DispatchToMicroTask(do_AddRef(runnable));
+    context->DispatchToMicroTask(do_AddRef(runnable));
     mFinishNotificationTask = runnable.forget();
   }
 }
 
 void
 Animation::ResetFinishedPromise()
 {
   mFinishedIsResolved = false;
--- a/dom/asmjscache/AsmJSCache.cpp
+++ b/dom/asmjscache/AsmJSCache.cpp
@@ -7,17 +7,17 @@
 #include "AsmJSCache.h"
 
 #include <stdio.h>
 
 #include "js/RootingAPI.h"
 #include "jsfriendapi.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/CondVar.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/dom/asmjscache/PAsmJSCacheEntryChild.h"
 #include "mozilla/dom/asmjscache/PAsmJSCacheEntryParent.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/PermissionMessageUtils.h"
 #include "mozilla/dom/quota/Client.h"
 #include "mozilla/dom/quota/QuotaManager.h"
 #include "mozilla/dom/quota/QuotaObject.h"
 #include "mozilla/dom/quota/UsageInfo.h"
--- a/dom/base/ScriptSettings.cpp
+++ b/dom/base/ScriptSettings.cpp
@@ -2,17 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/ThreadLocal.h"
 #include "mozilla/Assertions.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 
 #include "jsapi.h"
 #include "xpcpublic.h"
 #include "nsIGlobalObject.h"
 #include "nsIDocShell.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIScriptContext.h"
 #include "nsContentUtils.h"
@@ -284,24 +284,24 @@ IsJSAPIActive()
   ScriptSettingsStackEntry* topEntry = ScriptSettingsStack::Top();
   return topEntry && !topEntry->NoJSAPI();
 }
 
 namespace danger {
 JSContext*
 GetJSContext()
 {
-  return CycleCollectedJSRuntime::Get()->Context();
+  return CycleCollectedJSContext::Get()->Context();
 }
 } // namespace danger
 
 JS::RootingContext*
 RootingCx()
 {
-  return CycleCollectedJSRuntime::Get()->RootingCx();
+  return CycleCollectedJSContext::Get()->RootingCx();
 }
 
 AutoJSAPI::AutoJSAPI()
   : ScriptSettingsStackEntry(nullptr, eJSAPI)
   , mCx(nullptr)
   , mIsMainThread(false) // For lack of anything better
 {
 }
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -5192,26 +5192,26 @@ nsContentUtils::AddScriptRunner(nsIRunna
   nsCOMPtr<nsIRunnable> runnable = aRunnable;
   AddScriptRunner(runnable.forget());
 }
 
 /* static */
 void
 nsContentUtils::RunInStableState(already_AddRefed<nsIRunnable> aRunnable)
 {
-  MOZ_ASSERT(CycleCollectedJSRuntime::Get(), "Must be on a script thread!");
-  CycleCollectedJSRuntime::Get()->RunInStableState(Move(aRunnable));
+  MOZ_ASSERT(CycleCollectedJSContext::Get(), "Must be on a script thread!");
+  CycleCollectedJSContext::Get()->RunInStableState(Move(aRunnable));
 }
 
 /* static */
 void
 nsContentUtils::RunInMetastableState(already_AddRefed<nsIRunnable> aRunnable)
 {
-  MOZ_ASSERT(CycleCollectedJSRuntime::Get(), "Must be on a script thread!");
-  CycleCollectedJSRuntime::Get()->RunInMetastableState(Move(aRunnable));
+  MOZ_ASSERT(CycleCollectedJSContext::Get(), "Must be on a script thread!");
+  CycleCollectedJSContext::Get()->RunInMetastableState(Move(aRunnable));
 }
 
 void
 nsContentUtils::EnterMicroTask()
 {
   MOZ_ASSERT(NS_IsMainThread());
   ++sMicroTaskLevel;
 }
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -24,17 +24,17 @@
 #include "nsIXULRuntime.h"
 #include "nsIScriptError.h"
 #include "nsIConsoleService.h"
 #include "nsIMemoryReporter.h"
 #include "nsIProtocolHandler.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIDOMClassInfo.h"
 #include "xpcpublic.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/IntentionalCrash.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/MessagePort.h"
 #include "mozilla/dom/MessagePortList.h"
 #include "mozilla/dom/nsIContentParent.h"
 #include "mozilla/dom/PermissionMessageUtils.h"
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -51,17 +51,17 @@
 #include "WrapperFactory.h"
 #include "nsGlobalWindow.h"
 #include "nsScriptNameSpaceManager.h"
 #include "mozilla/AutoRestore.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/DOMExceptionBinding.h"
 #include "mozilla/dom/ErrorEvent.h"
 #include "nsAXPCNativeCallContext.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 
 #include "nsJSPrincipals.h"
 
 #ifdef XP_MACOSX
 // AssertMacros.h defines 'check' and conflicts with AccessCheck.h
 #undef check
 #endif
 #include "AccessCheck.h"
@@ -70,17 +70,17 @@
 #include "prthread.h"
 
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/asmjscache/AsmJSCache.h"
 #include "mozilla/dom/CanvasRenderingContext2DBinding.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/ContentEvents.h"
 
 #include "nsCycleCollectionNoteRootCallback.h"
 #include "GeckoProfiler.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
@@ -1203,17 +1203,17 @@ nsJSContext::GarbageCollectNow(JS::gcrea
   }
 
   JSGCInvocationKind gckind = aShrinking == ShrinkingGC ? GC_SHRINK : GC_NORMAL;
 
   if (sNeedsFullGC || aReason != JS::gcreason::CC_WAITING) {
     sNeedsFullGC = false;
     JS::PrepareForFullGC(sContext);
   } else {
-    CycleCollectedJSRuntime::Get()->PrepareWaitingZonesForGC();
+    CycleCollectedJSContext::Get()->PrepareWaitingZonesForGC();
   }
 
   if (aIncremental == IncrementalGC) {
     JS::StartIncrementalGC(sContext, gckind, aReason, aSliceMillis);
   } else {
     JS::GCForReason(sContext, gckind, aReason);
   }
 }
--- a/dom/base/nsWrapperCache.cpp
+++ b/dom/base/nsWrapperCache.cpp
@@ -4,17 +4,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/. */
 
 #include "nsWrapperCacheInlines.h"
 
 #include "js/Class.h"
 #include "js/Proxy.h"
 #include "mozilla/dom/DOMJSProxyHandler.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/HoldDropJSObjects.h"
 #include "nsCycleCollectionTraversalCallback.h"
 #include "nsCycleCollector.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 #ifdef DEBUG
@@ -26,28 +26,28 @@ nsWrapperCache::HasJSObjectMovedOp(JSObj
 #endif
 
 void
 nsWrapperCache::HoldJSObjects(void* aScriptObjectHolder,
                               nsScriptObjectTracer* aTracer)
 {
   cyclecollector::HoldJSObjectsImpl(aScriptObjectHolder, aTracer);
   if (mWrapper && !JS::ObjectIsTenured(mWrapper)) {
-    CycleCollectedJSRuntime::Get()->NurseryWrapperPreserved(mWrapper);
+    CycleCollectedJSContext::Get()->NurseryWrapperPreserved(mWrapper);
   }
 }
 
 void
 nsWrapperCache::SetWrapperJSObject(JSObject* aWrapper)
 {
   mWrapper = aWrapper;
   UnsetWrapperFlags(kWrapperFlagsMask & ~WRAPPER_IS_NOT_DOM_BINDING);
 
   if (aWrapper && !JS::ObjectIsTenured(aWrapper)) {
-    CycleCollectedJSRuntime::Get()->NurseryWrapperAdded(this);
+    CycleCollectedJSContext::Get()->NurseryWrapperAdded(this);
   }
 }
 
 void
 nsWrapperCache::ReleaseWrapper(void* aScriptObjectHolder)
 {
   if (PreservingWrapper()) {
     // PreserveWrapper puts new DOM bindings in the JS holders hash, but they
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -9,17 +9,17 @@
 
 #include "jsfriendapi.h"
 #include "jswrapper.h"
 #include "js/Conversions.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Alignment.h"
 #include "mozilla/Array.h"
 #include "mozilla/Assertions.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/DeferredFinalize.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/dom/CallbackObject.h"
 #include "mozilla/dom/DOMJSClass.h"
 #include "mozilla/dom/DOMJSProxyHandler.h"
 #include "mozilla/dom/Exceptions.h"
 #include "mozilla/dom/NonRefcountedDOMObject.h"
 #include "mozilla/dom/Nullable.h"
--- a/dom/bindings/Exceptions.cpp
+++ b/dom/bindings/Exceptions.cpp
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/Exceptions.h"
 
 #include "js/GCAPI.h"
 #include "js/TypeDecls.h"
 #include "jsapi.h"
 #include "jsprf.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "nsIProgrammingLanguage.h"
 #include "nsPIDOMWindow.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "XPCWrapper.h"
@@ -140,22 +140,22 @@ Throw(JSContext* aCx, nsresult aRv, cons
     return false;
   }
 
   if (JS_IsExceptionPending(aCx)) {
     // Don't clobber the existing exception.
     return false;
   }
 
-  CycleCollectedJSRuntime* runtime = CycleCollectedJSRuntime::Get();
-  nsCOMPtr<nsIException> existingException = runtime->GetPendingException();
+  CycleCollectedJSContext* context = CycleCollectedJSContext::Get();
+  nsCOMPtr<nsIException> existingException = context->GetPendingException();
   // Make sure to clear the pending exception now.  Either we're going to reuse
   // it (and we already grabbed it), or we plan to throw something else and this
   // pending exception is no longer relevant.
-  runtime->SetPendingException(nullptr);
+  context->SetPendingException(nullptr);
 
   // Ignore the pending exception if we have a non-default message passed in.
   if (aMessage.IsEmpty() && existingException) {
     nsresult nr;
     if (NS_SUCCEEDED(existingException->GetResult(&nr)) &&
         aRv == nr) {
       // Reuse the existing exception.
       ThrowExceptionObject(aCx, existingException);
--- a/dom/events/EventListenerManager.cpp
+++ b/dom/events/EventListenerManager.cpp
@@ -4,17 +4,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/. */
 
 // Microsoft's API Name hackery sucks
 #undef CreateEvent
 
 #include "mozilla/AddonPathService.h"
 #include "mozilla/BasicEvents.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/DOMEventTargetHelper.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventListenerManager.h"
 #ifdef MOZ_B2G
 #include "mozilla/Hal.h"
 #endif // #ifdef MOZ_B2G
 #include "mozilla/HalSensor.h"
 #include "mozilla/InternalMutationEvent.h"
--- a/dom/events/JSEventHandler.cpp
+++ b/dom/events/JSEventHandler.cpp
@@ -14,17 +14,17 @@
 #include "nsVariant.h"
 #include "nsIDOMBeforeUnloadEvent.h"
 #include "nsGkAtoms.h"
 #include "xpcpublic.h"
 #include "nsJSEnvironment.h"
 #include "nsDOMJSUtils.h"
 #include "WorkerPrivate.h"
 #include "mozilla/ContentEvents.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/HoldDropJSObjects.h"
 #include "mozilla/JSEventHandler.h"
 #include "mozilla/Likely.h"
 #include "mozilla/dom/ErrorEvent.h"
 
 namespace mozilla {
 
 using namespace dom;
--- a/dom/promise/Promise.cpp
+++ b/dom/promise/Promise.cpp
@@ -4,17 +4,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/. */
 
 #include "mozilla/dom/Promise.h"
 
 #include "js/Debug.h"
 
 #include "mozilla/Atomics.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/OwningNonNull.h"
 #include "mozilla/Preferences.h"
 
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/DOMError.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/DOMExceptionBinding.h"
 #include "mozilla/dom/MediaStreamError.h"
@@ -57,17 +57,17 @@ using namespace workers;
 class PromiseReactionJob final : public Runnable
 {
 public:
   PromiseReactionJob(Promise* aPromise,
                      PromiseCallback* aCallback,
                      const JS::Value& aValue)
     : mPromise(aPromise)
     , mCallback(aCallback)
-    , mValue(CycleCollectedJSRuntime::Get()->Runtime(), aValue)
+    , mValue(CycleCollectedJSContext::Get()->Context(), aValue)
   {
     MOZ_ASSERT(aPromise);
     MOZ_ASSERT(aCallback);
     MOZ_COUNT_CTOR(PromiseReactionJob);
   }
 
   virtual
   ~PromiseReactionJob()
@@ -182,17 +182,17 @@ GetPromise(JSContext* aCx, JS::Handle<JS
 // Equivalent to the specification's ResolvePromiseViaThenableTask.
 class PromiseResolveThenableJob final : public Runnable
 {
 public:
   PromiseResolveThenableJob(Promise* aPromise,
                             JS::Handle<JSObject*> aThenable,
                             PromiseInit* aThen)
     : mPromise(aPromise)
-    , mThenable(CycleCollectedJSRuntime::Get()->Runtime(), aThenable)
+    , mThenable(CycleCollectedJSContext::Get()->Context(), aThenable)
     , mThen(aThen)
   {
     MOZ_ASSERT(aPromise);
     MOZ_COUNT_CTOR(PromiseResolveThenableJob);
   }
 
   virtual
   ~PromiseResolveThenableJob()
@@ -1036,21 +1036,21 @@ Promise::ReportRejectedPromise(JSContext
 }
 #endif // defined(SPIDERMONKEY_PROMISE)
 
 bool
 Promise::PerformMicroTaskCheckpoint()
 {
   MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
 
-  CycleCollectedJSRuntime* runtime = CycleCollectedJSRuntime::Get();
+  CycleCollectedJSContext* context = CycleCollectedJSContext::Get();
 
   // On the main thread, we always use the main promise micro task queue.
   std::queue<nsCOMPtr<nsIRunnable>>& microtaskQueue =
-    runtime->GetPromiseMicroTaskQueue();
+    context->GetPromiseMicroTaskQueue();
 
   if (microtaskQueue.empty()) {
     return false;
   }
 
   AutoSlowOperation aso;
 
   do {
@@ -1059,83 +1059,83 @@ Promise::PerformMicroTaskCheckpoint()
 
     // This function can re-enter, so we remove the element before calling.
     microtaskQueue.pop();
     nsresult rv = runnable->Run();
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return false;
     }
     aso.CheckForInterrupt();
-    runtime->AfterProcessMicrotask();
+    context->AfterProcessMicrotask();
   } while (!microtaskQueue.empty());
 
   return true;
 }
 
 void
 Promise::PerformWorkerMicroTaskCheckpoint()
 {
   MOZ_ASSERT(!NS_IsMainThread(), "Wrong thread!");
 
-  CycleCollectedJSRuntime* runtime = CycleCollectedJSRuntime::Get();
+  CycleCollectedJSContext* context = CycleCollectedJSContext::Get();
 
   for (;;) {
     // For a normal microtask checkpoint, we try to use the debugger microtask
     // queue first. If the debugger queue is empty, we use the normal microtask
     // queue instead.
     std::queue<nsCOMPtr<nsIRunnable>>* microtaskQueue =
-      &runtime->GetDebuggerPromiseMicroTaskQueue();
+      &context->GetDebuggerPromiseMicroTaskQueue();
 
     if (microtaskQueue->empty()) {
-      microtaskQueue = &runtime->GetPromiseMicroTaskQueue();
+      microtaskQueue = &context->GetPromiseMicroTaskQueue();
       if (microtaskQueue->empty()) {
         break;
       }
     }
 
     nsCOMPtr<nsIRunnable> runnable = microtaskQueue->front().forget();
     MOZ_ASSERT(runnable);
 
     // This function can re-enter, so we remove the element before calling.
     microtaskQueue->pop();
     nsresult rv = runnable->Run();
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return;
     }
-    runtime->AfterProcessMicrotask();
+    context->AfterProcessMicrotask();
   }
 }
 
 void
 Promise::PerformWorkerDebuggerMicroTaskCheckpoint()
 {
   MOZ_ASSERT(!NS_IsMainThread(), "Wrong thread!");
 
-  CycleCollectedJSRuntime* runtime = CycleCollectedJSRuntime::Get();
+  CycleCollectedJSContext* context = CycleCollectedJSContext::Get();
 
   for (;;) {
     // For a debugger microtask checkpoint, we always use the debugger microtask
     // queue.
     std::queue<nsCOMPtr<nsIRunnable>>* microtaskQueue =
-      &runtime->GetDebuggerPromiseMicroTaskQueue();
+      &context->GetDebuggerPromiseMicroTaskQueue();
 
     if (microtaskQueue->empty()) {
       break;
     }
 
     nsCOMPtr<nsIRunnable> runnable = microtaskQueue->front().forget();
     MOZ_ASSERT(runnable);
 
     // This function can re-enter, so we remove the element before calling.
     microtaskQueue->pop();
     nsresult rv = runnable->Run();
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return;
     }
-    runtime->AfterProcessMicrotask();
+    context->AfterProcessMicrotask();
   }
 }
 
 #ifndef SPIDERMONKEY_PROMISE
 
 /* static */ bool
 Promise::JSCallback(JSContext* aCx, unsigned aArgc, JS::Value* aVp)
 {
@@ -2710,17 +2710,17 @@ Promise::HandleException(JSContext* aCx)
 }
 
 void
 Promise::ResolveInternal(JSContext* aCx,
                          JS::Handle<JS::Value> aValue)
 {
   NS_ASSERT_OWNINGTHREAD(Promise);
 
-  CycleCollectedJSRuntime* runtime = CycleCollectedJSRuntime::Get();
+  CycleCollectedJSContext* context = CycleCollectedJSContext::Get();
 
   mResolvePending = true;
 
   if (aValue.isObject()) {
     JS::Rooted<JSObject*> valueObj(aCx, &aValue.toObject());
 
     // Thenables.
     JS::Rooted<JS::Value> then(aCx);
@@ -2752,17 +2752,17 @@ Promise::ResolveInternal(JSContext* aCx,
       //
       // Ensuring that stuff while not inside SpiderMonkey is painful, so let's
       // drop the fast path for now.
 
       RefPtr<PromiseInit> thenCallback =
         new PromiseInit(nullptr, thenObj, mozilla::dom::GetIncumbentGlobal());
       RefPtr<PromiseResolveThenableJob> task =
         new PromiseResolveThenableJob(this, valueObj, thenCallback);
-      runtime->DispatchToMicroTask(task.forget());
+      context->DispatchToMicroTask(task.forget());
       return;
     }
   }
 
   MaybeSettle(aValue, Resolved);
 }
 
 void
@@ -2856,17 +2856,17 @@ Promise::MaybeSettle(JS::Handle<JS::Valu
   Settle(aValue, aState);
 }
 
 void
 Promise::TriggerPromiseReactions()
 {
   NS_ASSERT_OWNINGTHREAD(Promise);
 
-  CycleCollectedJSRuntime* runtime = CycleCollectedJSRuntime::Get();
+  CycleCollectedJSContext* runtime = CycleCollectedJSContext::Get();
 
   nsTArray<RefPtr<PromiseCallback>> callbacks;
   callbacks.SwapElements(mState == Resolved ? mResolveCallbacks
                                             : mRejectCallbacks);
   mResolveCallbacks.Clear();
   mRejectCallbacks.Clear();
 
   for (uint32_t i = 0; i < callbacks.Length(); ++i) {
--- a/dom/promise/PromiseDebugging.cpp
+++ b/dom/promise/PromiseDebugging.cpp
@@ -2,17 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "js/Value.h"
 #include "nsThreadUtils.h"
 
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/ThreadLocal.h"
 #include "mozilla/TimeStamp.h"
 
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/PromiseBinding.h"
 #include "mozilla/dom/PromiseDebugging.h"
@@ -313,26 +313,26 @@ PromiseDebugging::GetTimeToSettle(Global
 }
 
 #endif // SPIDERMONKEY_PROMISE
 
 /* static */ void
 PromiseDebugging::AddUncaughtRejectionObserver(GlobalObject&,
                                                UncaughtRejectionObserver& aObserver)
 {
-  CycleCollectedJSRuntime* storage = CycleCollectedJSRuntime::Get();
+  CycleCollectedJSContext* storage = CycleCollectedJSContext::Get();
   nsTArray<nsCOMPtr<nsISupports>>& observers = storage->mUncaughtRejectionObservers;
   observers.AppendElement(&aObserver);
 }
 
 /* static */ bool
 PromiseDebugging::RemoveUncaughtRejectionObserver(GlobalObject&,
                                                   UncaughtRejectionObserver& aObserver)
 {
-  CycleCollectedJSRuntime* storage = CycleCollectedJSRuntime::Get();
+  CycleCollectedJSContext* storage = CycleCollectedJSContext::Get();
   nsTArray<nsCOMPtr<nsISupports>>& observers = storage->mUncaughtRejectionObservers;
   for (size_t i = 0; i < observers.Length(); ++i) {
     UncaughtRejectionObserver* observer = static_cast<UncaughtRejectionObserver*>(observers[i].get());
     if (*observer == aObserver) {
       observers.RemoveElementAt(i);
       return true;
     }
   }
@@ -340,46 +340,46 @@ PromiseDebugging::RemoveUncaughtRejectio
 }
 
 #ifdef SPIDERMONKEY_PROMISE
 
 /* static */ void
 PromiseDebugging::AddUncaughtRejection(JS::HandleObject aPromise)
 {
   // This might OOM, but won't set a pending exception, so we'll just ignore it.
-  if (CycleCollectedJSRuntime::Get()->mUncaughtRejections.append(aPromise)) {
+  if (CycleCollectedJSContext::Get()->mUncaughtRejections.append(aPromise)) {
     FlushRejections::DispatchNeeded();
   }
 }
 
 /* void */ void
 PromiseDebugging::AddConsumedRejection(JS::HandleObject aPromise)
 {
   // If the promise is in our list of uncaught rejections, we haven't yet
   // reported it as unhandled. In that case, just remove it from the list
   // and don't add it to the list of consumed rejections.
-  auto& uncaughtRejections = CycleCollectedJSRuntime::Get()->mUncaughtRejections;
+  auto& uncaughtRejections = CycleCollectedJSContext::Get()->mUncaughtRejections;
   for (size_t i = 0; i < uncaughtRejections.length(); i++) {
     if (uncaughtRejections[i] == aPromise) {
       // To avoid large amounts of memmoves, we don't shrink the vector here.
       // Instead, we filter out nullptrs when iterating over the vector later.
       uncaughtRejections[i].set(nullptr);
       return;
     }
   }
   // This might OOM, but won't set a pending exception, so we'll just ignore it.
-  if (CycleCollectedJSRuntime::Get()->mConsumedRejections.append(aPromise)) {
+  if (CycleCollectedJSContext::Get()->mConsumedRejections.append(aPromise)) {
     FlushRejections::DispatchNeeded();
   }
 }
 
 /* static */ void
 PromiseDebugging::FlushUncaughtRejectionsInternal()
 {
-  CycleCollectedJSRuntime* storage = CycleCollectedJSRuntime::Get();
+  CycleCollectedJSContext* storage = CycleCollectedJSContext::Get();
 
   auto& uncaught = storage->mUncaughtRejections;
   auto& consumed = storage->mConsumedRejections;
 
   AutoJSAPI jsapi;
   jsapi.Init();
   JSContext* cx = jsapi.cx();
 
@@ -422,24 +422,24 @@ PromiseDebugging::FlushUncaughtRejection
   storage->mConsumedRejections.clear();
 }
 
 #else
 
 /* static */ void
 PromiseDebugging::AddUncaughtRejection(Promise& aPromise)
 {
-  CycleCollectedJSRuntime::Get()->mUncaughtRejections.AppendElement(&aPromise);
+  CycleCollectedJSContext::Get()->mUncaughtRejections.AppendElement(&aPromise);
   FlushRejections::DispatchNeeded();
 }
 
 /* void */ void
 PromiseDebugging::AddConsumedRejection(Promise& aPromise)
 {
-  CycleCollectedJSRuntime::Get()->mConsumedRejections.AppendElement(&aPromise);
+  CycleCollectedJSContext::Get()->mConsumedRejections.AppendElement(&aPromise);
   FlushRejections::DispatchNeeded();
 }
 
 /* static */ void
 PromiseDebugging::GetPromiseID(GlobalObject&,
                                JS::Handle<JSObject*> aPromise,
                                nsString& aID,
                                ErrorResult& aRv)
@@ -451,17 +451,17 @@ PromiseDebugging::GetPromiseID(GlobalObj
   uint64_t promiseID = promise->GetID();
   aID = sIDPrefix;
   aID.AppendInt(promiseID);
 }
 
 /* static */ void
 PromiseDebugging::FlushUncaughtRejectionsInternal()
 {
-  CycleCollectedJSRuntime* storage = CycleCollectedJSRuntime::Get();
+  CycleCollectedJSContext* storage = CycleCollectedJSContext::Get();
 
   // The Promise that have been left uncaught (rejected and last in
   // their chain) since the last call to this function.
   nsTArray<nsCOMPtr<nsISupports>> uncaught;
   storage->mUncaughtRejections.SwapElements(uncaught);
 
   // The Promise that have been left uncaught at some point, but that
   // have eventually had their `then` method called.
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -23,17 +23,17 @@
 #include "nsPIDOMWindow.h"
 
 #include <algorithm>
 #include "BackgroundChild.h"
 #include "GeckoProfiler.h"
 #include "jsfriendapi.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Atomics.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/dom/asmjscache/AsmJSCache.h"
 #include "mozilla/dom/AtomList.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/ErrorEventBinding.h"
 #include "mozilla/dom/EventTargetBinding.h"
 #include "mozilla/dom/MessageChannel.h"
@@ -1038,17 +1038,17 @@ Wrap(JSContext *cx, JS::HandleObject exi
   return js::Wrapper::New(cx, obj, wrapper);
 }
 
 static const JSWrapObjectCallbacks WrapObjectCallbacks = {
   Wrap,
   nullptr,
 };
 
-class WorkerJSRuntime : public mozilla::CycleCollectedJSRuntime
+class WorkerJSRuntime : public mozilla::CycleCollectedJSContext
 {
 public:
   // The heap size passed here doesn't matter, we will change it later in the
   // call to JS_SetGCParameter inside InitJSContextForWorker.
   explicit WorkerJSRuntime(WorkerPrivate* aWorkerPrivate)
     : mWorkerPrivate(aWorkerPrivate)
   {
     MOZ_ASSERT(aWorkerPrivate);
@@ -1073,17 +1073,17 @@ public:
     // The CC is shut down, and the superclass destructor will GC, so make sure
     // we don't try to CC again.
     mWorkerPrivate = nullptr;
   }
 
   nsresult Initialize(JSContext* aParentContext)
   {
     nsresult rv =
-      CycleCollectedJSRuntime::Initialize(aParentContext,
+      CycleCollectedJSContext::Initialize(aParentContext,
                                           WORKER_DEFAULT_RUNTIME_HEAPSIZE,
                                           WORKER_DEFAULT_NURSERY_SIZE);
      if (NS_WARN_IF(NS_FAILED(rv))) {
        return rv;
      }
 
     JSContext* cx = Context();
 
@@ -1137,20 +1137,20 @@ public:
     }
   }
 
   virtual void AfterProcessTask(uint32_t aRecursionDepth) override
   {
     // Only perform the Promise microtask checkpoint on the outermost event
     // loop.  Don't run it, for example, during sync XHR or importScripts.
     if (aRecursionDepth == 2) {
-      CycleCollectedJSRuntime::AfterProcessTask(aRecursionDepth);
+      CycleCollectedJSContext::AfterProcessTask(aRecursionDepth);
     } else if (aRecursionDepth > 2) {
       AutoDisableMicroTaskCheckpoint disableMicroTaskCheckpoint;
-      CycleCollectedJSRuntime::AfterProcessTask(aRecursionDepth);
+      CycleCollectedJSContext::AfterProcessTask(aRecursionDepth);
     }
   }
 
   virtual void DispatchToMicroTask(already_AddRefed<nsIRunnable> aRunnable) override
   {
     RefPtr<nsIRunnable> runnable(aRunnable);
 
     MOZ_ASSERT(!NS_IsMainThread());
@@ -1445,29 +1445,29 @@ GetWorkerPrivateFromContext(JSContext* a
     static_cast<WorkerThreadContextPrivate*>(cxPrivate)->GetWorkerPrivate();
 }
 
 WorkerPrivate*
 GetCurrentThreadWorkerPrivate()
 {
   MOZ_ASSERT(!NS_IsMainThread());
 
-  CycleCollectedJSRuntime* ccrt = CycleCollectedJSRuntime::Get();
-  if (!ccrt) {
+  CycleCollectedJSContext* ccjscx = CycleCollectedJSContext::Get();
+  if (!ccjscx) {
     return nullptr;
   }
 
-  JSContext* cx = ccrt->Context();
+  JSContext* cx = ccjscx->Context();
   MOZ_ASSERT(cx);
 
   void* cxPrivate = JS_GetContextPrivate(cx);
   if (!cxPrivate) {
     // This can happen if the nsCycleCollector_shutdown() in ~WorkerJSRuntime()
     // triggers any calls to GetCurrentThreadWorkerPrivate().  At this stage
-    // CycleCollectedJSRuntime::Get() will still return a runtime, but
+    // CycleCollectedJSContext::Get() will still return a context, but
     // the context private has already been cleared.
     return nullptr;
   }
 
   return
     static_cast<WorkerThreadContextPrivate*>(cxPrivate)->GetWorkerPrivate();
 }
 
@@ -1878,17 +1878,17 @@ RuntimeService::ScheduleWorker(WorkerPri
   int32_t priority = aWorkerPrivate->IsChromeWorker() ?
                      nsISupportsPriority::PRIORITY_NORMAL :
                      nsISupportsPriority::PRIORITY_LOW;
 
   if (NS_FAILED(thread->SetPriority(priority))) {
     NS_WARNING("Could not set the thread's priority!");
   }
 
-  JSContext* cx = CycleCollectedJSRuntime::Get()->Context();
+  JSContext* cx = CycleCollectedJSContext::Get()->Context();
   nsCOMPtr<nsIRunnable> runnable =
     new WorkerThreadPrimaryRunnable(aWorkerPrivate, thread,
                                     JS_GetParentContext(cx));
   if (NS_FAILED(thread->DispatchPrimaryRunnable(friendKey, runnable.forget()))) {
     UnregisterWorker(aWorkerPrivate);
     return false;
   }
 
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -4593,17 +4593,17 @@ WorkerPrivate::DoRunLoop(JSContext* aCx)
   MOZ_CRASH("Shouldn't get here!");
 }
 
 void
 WorkerPrivate::OnProcessNextEvent()
 {
   AssertIsOnWorkerThread();
 
-  uint32_t recursionDepth = CycleCollectedJSRuntime::Get()->RecursionDepth();
+  uint32_t recursionDepth = CycleCollectedJSContext::Get()->RecursionDepth();
   MOZ_ASSERT(recursionDepth);
 
   // Normally we process control runnables in DoRunLoop or RunCurrentSyncLoop.
   // However, it's possible that non-worker C++ could spin its own nested event
   // loop, and in that case we must ensure that we continue to process control
   // runnables here.
   if (recursionDepth > 1 &&
       mSyncLoopStack.Length() < recursionDepth - 1) {
@@ -4612,17 +4612,17 @@ WorkerPrivate::OnProcessNextEvent()
     // return value.
   }
 }
 
 void
 WorkerPrivate::AfterProcessNextEvent()
 {
   AssertIsOnWorkerThread();
-  MOZ_ASSERT(CycleCollectedJSRuntime::Get()->RecursionDepth());
+  MOZ_ASSERT(CycleCollectedJSContext::Get()->RecursionDepth());
 }
 
 void
 WorkerPrivate::MaybeDispatchLoadFailedRunnable()
 {
   AssertIsOnWorkerThread();
 
   nsCOMPtr<nsIRunnable> runnable = StealLoadFailedAsyncRunnable();
--- a/dom/workers/WorkerThread.cpp
+++ b/dom/workers/WorkerThread.cpp
@@ -326,17 +326,17 @@ WorkerThread::Observer::OnProcessNextEve
 
   // If the PBackground child is not created yet, then we must permit
   // blocking event processing to support
   // BackgroundChild::SynchronouslyCreateForCurrentThread(). If this occurs
   // then we are spinning on the event queue at the start of
   // PrimaryWorkerRunnable::Run() and don't want to process the event in
   // mWorkerPrivate yet.
   if (aMayWait) {
-    MOZ_ASSERT(CycleCollectedJSRuntime::Get()->RecursionDepth() == 2);
+    MOZ_ASSERT(CycleCollectedJSContext::Get()->RecursionDepth() == 2);
     MOZ_ASSERT(!BackgroundChild::GetForCurrentThread());
     return NS_OK;
   }
 
   mWorkerPrivate->OnProcessNextEvent();
   return NS_OK;
 }
 
--- a/js/src/devtools/rootAnalysis/annotations.js
+++ b/js/src/devtools/rootAnalysis/annotations.js
@@ -71,18 +71,18 @@ var ignoreClasses = {
 
 // Ignore calls through TYPE.FIELD, where TYPE is the class or struct name containing
 // a function pointer field named FIELD.
 var ignoreCallees = {
     "js::ClassOps.trace" : true,
     "js::ClassOps.finalize" : true,
     "JSRuntime.destroyPrincipals" : true,
     "icu_50::UObject.__deleting_dtor" : true, // destructors in ICU code can't cause GC
-    "mozilla::CycleCollectedJSRuntime.DescribeCustomObjects" : true, // During tracing, cannot GC.
-    "mozilla::CycleCollectedJSRuntime.NoteCustomGCThingXPCOMChildren" : true, // During tracing, cannot GC.
+    "mozilla::CycleCollectedJSContext.DescribeCustomObjects" : true, // During tracing, cannot GC.
+    "mozilla::CycleCollectedJSContext.NoteCustomGCThingXPCOMChildren" : true, // During tracing, cannot GC.
     "PLDHashTableOps.hashKey" : true,
     "z_stream_s.zfree" : true,
     "z_stream_s.zalloc" : true,
     "GrGLInterface.fCallback" : true,
     "std::strstreambuf._M_alloc_fun" : true,
     "std::strstreambuf._M_free_fun" : true,
     "struct js::gc::Callback<void (*)(JSContext*, void*)>.op" : true,
     "mozilla::ThreadSharedFloatArrayBufferList::Storage.mFree" : true,
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -650,17 +650,17 @@ XPCJSRuntime::TraverseAdditionalNativeRo
     for (XPCRootSetElem* e = mWrappedJSRoots; e ; e = e->GetNextRoot()) {
         cb.NoteXPCOMRoot(ToSupports(static_cast<nsXPCWrappedJS*>(e)));
     }
 }
 
 void
 XPCJSRuntime::UnmarkSkippableJSHolders()
 {
-    CycleCollectedJSRuntime::UnmarkSkippableJSHolders();
+    CycleCollectedJSContext::UnmarkSkippableJSHolders();
 }
 
 void
 XPCJSRuntime::PrepareForForgetSkippable()
 {
     nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
     if (obs) {
         obs->NotifyObservers(nullptr, "cycle-collector-forget-skippable", nullptr);
@@ -1470,17 +1470,17 @@ XPCJSRuntime::SizeOfIncludingThis(Malloc
 {
     size_t n = 0;
     n += mallocSizeOf(this);
     n += mWrappedJSMap->SizeOfIncludingThis(mallocSizeOf);
     n += mIID2NativeInterfaceMap->SizeOfIncludingThis(mallocSizeOf);
     n += mClassInfo2NativeSetMap->ShallowSizeOfIncludingThis(mallocSizeOf);
     n += mNativeSetMap->SizeOfIncludingThis(mallocSizeOf);
 
-    n += CycleCollectedJSRuntime::SizeOfExcludingThis(mallocSizeOf);
+    n += CycleCollectedJSContext::SizeOfExcludingThis(mallocSizeOf);
 
     // There are other XPCJSRuntime members that could be measured; the above
     // ones have been seen by DMD to be worth measuring.  More stuff may be
     // added later.
 
     return n;
 }
 
@@ -1586,20 +1586,20 @@ ReloadPrefsCallback(const char* pref, vo
 }
 
 XPCJSRuntime::~XPCJSRuntime()
 {
     // Elsewhere we abort immediately if XPCJSRuntime initialization fails.
     // Therefore the context must be non-null.
     MOZ_ASSERT(MaybeContext());
 
-    // This destructor runs before ~CycleCollectedJSRuntime, which does the
-    // actual JS_DestroyRuntime() call. But destroying the runtime triggers
-    // one final GC, which can call back into the runtime with various
-    // callback if we aren't careful. Null out the relevant callbacks.
+    // This destructor runs before ~CycleCollectedJSContext, which does the
+    // actual JS_DestroyContext() call. But destroying the context triggers
+    // one final GC, which can call back into the context with various
+    // callbacks if we aren't careful. Null out the relevant callbacks.
     js::SetActivityCallback(Context(), nullptr, nullptr);
     JS_RemoveFinalizeCallback(Context(), FinalizeCallback);
     JS_RemoveWeakPointerZoneGroupCallback(Context(), WeakPointerZoneGroupCallback);
     JS_RemoveWeakPointerCompartmentCallback(Context(), WeakPointerCompartmentCallback);
 
     // Clear any pending exception.  It might be an XPCWrappedJS, and if we try
     // to destroy it later we will crash.
     SetPendingException(nullptr);
@@ -3366,17 +3366,17 @@ GetWindowsStackSize()
     // the guard page and large PGO stack frames.
     return stackSize - 10 * sizeof(uintptr_t) * 1024;
 }
 #endif
 
 nsresult
 XPCJSRuntime::Initialize()
 {
-    nsresult rv = CycleCollectedJSRuntime::Initialize(nullptr,
+    nsresult rv = CycleCollectedJSContext::Initialize(nullptr,
                                                       JS::DefaultHeapMaxBytes,
                                                       JS::DefaultNurseryBytes);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     MOZ_ASSERT(Context());
     JSContext* cx = Context();
@@ -3660,31 +3660,31 @@ XPCJSRuntime::BeforeProcessTask(bool aMi
     mSlowScriptSecondHalf = false;
     mSlowScriptActualWait = mozilla::TimeDuration();
     mTimeoutAccumulated = false;
 
     // As we may be entering a nested event loop, we need to
     // cancel any ongoing performance measurement.
     js::ResetPerformanceMonitoring(Get()->Context());
 
-    CycleCollectedJSRuntime::BeforeProcessTask(aMightBlock);
+    CycleCollectedJSContext::BeforeProcessTask(aMightBlock);
 }
 
 void
 XPCJSRuntime::AfterProcessTask(uint32_t aNewRecursionDepth)
 {
     // Now that we're back to the event loop, reset the slow script checkpoint.
     mSlowScriptCheckpoint = mozilla::TimeStamp();
     mSlowScriptSecondHalf = false;
 
     // Call cycle collector occasionally.
     MOZ_ASSERT(NS_IsMainThread());
     nsJSContext::MaybePokeCC();
 
-    CycleCollectedJSRuntime::AfterProcessTask(aNewRecursionDepth);
+    CycleCollectedJSContext::AfterProcessTask(aNewRecursionDepth);
 
     // Now that we are certain that the event is complete,
     // we can flush any ongoing performance measurement.
     js::FlushPerformanceMonitoring(Get()->Context());
 }
 
 /***************************************************************************/
 
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -288,17 +288,17 @@ xpc::ErrorReport::LogToConsoleWithStack(
 /* static */
 void
 xpc::ErrorReport::ErrorReportToMessageString(JSErrorReport* aReport,
                                              nsAString& aString)
 {
     aString.Truncate();
     const char16_t* m = aReport->ucmessage;
     if (m) {
-        JSFlatString* name = js::GetErrorTypeName(CycleCollectedJSRuntime::Get()->Context(), aReport->exnType);
+        JSFlatString* name = js::GetErrorTypeName(CycleCollectedJSContext::Get()->Context(), aReport->exnType);
         if (name) {
             AssignJSFlatString(aString, name);
             aString.AppendLiteral(": ");
         }
         aString.Append(m);
     }
 }
 
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -74,17 +74,17 @@
 #ifndef xpcprivate_h___
 #define xpcprivate_h___
 
 #include "mozilla/Alignment.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/Attributes.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/GuardObjects.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/UniquePtr.h"
 
 #include "mozilla/dom/ScriptSettings.h"
@@ -404,17 +404,17 @@ public:
         }
 #endif
     }
 
 private:
     mozilla::Maybe<StringType> mStrings[2];
 };
 
-class XPCJSRuntime final : public mozilla::CycleCollectedJSRuntime
+class XPCJSRuntime final : public mozilla::CycleCollectedJSContext
 {
 public:
     static XPCJSRuntime* newXPCJSRuntime();
     static XPCJSRuntime* Get() { return nsXPConnect::XPConnect()->GetRuntime(); }
 
     void RemoveWrappedJS(nsXPCWrappedJS* wrapper);
     void AssertInvalidWrappedJSNotInTable(nsXPCWrappedJS* wrapper) const;
 
--- a/layout/style/FontFace.cpp
+++ b/layout/style/FontFace.cpp
@@ -6,17 +6,17 @@
 #include "mozilla/dom/FontFace.h"
 
 #include <algorithm>
 #include "mozilla/dom/FontFaceBinding.h"
 #include "mozilla/dom/FontFaceSet.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/TypedArray.h"
 #include "mozilla/dom/UnionTypes.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "nsCSSParser.h"
 #include "nsCSSRules.h"
 #include "nsIDocument.h"
 #include "nsStyleUtil.h"
 
 namespace mozilla {
 namespace dom {
 
rename from xpcom/base/CycleCollectedJSRuntime.cpp
rename to xpcom/base/CycleCollectedJSContext.cpp
--- a/xpcom/base/CycleCollectedJSRuntime.cpp
+++ b/xpcom/base/CycleCollectedJSContext.cpp
@@ -49,17 +49,17 @@
 // will already be marked by the JS GC and will thus be colored black
 // themselves. Any C++ objects they hold will have a missing (untraversed)
 // edge from the JS object to the C++ object and so it will be marked black
 // too. This decreases the number of objects that the cycle collector has to
 // deal with.
 // To improve debugging, if WantAllTraces() is true all JS objects are
 // traversed.
 
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include <algorithm>
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/AutoRestore.h"
 #include "mozilla/Move.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Sprintf.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/TimelineConsumers.h"
@@ -101,27 +101,27 @@ struct DeferredFinalizeFunctionHolder
 {
   DeferredFinalizeFunction run;
   void* data;
 };
 
 class IncrementalFinalizeRunnable : public Runnable
 {
   typedef AutoTArray<DeferredFinalizeFunctionHolder, 16> DeferredFinalizeArray;
-  typedef CycleCollectedJSRuntime::DeferredFinalizerTable DeferredFinalizerTable;
+  typedef CycleCollectedJSContext::DeferredFinalizerTable DeferredFinalizerTable;
 
-  CycleCollectedJSRuntime* mRuntime;
+  CycleCollectedJSContext* mContext;
   DeferredFinalizeArray mDeferredFinalizeFunctions;
   uint32_t mFinalizeFunctionToRun;
   bool mReleasing;
 
   static const PRTime SliceMillis = 5; /* ms */
 
 public:
-  IncrementalFinalizeRunnable(CycleCollectedJSRuntime* aRt,
+  IncrementalFinalizeRunnable(CycleCollectedJSContext* aCx,
                               DeferredFinalizerTable& aFinalizerTable);
   virtual ~IncrementalFinalizeRunnable();
 
   void ReleaseNow(bool aLimited);
 
   NS_DECL_NSIRUNNABLE
 };
 
@@ -292,34 +292,34 @@ CheckParticipatesInCycleCollection(JS::G
     *cycleCollectionEnabled = true;
   }
 }
 
 NS_IMETHODIMP
 JSGCThingParticipant::Traverse(void* aPtr,
                                nsCycleCollectionTraversalCallback& aCb)
 {
-  auto runtime = reinterpret_cast<CycleCollectedJSRuntime*>(
-    reinterpret_cast<char*>(this) - offsetof(CycleCollectedJSRuntime,
+  auto runtime = reinterpret_cast<CycleCollectedJSContext*>(
+    reinterpret_cast<char*>(this) - offsetof(CycleCollectedJSContext,
                                              mGCThingCycleCollectorGlobal));
 
   JS::GCCellPtr cellPtr(aPtr, JS::GCThingTraceKind(aPtr));
-  runtime->TraverseGCThing(CycleCollectedJSRuntime::TRAVERSE_FULL, cellPtr, aCb);
+  runtime->TraverseGCThing(CycleCollectedJSContext::TRAVERSE_FULL, cellPtr, aCb);
   return NS_OK;
 }
 
 // NB: This is only used to initialize the participant in
-// CycleCollectedJSRuntime. It should never be used directly.
+// CycleCollectedJSContext. It should never be used directly.
 static JSGCThingParticipant sGCThingCycleCollectorGlobal;
 
 NS_IMETHODIMP
 JSZoneParticipant::Traverse(void* aPtr, nsCycleCollectionTraversalCallback& aCb)
 {
-  auto runtime = reinterpret_cast<CycleCollectedJSRuntime*>(
-    reinterpret_cast<char*>(this) - offsetof(CycleCollectedJSRuntime,
+  auto runtime = reinterpret_cast<CycleCollectedJSContext*>(
+    reinterpret_cast<char*>(this) - offsetof(CycleCollectedJSContext,
                                              mJSZoneCycleCollectorGlobal));
 
   MOZ_ASSERT(!aCb.WantAllTraces());
   JS::Zone* zone = static_cast<JS::Zone*>(aPtr);
 
   runtime->TraverseZone(zone, aCb);
   return NS_OK;
 }
@@ -398,23 +398,23 @@ NoteJSChildGrayWrapperShim(void* aData, 
  * cycle incorrectly identified as live must contain at least one C++ to JS edge, and
  * XPConnect will always add the C++ object to the CC graph. (This is in contrast to pure
  * C++ garbage cycles, which must always be properly identified, because we clear the
  * purple buffer during every CC, which may contain the last reference to a garbage
  * cycle.)
  */
 
 // NB: This is only used to initialize the participant in
-// CycleCollectedJSRuntime. It should never be used directly.
+// CycleCollectedJSContext. It should never be used directly.
 static const JSZoneParticipant sJSZoneCycleCollectorGlobal;
 
 static
 void JSObjectsTenuredCb(JSContext* aContext, void* aData)
 {
-  static_cast<CycleCollectedJSRuntime*>(aData)->JSObjectsTenured();
+  static_cast<CycleCollectedJSContext*>(aData)->JSObjectsTenured();
 }
 
 bool
 mozilla::GetBuildId(JS::BuildIdCharVector* aBuildID)
 {
   nsCOMPtr<nsIPlatformInfo> info = do_GetService("@mozilla.org/xre/app-info;1");
   if (!info) {
     return false;
@@ -430,34 +430,34 @@ mozilla::GetBuildId(JS::BuildIdCharVecto
 
   for (size_t i = 0; i < buildID.Length(); i++) {
     (*aBuildID)[i] = buildID[i];
   }
 
   return true;
 }
 
-CycleCollectedJSRuntime::CycleCollectedJSRuntime()
+CycleCollectedJSContext::CycleCollectedJSContext()
   : mGCThingCycleCollectorGlobal(sGCThingCycleCollectorGlobal)
   , mJSZoneCycleCollectorGlobal(sJSZoneCycleCollectorGlobal)
   , mJSContext(nullptr)
   , mPrevGCSliceCallback(nullptr)
   , mPrevGCNurseryCollectionCallback(nullptr)
   , mJSHolders(256)
   , mDoingStableStates(false)
   , mDisableMicroTaskCheckpoint(false)
   , mOutOfMemoryState(OOMState::OK)
   , mLargeAllocationFailureState(OOMState::OK)
 {
   nsCOMPtr<nsIThread> thread = do_GetCurrentThread();
   mOwningThread = thread.forget().downcast<nsThread>().take();
   MOZ_RELEASE_ASSERT(mOwningThread);
 }
 
-CycleCollectedJSRuntime::~CycleCollectedJSRuntime()
+CycleCollectedJSContext::~CycleCollectedJSContext()
 {
   // If the allocation failed, here we are.
   if (!mJSContext) {
     return;
   }
 
   MOZ_ASSERT(!mDeferredFinalizerTable.Count());
 
@@ -476,32 +476,32 @@ CycleCollectedJSRuntime::~CycleCollected
 
 #ifdef SPIDERMONKEY_PROMISE
   mUncaughtRejections.reset();
   mConsumedRejections.reset();
 #endif // SPIDERMONKEY_PROMISE
 
   JS_DestroyContext(mJSContext);
   mJSContext = nullptr;
-  nsCycleCollector_forgetJSRuntime();
+  nsCycleCollector_forgetJSContext();
 
   mozilla::dom::DestroyScriptSettings();
 
   mOwningThread->SetScriptObserver(nullptr);
   NS_RELEASE(mOwningThread);
 }
 
 static void
 MozCrashWarningReporter(JSContext*, const char*, JSErrorReport*)
 {
   MOZ_CRASH("Why is someone touching JSAPI without an AutoJSAPI?");
 }
 
 nsresult
-CycleCollectedJSRuntime::Initialize(JSContext* aParentContext,
+CycleCollectedJSContext::Initialize(JSContext* aParentContext,
                                     uint32_t aMaxBytes,
                                     uint32_t aMaxNurseryBytes)
 {
   MOZ_ASSERT(!mJSContext);
 
   mOwningThread->SetScriptObserver(this);
   // The main thread has a base recursion depth of 0, workers of 1.
   mBaseRecursionDepth = RecursionDepth();
@@ -556,45 +556,45 @@ CycleCollectedJSRuntime::Initialize(JSCo
   JS::SetEnqueuePromiseJobCallback(mJSContext, EnqueuePromiseJobCallback, this);
   JS::SetPromiseRejectionTrackerCallback(mJSContext, PromiseRejectionTrackerCallback, this);
   mUncaughtRejections.init(mJSContext, JS::GCVector<JSObject*, 0, js::SystemAllocPolicy>(js::SystemAllocPolicy()));
   mConsumedRejections.init(mJSContext, JS::GCVector<JSObject*, 0, js::SystemAllocPolicy>(js::SystemAllocPolicy()));
 #endif // SPIDERMONKEY_PROMISE
 
   JS::dbg::SetDebuggerMallocSizeOf(mJSContext, moz_malloc_size_of);
 
-  nsCycleCollector_registerJSRuntime(this);
+  nsCycleCollector_registerJSContext(this);
 
   return NS_OK;
 }
 
 size_t
-CycleCollectedJSRuntime::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
+CycleCollectedJSContext::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
 {
   size_t n = 0;
 
   // We're deliberately not measuring anything hanging off the entries in
   // mJSHolders.
   n += mJSHolders.ShallowSizeOfExcludingThis(aMallocSizeOf);
 
   return n;
 }
 
 void
-CycleCollectedJSRuntime::UnmarkSkippableJSHolders()
+CycleCollectedJSContext::UnmarkSkippableJSHolders()
 {
   for (auto iter = mJSHolders.Iter(); !iter.Done(); iter.Next()) {
     void* holder = iter.Key();
     nsScriptObjectTracer*& tracer = iter.Data();
     tracer->CanSkip(holder, true);
   }
 }
 
 void
-CycleCollectedJSRuntime::DescribeGCThing(bool aIsMarked, JS::GCCellPtr aThing,
+CycleCollectedJSContext::DescribeGCThing(bool aIsMarked, JS::GCCellPtr aThing,
                                          nsCycleCollectionTraversalCallback& aCb) const
 {
   if (!aCb.WantDebugInfo()) {
     aCb.DescribeGCedNode(aIsMarked, "JS Object");
     return;
   }
 
   char name[72];
@@ -626,26 +626,26 @@ CycleCollectedJSRuntime::DescribeGCThing
     SprintfLiteral(name, "JS %s", JS::GCTraceKindToAscii(aThing.kind()));
   }
 
   // Disable printing global for objects while we figure out ObjShrink fallout.
   aCb.DescribeGCedNode(aIsMarked, name, compartmentAddress);
 }
 
 void
-CycleCollectedJSRuntime::NoteGCThingJSChildren(JS::GCCellPtr aThing,
+CycleCollectedJSContext::NoteGCThingJSChildren(JS::GCCellPtr aThing,
                                                nsCycleCollectionTraversalCallback& aCb) const
 {
   MOZ_ASSERT(mJSContext);
   TraversalTracer trc(mJSContext, aCb);
   JS::TraceChildren(&trc, aThing);
 }
 
 void
-CycleCollectedJSRuntime::NoteGCThingXPCOMChildren(const js::Class* aClasp,
+CycleCollectedJSContext::NoteGCThingXPCOMChildren(const js::Class* aClasp,
                                                   JSObject* aObj,
                                                   nsCycleCollectionTraversalCallback& aCb) const
 {
   MOZ_ASSERT(aClasp);
   MOZ_ASSERT(aClasp == js::GetObjectClass(aObj));
 
   if (NoteCustomGCThingXPCOMChildren(aClasp, aObj, aCb)) {
     // Nothing else to do!
@@ -671,17 +671,17 @@ CycleCollectedJSRuntime::NoteGCThingXPCO
         aCb.NoteNativeChild(UnwrapPossiblyNotInitializedDOMObject<void>(aObj),
                             domClass->mParticipant);
       }
     }
   }
 }
 
 void
-CycleCollectedJSRuntime::TraverseGCThing(TraverseSelect aTs, JS::GCCellPtr aThing,
+CycleCollectedJSContext::TraverseGCThing(TraverseSelect aTs, JS::GCCellPtr aThing,
                                          nsCycleCollectionTraversalCallback& aCb)
 {
   bool isMarkedGray = JS::GCThingIsMarkedGray(aThing);
 
   if (aTs == TRAVERSE_FULL) {
     DescribeGCThing(!isMarkedGray, aThing, aCb);
   }
 
@@ -701,21 +701,21 @@ CycleCollectedJSRuntime::TraverseGCThing
     JSObject* obj = &aThing.as<JSObject>();
     NoteGCThingXPCOMChildren(js::GetObjectClass(obj), obj, aCb);
   }
 }
 
 struct TraverseObjectShimClosure
 {
   nsCycleCollectionTraversalCallback& cb;
-  CycleCollectedJSRuntime* self;
+  CycleCollectedJSContext* self;
 };
 
 void
-CycleCollectedJSRuntime::TraverseZone(JS::Zone* aZone,
+CycleCollectedJSContext::TraverseZone(JS::Zone* aZone,
                                       nsCycleCollectionTraversalCallback& aCb)
 {
   MOZ_ASSERT(mJSContext);
 
   /*
    * We treat the zone as being gray. We handle non-gray GCthings in the
    * zone by not reporting their children to the CC. The black-gray invariant
    * ensures that any JS children will also be non-gray, and thus don't need to be
@@ -742,28 +742,28 @@ CycleCollectedJSRuntime::TraverseZone(JS
    * To find C++ children of things in the zone, we scan every JS Object in
    * the zone. Only JS Objects can have C++ children.
    */
   TraverseObjectShimClosure closure = { aCb, this };
   js::IterateGrayObjects(aZone, TraverseObjectShim, &closure);
 }
 
 /* static */ void
-CycleCollectedJSRuntime::TraverseObjectShim(void* aData, JS::GCCellPtr aThing)
+CycleCollectedJSContext::TraverseObjectShim(void* aData, JS::GCCellPtr aThing)
 {
   TraverseObjectShimClosure* closure =
     static_cast<TraverseObjectShimClosure*>(aData);
 
   MOZ_ASSERT(aThing.is<JSObject>());
-  closure->self->TraverseGCThing(CycleCollectedJSRuntime::TRAVERSE_CPP,
+  closure->self->TraverseGCThing(CycleCollectedJSContext::TRAVERSE_CPP,
                                  aThing, closure->cb);
 }
 
 void
-CycleCollectedJSRuntime::TraverseNativeRoots(nsCycleCollectionNoteRootCallback& aCb)
+CycleCollectedJSContext::TraverseNativeRoots(nsCycleCollectionNoteRootCallback& aCb)
 {
   // NB: This is here just to preserve the existing XPConnect order. I doubt it
   // would hurt to do this after the JS holders.
   TraverseAdditionalNativeRoots(aCb);
 
   for (auto iter = mJSHolders.Iter(); !iter.Done(); iter.Next()) {
     void* holder = iter.Key();
     nsScriptObjectTracer*& tracer = iter.Data();
@@ -779,50 +779,50 @@ CycleCollectedJSRuntime::TraverseNativeR
 
     if (noteRoot) {
       aCb.NoteNativeRoot(holder, tracer);
     }
   }
 }
 
 /* static */ void
-CycleCollectedJSRuntime::TraceBlackJS(JSTracer* aTracer, void* aData)
+CycleCollectedJSContext::TraceBlackJS(JSTracer* aTracer, void* aData)
 {
-  CycleCollectedJSRuntime* self = static_cast<CycleCollectedJSRuntime*>(aData);
+  CycleCollectedJSContext* self = static_cast<CycleCollectedJSContext*>(aData);
 
   self->TraceNativeBlackRoots(aTracer);
 }
 
 /* static */ void
-CycleCollectedJSRuntime::TraceGrayJS(JSTracer* aTracer, void* aData)
+CycleCollectedJSContext::TraceGrayJS(JSTracer* aTracer, void* aData)
 {
-  CycleCollectedJSRuntime* self = static_cast<CycleCollectedJSRuntime*>(aData);
+  CycleCollectedJSContext* self = static_cast<CycleCollectedJSContext*>(aData);
 
   // Mark these roots as gray so the CC can walk them later.
   self->TraceNativeGrayRoots(aTracer);
 }
 
 /* static */ void
-CycleCollectedJSRuntime::GCCallback(JSContext* aContext,
+CycleCollectedJSContext::GCCallback(JSContext* aContext,
                                     JSGCStatus aStatus,
                                     void* aData)
 {
-  CycleCollectedJSRuntime* self = static_cast<CycleCollectedJSRuntime*>(aData);
+  CycleCollectedJSContext* self = static_cast<CycleCollectedJSContext*>(aData);
 
   MOZ_ASSERT(aContext == self->Context());
 
   self->OnGC(aStatus);
 }
 
 /* static */ void
-CycleCollectedJSRuntime::GCSliceCallback(JSContext* aContext,
+CycleCollectedJSContext::GCSliceCallback(JSContext* aContext,
                                          JS::GCProgress aProgress,
                                          const JS::GCDescription& aDesc)
 {
-  CycleCollectedJSRuntime* self = CycleCollectedJSRuntime::Get();
+  CycleCollectedJSContext* self = CycleCollectedJSContext::Get();
   MOZ_ASSERT(self->Context() == aContext);
 
   if (aProgress == JS::GC_CYCLE_END) {
     JS::gcreason::Reason reason = aDesc.reason_;
     Unused <<
       NS_WARN_IF(NS_FAILED(DebuggerOnGCRunnable::Enqueue(aContext, aDesc)) &&
                  reason != JS::gcreason::SHUTDOWN_CC &&
                  reason != JS::gcreason::DESTROY_RUNTIME &&
@@ -878,21 +878,21 @@ public:
   {
     auto clone = MakeUnique<MinorGCMarker>(GetTracingType(), mReason);
     clone->SetCustomTime(GetTime());
     return UniquePtr<AbstractTimelineMarker>(Move(clone));
   }
 };
 
 /* static */ void
-CycleCollectedJSRuntime::GCNurseryCollectionCallback(JSContext* aContext,
+CycleCollectedJSContext::GCNurseryCollectionCallback(JSContext* aContext,
                                                      JS::GCNurseryProgress aProgress,
                                                      JS::gcreason::Reason aReason)
 {
-  CycleCollectedJSRuntime* self = CycleCollectedJSRuntime::Get();
+  CycleCollectedJSContext* self = CycleCollectedJSContext::Get();
   MOZ_ASSERT(self->Context() == aContext);
   MOZ_ASSERT(NS_IsMainThread());
 
   RefPtr<TimelineConsumers> timelines = TimelineConsumers::Get();
   if (timelines && !timelines->IsEmpty()) {
     UniquePtr<AbstractTimelineMarker> abstractMarker(
       MakeUnique<MinorGCMarker>(aProgress, aReason));
     timelines->AddMarkerForAllObservedDocShells(abstractMarker);
@@ -900,30 +900,30 @@ CycleCollectedJSRuntime::GCNurseryCollec
 
   if (self->mPrevGCNurseryCollectionCallback) {
     self->mPrevGCNurseryCollectionCallback(aContext, aProgress, aReason);
   }
 }
 
 
 /* static */ void
-CycleCollectedJSRuntime::OutOfMemoryCallback(JSContext* aContext,
+CycleCollectedJSContext::OutOfMemoryCallback(JSContext* aContext,
                                              void* aData)
 {
-  CycleCollectedJSRuntime* self = static_cast<CycleCollectedJSRuntime*>(aData);
+  CycleCollectedJSContext* self = static_cast<CycleCollectedJSContext*>(aData);
 
   MOZ_ASSERT(aContext == self->Context());
 
   self->OnOutOfMemory();
 }
 
 /* static */ void
-CycleCollectedJSRuntime::LargeAllocationFailureCallback(void* aData)
+CycleCollectedJSContext::LargeAllocationFailureCallback(void* aData)
 {
-  CycleCollectedJSRuntime* self = static_cast<CycleCollectedJSRuntime*>(aData);
+  CycleCollectedJSContext* self = static_cast<CycleCollectedJSContext*>(aData);
 
   self->OnLargeAllocationFailure();
 }
 
 class PromiseJobRunnable final : public Runnable
 {
 public:
   PromiseJobRunnable(JS::HandleObject aCallback, JS::HandleObject aAllocationSite,
@@ -948,56 +948,56 @@ protected:
   }
 
 private:
   RefPtr<PromiseJobCallback> mCallback;
 };
 
 /* static */
 JSObject*
-CycleCollectedJSRuntime::GetIncumbentGlobalCallback(JSContext* aCx)
+CycleCollectedJSContext::GetIncumbentGlobalCallback(JSContext* aCx)
 {
   nsIGlobalObject* global = mozilla::dom::GetIncumbentGlobal();
   if (global) {
     return global->GetGlobalJSObject();
   }
   return nullptr;
 }
 
 /* static */
 bool
-CycleCollectedJSRuntime::EnqueuePromiseJobCallback(JSContext* aCx,
+CycleCollectedJSContext::EnqueuePromiseJobCallback(JSContext* aCx,
                                                    JS::HandleObject aJob,
                                                    JS::HandleObject aAllocationSite,
                                                    JS::HandleObject aIncumbentGlobal,
                                                    void* aData)
 {
-  CycleCollectedJSRuntime* self = static_cast<CycleCollectedJSRuntime*>(aData);
+  CycleCollectedJSContext* self = static_cast<CycleCollectedJSContext*>(aData);
   MOZ_ASSERT(aCx == self->Context());
   MOZ_ASSERT(Get() == self);
 
   nsIGlobalObject* global = nullptr;
   if (aIncumbentGlobal) {
     global = xpc::NativeGlobal(aIncumbentGlobal);
   }
   nsCOMPtr<nsIRunnable> runnable = new PromiseJobRunnable(aJob, aAllocationSite, global);
   self->DispatchToMicroTask(runnable.forget());
   return true;
 }
 
 #ifdef SPIDERMONKEY_PROMISE
 /* static */
 void
-CycleCollectedJSRuntime::PromiseRejectionTrackerCallback(JSContext* aCx,
+CycleCollectedJSContext::PromiseRejectionTrackerCallback(JSContext* aCx,
                                                          JS::HandleObject aPromise,
                                                          PromiseRejectionHandlingState state,
                                                          void* aData)
 {
 #ifdef DEBUG
-  CycleCollectedJSRuntime* self = static_cast<CycleCollectedJSRuntime*>(aData);
+  CycleCollectedJSContext* self = static_cast<CycleCollectedJSContext*>(aData);
 #endif // DEBUG
   MOZ_ASSERT(aCx == self->Context());
   MOZ_ASSERT(Get() == self);
 
   if (state == PromiseRejectionHandlingState::Unhandled) {
     PromiseDebugging::AddUncaughtRejection(aPromise);
   } else {
     PromiseDebugging::AddConsumedRejection(aPromise);
@@ -1053,33 +1053,33 @@ void
 mozilla::TraceScriptHolder(nsISupports* aHolder, JSTracer* aTracer)
 {
   nsXPCOMCycleCollectionParticipant* participant = nullptr;
   CallQueryInterface(aHolder, &participant);
   participant->Trace(aHolder, JsGcTracer(), aTracer);
 }
 
 void
-CycleCollectedJSRuntime::TraceNativeGrayRoots(JSTracer* aTracer)
+CycleCollectedJSContext::TraceNativeGrayRoots(JSTracer* aTracer)
 {
   MOZ_ASSERT(mJSContext);
 
   // NB: This is here just to preserve the existing XPConnect order. I doubt it
   // would hurt to do this after the JS holders.
   TraceAdditionalNativeGrayRoots(aTracer);
 
   for (auto iter = mJSHolders.Iter(); !iter.Done(); iter.Next()) {
     void* holder = iter.Key();
     nsScriptObjectTracer*& tracer = iter.Data();
     tracer->Trace(holder, JsGcTracer(), aTracer);
   }
 }
 
 void
-CycleCollectedJSRuntime::AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer)
+CycleCollectedJSContext::AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer)
 {
   MOZ_ASSERT(mJSContext);
   mJSHolders.Put(aHolder, aTracer);
 }
 
 struct ClearJSHolder : public TraceCallbacks
 {
   virtual void Trace(JS::Heap<JS::Value>* aPtr, const char*, void*) const override
@@ -1120,148 +1120,148 @@ struct ClearJSHolder : public TraceCallb
 
   virtual void Trace(JS::Heap<JSFunction*>* aPtr, const char*, void*) const override
   {
     *aPtr = nullptr;
   }
 };
 
 void
-CycleCollectedJSRuntime::RemoveJSHolder(void* aHolder)
+CycleCollectedJSContext::RemoveJSHolder(void* aHolder)
 {
   MOZ_ASSERT(mJSContext);
 
   nsScriptObjectTracer* tracer = mJSHolders.Get(aHolder);
   if (!tracer) {
     return;
   }
   tracer->Trace(aHolder, ClearJSHolder(), nullptr);
   mJSHolders.Remove(aHolder);
 }
 
 #ifdef DEBUG
 bool
-CycleCollectedJSRuntime::IsJSHolder(void* aHolder)
+CycleCollectedJSContext::IsJSHolder(void* aHolder)
 {
   MOZ_ASSERT(mJSContext);
   return mJSHolders.Get(aHolder, nullptr);
 }
 
 static void
 AssertNoGcThing(JS::GCCellPtr aGCThing, const char* aName, void* aClosure)
 {
   MOZ_ASSERT(!aGCThing);
 }
 
 void
-CycleCollectedJSRuntime::AssertNoObjectsToTrace(void* aPossibleJSHolder)
+CycleCollectedJSContext::AssertNoObjectsToTrace(void* aPossibleJSHolder)
 {
   MOZ_ASSERT(mJSContext);
 
   nsScriptObjectTracer* tracer = mJSHolders.Get(aPossibleJSHolder);
   if (tracer) {
     tracer->Trace(aPossibleJSHolder, TraceCallbackFunc(AssertNoGcThing), nullptr);
   }
 }
 #endif
 
 already_AddRefed<nsIException>
-CycleCollectedJSRuntime::GetPendingException() const
+CycleCollectedJSContext::GetPendingException() const
 {
   MOZ_ASSERT(mJSContext);
 
   nsCOMPtr<nsIException> out = mPendingException;
   return out.forget();
 }
 
 void
-CycleCollectedJSRuntime::SetPendingException(nsIException* aException)
+CycleCollectedJSContext::SetPendingException(nsIException* aException)
 {
   MOZ_ASSERT(mJSContext);
   mPendingException = aException;
 }
 
 std::queue<nsCOMPtr<nsIRunnable>>&
-CycleCollectedJSRuntime::GetPromiseMicroTaskQueue()
+CycleCollectedJSContext::GetPromiseMicroTaskQueue()
 {
   MOZ_ASSERT(mJSContext);
   return mPromiseMicroTaskQueue;
 }
 
 std::queue<nsCOMPtr<nsIRunnable>>&
-CycleCollectedJSRuntime::GetDebuggerPromiseMicroTaskQueue()
+CycleCollectedJSContext::GetDebuggerPromiseMicroTaskQueue()
 {
   MOZ_ASSERT(mJSContext);
   return mDebuggerPromiseMicroTaskQueue;
 }
 
 nsCycleCollectionParticipant*
-CycleCollectedJSRuntime::GCThingParticipant()
+CycleCollectedJSContext::GCThingParticipant()
 {
   MOZ_ASSERT(mJSContext);
   return &mGCThingCycleCollectorGlobal;
 }
 
 nsCycleCollectionParticipant*
-CycleCollectedJSRuntime::ZoneParticipant()
+CycleCollectedJSContext::ZoneParticipant()
 {
   MOZ_ASSERT(mJSContext);
   return &mJSZoneCycleCollectorGlobal;
 }
 
 nsresult
-CycleCollectedJSRuntime::TraverseRoots(nsCycleCollectionNoteRootCallback& aCb)
+CycleCollectedJSContext::TraverseRoots(nsCycleCollectionNoteRootCallback& aCb)
 {
   MOZ_ASSERT(mJSContext);
 
   TraverseNativeRoots(aCb);
 
   NoteWeakMapsTracer trc(mJSContext, aCb);
   js::TraceWeakMaps(&trc);
 
   return NS_OK;
 }
 
 bool
-CycleCollectedJSRuntime::UsefulToMergeZones() const
+CycleCollectedJSContext::UsefulToMergeZones() const
 {
   return false;
 }
 
 void
-CycleCollectedJSRuntime::FixWeakMappingGrayBits() const
+CycleCollectedJSContext::FixWeakMappingGrayBits() const
 {
   MOZ_ASSERT(mJSContext);
   MOZ_ASSERT(!JS::IsIncrementalGCInProgress(mJSContext),
              "Don't call FixWeakMappingGrayBits during a GC.");
   FixWeakMappingGrayBitsTracer fixer(mJSContext);
   fixer.FixAll();
 }
 
 bool
-CycleCollectedJSRuntime::AreGCGrayBitsValid() const
+CycleCollectedJSContext::AreGCGrayBitsValid() const
 {
   MOZ_ASSERT(mJSContext);
   return js::AreGCGrayBitsValid(mJSContext);
 }
 
 void
-CycleCollectedJSRuntime::GarbageCollect(uint32_t aReason) const
+CycleCollectedJSContext::GarbageCollect(uint32_t aReason) const
 {
   MOZ_ASSERT(mJSContext);
 
   MOZ_ASSERT(aReason < JS::gcreason::NUM_REASONS);
   JS::gcreason::Reason gcreason = static_cast<JS::gcreason::Reason>(aReason);
 
   JS::PrepareForFullGC(mJSContext);
   JS::GCForReason(mJSContext, GC_NORMAL, gcreason);
 }
 
 void
-CycleCollectedJSRuntime::JSObjectsTenured()
+CycleCollectedJSContext::JSObjectsTenured()
 {
   MOZ_ASSERT(mJSContext);
 
   for (auto iter = mNurseryObjects.Iter(); !iter.Done(); iter.Next()) {
     nsWrapperCache* cache = iter.Get();
     JSObject* wrapper = cache->GetWrapperPreserveColor();
     MOZ_ASSERT(wrapper);
     if (!JS::ObjectIsTenured(wrapper)) {
@@ -1277,84 +1277,84 @@ for (auto iter = mPreservedNurseryObject
 }
 #endif
 
   mNurseryObjects.Clear();
   mPreservedNurseryObjects.Clear();
 }
 
 void
-CycleCollectedJSRuntime::NurseryWrapperAdded(nsWrapperCache* aCache)
+CycleCollectedJSContext::NurseryWrapperAdded(nsWrapperCache* aCache)
 {
   MOZ_ASSERT(mJSContext);
   MOZ_ASSERT(aCache);
   MOZ_ASSERT(aCache->GetWrapperPreserveColor());
   MOZ_ASSERT(!JS::ObjectIsTenured(aCache->GetWrapperPreserveColor()));
   mNurseryObjects.InfallibleAppend(aCache);
 }
 
 void
-CycleCollectedJSRuntime::NurseryWrapperPreserved(JSObject* aWrapper)
+CycleCollectedJSContext::NurseryWrapperPreserved(JSObject* aWrapper)
 {
   MOZ_ASSERT(mJSContext);
 
   mPreservedNurseryObjects.InfallibleAppend(
     JS::PersistentRooted<JSObject*>(mJSContext, aWrapper));
 }
 
 void
-CycleCollectedJSRuntime::DeferredFinalize(DeferredFinalizeAppendFunction aAppendFunc,
+CycleCollectedJSContext::DeferredFinalize(DeferredFinalizeAppendFunction aAppendFunc,
                                           DeferredFinalizeFunction aFunc,
                                           void* aThing)
 {
   MOZ_ASSERT(mJSContext);
 
   void* thingArray = nullptr;
   bool hadThingArray = mDeferredFinalizerTable.Get(aFunc, &thingArray);
 
   thingArray = aAppendFunc(thingArray, aThing);
   if (!hadThingArray) {
     mDeferredFinalizerTable.Put(aFunc, thingArray);
   }
 }
 
 void
-CycleCollectedJSRuntime::DeferredFinalize(nsISupports* aSupports)
+CycleCollectedJSContext::DeferredFinalize(nsISupports* aSupports)
 {
   MOZ_ASSERT(mJSContext);
 
   typedef DeferredFinalizerImpl<nsISupports> Impl;
   DeferredFinalize(Impl::AppendDeferredFinalizePointer, Impl::DeferredFinalize,
                    aSupports);
 }
 
 void
-CycleCollectedJSRuntime::DumpJSHeap(FILE* aFile)
+CycleCollectedJSContext::DumpJSHeap(FILE* aFile)
 {
   js::DumpHeap(Context(), aFile, js::CollectNurseryBeforeDump);
 }
 
 void
-CycleCollectedJSRuntime::ProcessStableStateQueue()
+CycleCollectedJSContext::ProcessStableStateQueue()
 {
   MOZ_ASSERT(mJSContext);
   MOZ_RELEASE_ASSERT(!mDoingStableStates);
   mDoingStableStates = true;
 
   for (uint32_t i = 0; i < mStableStateEvents.Length(); ++i) {
     nsCOMPtr<nsIRunnable> event = mStableStateEvents[i].forget();
     event->Run();
   }
 
   mStableStateEvents.Clear();
   mDoingStableStates = false;
 }
 
 void
-CycleCollectedJSRuntime::ProcessMetastableStateQueue(uint32_t aRecursionDepth)
+CycleCollectedJSContext::ProcessMetastableStateQueue(uint32_t aRecursionDepth)
 {
   MOZ_ASSERT(mJSContext);
   MOZ_RELEASE_ASSERT(!mDoingStableStates);
   mDoingStableStates = true;
 
   nsTArray<RunInMetastableStateData> localQueue = Move(mMetastableStateEvents);
 
   for (uint32_t i = 0; i < localQueue.Length(); ++i)
@@ -1375,17 +1375,17 @@ CycleCollectedJSRuntime::ProcessMetastab
   // If the queue has events in it now, they were added from something we called,
   // so they belong at the end of the queue.
   localQueue.AppendElements(mMetastableStateEvents);
   localQueue.SwapElements(mMetastableStateEvents);
   mDoingStableStates = false;
 }
 
 void
-CycleCollectedJSRuntime::AfterProcessTask(uint32_t aRecursionDepth)
+CycleCollectedJSContext::AfterProcessTask(uint32_t aRecursionDepth)
 {
   MOZ_ASSERT(mJSContext);
 
   // See HTML 6.1.4.2 Processing model
 
   // Execute any events that were waiting for a microtask to complete.
   // This is not (yet) in the spec.
   ProcessMetastableStateQueue(aRecursionDepth);
@@ -1400,47 +1400,47 @@ CycleCollectedJSRuntime::AfterProcessTas
     }
   }
 
   // Step 4.2 Execute any events that were waiting for a stable state.
   ProcessStableStateQueue();
 }
 
 void
-CycleCollectedJSRuntime::AfterProcessMicrotask()
+CycleCollectedJSContext::AfterProcessMicrotask()
 {
   MOZ_ASSERT(mJSContext);
   AfterProcessMicrotask(RecursionDepth());
 }
 
 void
-CycleCollectedJSRuntime::AfterProcessMicrotask(uint32_t aRecursionDepth)
+CycleCollectedJSContext::AfterProcessMicrotask(uint32_t aRecursionDepth)
 {
   MOZ_ASSERT(mJSContext);
 
   // Between microtasks, execute any events that were waiting for a microtask
   // to complete.
   ProcessMetastableStateQueue(aRecursionDepth);
 }
 
 uint32_t
-CycleCollectedJSRuntime::RecursionDepth()
+CycleCollectedJSContext::RecursionDepth()
 {
   return mOwningThread->RecursionDepth();
 }
 
 void
-CycleCollectedJSRuntime::RunInStableState(already_AddRefed<nsIRunnable>&& aRunnable)
+CycleCollectedJSContext::RunInStableState(already_AddRefed<nsIRunnable>&& aRunnable)
 {
   MOZ_ASSERT(mJSContext);
   mStableStateEvents.AppendElement(Move(aRunnable));
 }
 
 void
-CycleCollectedJSRuntime::RunInMetastableState(already_AddRefed<nsIRunnable>&& aRunnable)
+CycleCollectedJSContext::RunInMetastableState(already_AddRefed<nsIRunnable>&& aRunnable)
 {
   MOZ_ASSERT(mJSContext);
 
   RunInMetastableStateData data;
   data.mRunnable = aRunnable;
 
   MOZ_ASSERT(mOwningThread);
   data.mRecursionDepth = RecursionDepth();
@@ -1455,19 +1455,19 @@ CycleCollectedJSRuntime::RunInMetastable
   if (data.mRecursionDepth <= mBaseRecursionDepth) {
     data.mRecursionDepth = mBaseRecursionDepth + 1;
   }
 #endif
 
   mMetastableStateEvents.AppendElement(Move(data));
 }
 
-IncrementalFinalizeRunnable::IncrementalFinalizeRunnable(CycleCollectedJSRuntime* aRt,
+IncrementalFinalizeRunnable::IncrementalFinalizeRunnable(CycleCollectedJSContext* aCx,
                                                          DeferredFinalizerTable& aFinalizers)
-  : mRuntime(aRt)
+  : mContext(aCx)
   , mFinalizeFunctionToRun(0)
   , mReleasing(false)
 {
   for (auto iter = aFinalizers.Iter(); !iter.Done(); iter.Next()) {
     DeferredFinalizeFunction& function = iter.Key();
     void*& data = iter.Data();
 
     DeferredFinalizeFunctionHolder* holder =
@@ -1476,17 +1476,17 @@ IncrementalFinalizeRunnable::Incremental
     holder->data = data;
 
     iter.Remove();
   }
 }
 
 IncrementalFinalizeRunnable::~IncrementalFinalizeRunnable()
 {
-  MOZ_ASSERT(this != mRuntime->mFinalizeRunnable);
+  MOZ_ASSERT(this != mContext->mFinalizeRunnable);
 }
 
 void
 IncrementalFinalizeRunnable::ReleaseNow(bool aLimited)
 {
   if (mReleasing) {
     NS_WARNING("Re-entering ReleaseNow");
     return;
@@ -1524,27 +1524,27 @@ IncrementalFinalizeRunnable::ReleaseNow(
       } else {
         while (!function.run(UINT32_MAX, function.data));
         ++mFinalizeFunctionToRun;
       }
     } while (mFinalizeFunctionToRun < mDeferredFinalizeFunctions.Length());
   }
 
   if (mFinalizeFunctionToRun == mDeferredFinalizeFunctions.Length()) {
-    MOZ_ASSERT(mRuntime->mFinalizeRunnable == this);
+    MOZ_ASSERT(mContext->mFinalizeRunnable == this);
     mDeferredFinalizeFunctions.Clear();
     // NB: This may delete this!
-    mRuntime->mFinalizeRunnable = nullptr;
+    mContext->mFinalizeRunnable = nullptr;
   }
 }
 
 NS_IMETHODIMP
 IncrementalFinalizeRunnable::Run()
 {
-  if (mRuntime->mFinalizeRunnable != this) {
+  if (mContext->mFinalizeRunnable != this) {
     /* These items were already processed synchronously in JSGC_END. */
     MOZ_ASSERT(!mDeferredFinalizeFunctions.Length());
     return NS_OK;
   }
 
   TimeStamp start = TimeStamp::Now();
   ReleaseNow(true);
 
@@ -1557,17 +1557,17 @@ IncrementalFinalizeRunnable::Run()
 
   uint32_t duration = (uint32_t)((TimeStamp::Now() - start).ToMilliseconds());
   Telemetry::Accumulate(Telemetry::DEFERRED_FINALIZE_ASYNC, duration);
 
   return NS_OK;
 }
 
 void
-CycleCollectedJSRuntime::FinalizeDeferredThings(DeferredFinalizeType aType)
+CycleCollectedJSContext::FinalizeDeferredThings(DeferredFinalizeType aType)
 {
   MOZ_ASSERT(mJSContext);
 
   /*
    * If the previous GC created a runnable to finalize objects
    * incrementally, and if it hasn't finished yet, finish it now. We
    * don't want these to build up. We also don't want to allow any
    * existing incremental finalize runnables to run after a
@@ -1596,17 +1596,17 @@ CycleCollectedJSRuntime::FinalizeDeferre
     NS_DispatchToCurrentThread(mFinalizeRunnable);
   } else {
     mFinalizeRunnable->ReleaseNow(false);
     MOZ_ASSERT(!mFinalizeRunnable);
   }
 }
 
 void
-CycleCollectedJSRuntime::AnnotateAndSetOutOfMemory(OOMState* aStatePtr,
+CycleCollectedJSContext::AnnotateAndSetOutOfMemory(OOMState* aStatePtr,
                                                    OOMState aNewState)
 {
   MOZ_ASSERT(mJSContext);
 
   *aStatePtr = aNewState;
 #ifdef MOZ_CRASHREPORTER
   CrashReporter::AnnotateCrashReport(aStatePtr == &mOutOfMemoryState
                                      ? NS_LITERAL_CSTRING("JSOutOfMemory")
@@ -1615,17 +1615,17 @@ CycleCollectedJSRuntime::AnnotateAndSetO
                                      ? NS_LITERAL_CSTRING("Reporting")
                                      : aNewState == OOMState::Reported
                                      ? NS_LITERAL_CSTRING("Reported")
                                      : NS_LITERAL_CSTRING("Recovered"));
 #endif
 }
 
 void
-CycleCollectedJSRuntime::OnGC(JSGCStatus aStatus)
+CycleCollectedJSContext::OnGC(JSGCStatus aStatus)
 {
   MOZ_ASSERT(mJSContext);
 
   switch (aStatus) {
     case JSGC_BEGIN:
       nsCycleCollector_prepareForGarbageCollection();
       mZonesWaitingForGC.Clear();
       break;
@@ -1647,61 +1647,61 @@ CycleCollectedJSRuntime::OnGC(JSGCStatus
     default:
       MOZ_CRASH();
   }
 
   CustomGCCallback(aStatus);
 }
 
 void
-CycleCollectedJSRuntime::OnOutOfMemory()
+CycleCollectedJSContext::OnOutOfMemory()
 {
   MOZ_ASSERT(mJSContext);
 
   AnnotateAndSetOutOfMemory(&mOutOfMemoryState, OOMState::Reporting);
   CustomOutOfMemoryCallback();
   AnnotateAndSetOutOfMemory(&mOutOfMemoryState, OOMState::Reported);
 }
 
 void
-CycleCollectedJSRuntime::OnLargeAllocationFailure()
+CycleCollectedJSContext::OnLargeAllocationFailure()
 {
   MOZ_ASSERT(mJSContext);
 
   AnnotateAndSetOutOfMemory(&mLargeAllocationFailureState, OOMState::Reporting);
   CustomLargeAllocationFailureCallback();
   AnnotateAndSetOutOfMemory(&mLargeAllocationFailureState, OOMState::Reported);
 }
 
 void
-CycleCollectedJSRuntime::PrepareWaitingZonesForGC()
+CycleCollectedJSContext::PrepareWaitingZonesForGC()
 {
   if (mZonesWaitingForGC.Count() == 0) {
     JS::PrepareForFullGC(Context());
   } else {
     for (auto iter = mZonesWaitingForGC.Iter(); !iter.Done(); iter.Next()) {
       JS::PrepareZoneForGC(iter.Get()->GetKey());
     }
     mZonesWaitingForGC.Clear();
   }
 }
 
 void
-CycleCollectedJSRuntime::DispatchToMicroTask(already_AddRefed<nsIRunnable> aRunnable)
+CycleCollectedJSContext::DispatchToMicroTask(already_AddRefed<nsIRunnable> aRunnable)
 {
   RefPtr<nsIRunnable> runnable(aRunnable);
 
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(runnable);
 
   mPromiseMicroTaskQueue.push(runnable.forget());
 }
 
 void
-CycleCollectedJSRuntime::EnvironmentPreparer::invoke(JS::HandleObject scope,
+CycleCollectedJSContext::EnvironmentPreparer::invoke(JS::HandleObject scope,
                                                      js::ScriptEnvironmentPreparer::Closure& closure)
 {
   nsIGlobalObject* global = xpc::NativeGlobal(scope);
 
   // Not much we can do if we simply don't have a usable global here...
   NS_ENSURE_TRUE_VOID(global && global->GetGlobalJSObject());
 
   AutoEntryScript aes(global, "JS-engine-initiated execution");
rename from xpcom/base/CycleCollectedJSRuntime.h
rename to xpcom/base/CycleCollectedJSContext.h
--- a/xpcom/base/CycleCollectedJSRuntime.h
+++ b/xpcom/base/CycleCollectedJSContext.h
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef mozilla_CycleCollectedJSRuntime_h__
-#define mozilla_CycleCollectedJSRuntime_h__
+#ifndef mozilla_CycleCollectedJSContext_h__
+#define mozilla_CycleCollectedJSContext_h__
 
 #include <queue>
 
 #include "mozilla/DeferredFinalize.h"
 #include "mozilla/mozalloc.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/SegmentedVector.h"
 #include "jsapi.h"
@@ -129,24 +129,24 @@ struct CycleCollectorResults
   uint32_t mVisitedRefCounted;
   uint32_t mVisitedGCed;
   uint32_t mFreedRefCounted;
   uint32_t mFreedGCed;
   uint32_t mFreedJSZones;
   uint32_t mNumSlices;
 };
 
-class CycleCollectedJSRuntime
+class CycleCollectedJSContext
 {
   friend class JSGCThingParticipant;
   friend class JSZoneParticipant;
   friend class IncrementalFinalizeRunnable;
 protected:
-  CycleCollectedJSRuntime();
-  virtual ~CycleCollectedJSRuntime();
+  CycleCollectedJSContext();
+  virtual ~CycleCollectedJSContext();
 
   nsresult Initialize(JSContext* aParentContext,
                       uint32_t aMaxBytes,
                       uint32_t aMaxNurseryBytes);
 
   size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
   void UnmarkSkippableJSHolders();
 
@@ -345,28 +345,28 @@ public:
   {
     mDisableMicroTaskCheckpoint = aDisable;
   }
 
   class MOZ_RAII AutoDisableMicroTaskCheckpoint
   {
     public:
     AutoDisableMicroTaskCheckpoint()
-    : mCCRT(CycleCollectedJSRuntime::Get())
+    : mCCJSCX(CycleCollectedJSContext::Get())
     {
-      mOldValue = mCCRT->MicroTaskCheckpointDisabled();
-      mCCRT->DisableMicroTaskCheckpoint(true);
+      mOldValue = mCCJSCX->MicroTaskCheckpointDisabled();
+      mCCJSCX->DisableMicroTaskCheckpoint(true);
     }
 
     ~AutoDisableMicroTaskCheckpoint()
     {
-      mCCRT->DisableMicroTaskCheckpoint(mOldValue);
+      mCCJSCX->DisableMicroTaskCheckpoint(mOldValue);
     }
 
-    CycleCollectedJSRuntime* mCCRT;
+    CycleCollectedJSContext* mCCJSCX;
     bool mOldValue;
   };
 
 protected:
   JSContext* MaybeContext() const { return mJSContext; }
 
 public:
   // nsThread entrypoints
@@ -379,19 +379,19 @@ public:
   uint32_t RecursionDepth();
 
   // Run in stable state (call through nsContentUtils)
   void RunInStableState(already_AddRefed<nsIRunnable>&& aRunnable);
   // This isn't in the spec at all yet, but this gets the behavior we want for IDB.
   // Runs after the current microtask completes.
   void RunInMetastableState(already_AddRefed<nsIRunnable>&& aRunnable);
 
-  // Get the current thread's CycleCollectedJSRuntime.  Returns null if there
+  // Get the current thread's CycleCollectedJSContext.  Returns null if there
   // isn't one.
-  static CycleCollectedJSRuntime* Get();
+  static CycleCollectedJSContext* Get();
 
   // Add aZone to the set of zones waiting for a GC.
   void AddZoneWaitingForGC(JS::Zone* aZone)
   {
     mZonesWaitingForGC.PutEntry(aZone);
   }
 
   // Prepare any zones for GC that have been passed to AddZoneWaitingForGC()
@@ -485,9 +485,9 @@ inline bool AddToCCKind(JS::TraceKind aK
   return aKind == JS::TraceKind::Object || aKind == JS::TraceKind::Script;
 }
 
 bool
 GetBuildId(JS::BuildIdCharVector* aBuildID);
 
 } // namespace mozilla
 
-#endif // mozilla_CycleCollectedJSRuntime_h__
+#endif // mozilla_CycleCollectedJSContext_h__
--- a/xpcom/base/DebuggerOnGCRunnable.cpp
+++ b/xpcom/base/DebuggerOnGCRunnable.cpp
@@ -2,17 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/DebuggerOnGCRunnable.h"
 
 #include "mozilla/dom/ScriptSettings.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/Move.h"
 #include "js/Debug.h"
 
 namespace mozilla {
 
 /* static */ nsresult
 DebuggerOnGCRunnable::Enqueue(JSContext* aCx, const JS::GCDescription& aDesc)
 {
--- a/xpcom/base/DeferredFinalize.cpp
+++ b/xpcom/base/DeferredFinalize.cpp
@@ -2,27 +2,27 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/DeferredFinalize.h"
 
 #include "mozilla/Assertions.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 
 void
 mozilla::DeferredFinalize(nsISupports* aSupports)
 {
-  CycleCollectedJSRuntime* rt = CycleCollectedJSRuntime::Get();
-  MOZ_ASSERT(rt, "Should have a CycleCollectedJSRuntime by now");
-  rt->DeferredFinalize(aSupports);
+  CycleCollectedJSContext* cx = CycleCollectedJSContext::Get();
+  MOZ_ASSERT(cx, "Should have a CycleCollectedJSContext by now");
+  cx->DeferredFinalize(aSupports);
 }
 
 void
 mozilla::DeferredFinalize(DeferredFinalizeAppendFunction aAppendFunc,
                           DeferredFinalizeFunction aFunc,
                           void* aThing)
 {
-  CycleCollectedJSRuntime* rt = CycleCollectedJSRuntime::Get();
-  MOZ_ASSERT(rt, "Should have a CycleCollectedJSRuntime by now");
-  rt->DeferredFinalize(aAppendFunc, aFunc, aThing);
+  CycleCollectedJSContext* cx = CycleCollectedJSContext::Get();
+  MOZ_ASSERT(cx, "Should have a CycleCollectedJSContext by now");
+  cx->DeferredFinalize(aAppendFunc, aFunc, aThing);
 }
--- a/xpcom/base/HoldDropJSObjects.cpp
+++ b/xpcom/base/HoldDropJSObjects.cpp
@@ -2,27 +2,27 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/HoldDropJSObjects.h"
 
 #include "mozilla/Assertions.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 
 namespace mozilla {
 namespace cyclecollector {
 
 void
 HoldJSObjectsImpl(void* aHolder, nsScriptObjectTracer* aTracer)
 {
-  CycleCollectedJSRuntime* rt = CycleCollectedJSRuntime::Get();
-  MOZ_ASSERT(rt, "Should have a CycleCollectedJSRuntime by now");
-  rt->AddJSHolder(aHolder, aTracer);
+  CycleCollectedJSContext* cx = CycleCollectedJSContext::Get();
+  MOZ_ASSERT(cx, "Should have a CycleCollectedJSContext by now");
+  cx->AddJSHolder(aHolder, aTracer);
 }
 
 void
 HoldJSObjectsImpl(nsISupports* aHolder)
 {
   nsXPCOMCycleCollectionParticipant* participant = nullptr;
   CallQueryInterface(aHolder, &participant);
   MOZ_ASSERT(participant, "Failed to QI to nsXPCOMCycleCollectionParticipant!");
@@ -30,19 +30,19 @@ HoldJSObjectsImpl(nsISupports* aHolder)
              "The result of QIing a JS holder should be the same as ToSupports");
 
   HoldJSObjectsImpl(aHolder, participant);
 }
 
 void
 DropJSObjectsImpl(void* aHolder)
 {
-  CycleCollectedJSRuntime* rt = CycleCollectedJSRuntime::Get();
-  MOZ_ASSERT(rt, "Should have a CycleCollectedJSRuntime by now");
-  rt->RemoveJSHolder(aHolder);
+  CycleCollectedJSContext* cx = CycleCollectedJSContext::Get();
+  MOZ_ASSERT(cx, "Should have a CycleCollectedJSContext by now");
+  cx->RemoveJSHolder(aHolder);
 }
 
 void
 DropJSObjectsImpl(nsISupports* aHolder)
 {
 #ifdef DEBUG
   nsXPCOMCycleCollectionParticipant* participant = nullptr;
   CallQueryInterface(aHolder, &participant);
@@ -54,15 +54,15 @@ DropJSObjectsImpl(nsISupports* aHolder)
 }
 
 } // namespace cyclecollector
 
 #ifdef DEBUG
 bool
 IsJSHolder(void* aHolder)
 {
-  CycleCollectedJSRuntime* rt = CycleCollectedJSRuntime::Get();
-  MOZ_ASSERT(rt, "Should have a CycleCollectedJSRuntime by now");
-  return rt->IsJSHolder(aHolder);
+  CycleCollectedJSContext* cx = CycleCollectedJSContext::Get();
+  MOZ_ASSERT(cx, "Should have a CycleCollectedJSContext by now");
+  return cx->IsJSHolder(aHolder);
 }
 #endif
 
 } // namespace mozilla
--- a/xpcom/base/moz.build
+++ b/xpcom/base/moz.build
@@ -70,17 +70,17 @@ if CONFIG['OS_ARCH'] == 'WINNT':
     EXPORTS += [
         'nsWindowsHelpers.h',
     ]
 
 EXPORTS.mozilla += [
     'AvailableMemoryTracker.h',
     'ClearOnShutdown.h',
     'CountingAllocatorBase.h',
-    'CycleCollectedJSRuntime.h',
+    'CycleCollectedJSContext.h',
     'Debug.h',
     'DebuggerOnGCRunnable.h',
     'DeferredFinalize.h',
     'ErrorNames.h',
     'HoldDropJSObjects.h',
     'JSObjectHolder.h',
     'LinuxUtils.h',
     'Logging.h',
@@ -96,17 +96,17 @@ EXPORTS.mozilla += [
 SOURCES += [
     'nsDebugImpl.cpp',
 ]
 SOURCES['nsDebugImpl.cpp'].no_pgo = True
 
 UNIFIED_SOURCES += [
     'AvailableMemoryTracker.cpp',
     'ClearOnShutdown.cpp',
-    'CycleCollectedJSRuntime.cpp',
+    'CycleCollectedJSContext.cpp',
     'Debug.cpp',
     'DebuggerOnGCRunnable.cpp',
     'DeferredFinalize.cpp',
     'ErrorNames.cpp',
     'HoldDropJSObjects.cpp',
     'JSObjectHolder.cpp',
     'Logging.cpp',
     'LogModulePrefWatcher.cpp',
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -149,17 +149,17 @@
 #include <errno.h>
 #endif
 #endif
 
 #include "base/process_util.h"
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/AutoRestore.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/HoldDropJSObjects.h"
 /* This must occur *after* base/process_util.h to avoid typedefs conflicts. */
 #include "mozilla/LinkedList.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/SegmentedVector.h"
 
 #include "nsCycleCollectionParticipant.h"
@@ -1263,17 +1263,17 @@ public:
 private:
   bool mActivelyCollecting;
   bool mFreeingSnowWhite;
   // mScanInProgress should be false when we're collecting white objects.
   bool mScanInProgress;
   CycleCollectorResults mResults;
   TimeStamp mCollectionStart;
 
-  CycleCollectedJSRuntime* mJSRuntime;
+  CycleCollectedJSContext* mJSContext;
 
   ccPhase mIncrementalPhase;
   CCGraph mGraph;
   nsAutoPtr<CCGraphBuilder> mBuilder;
   RefPtr<nsCycleCollectorLogger> mLogger;
 
 #ifdef DEBUG
   void* mThread;
@@ -1294,18 +1294,18 @@ private:
   RefPtr<JSPurpleBuffer> mJSPurpleBuffer;
 
 private:
   virtual ~nsCycleCollector();
 
 public:
   nsCycleCollector();
 
-  void RegisterJSRuntime(CycleCollectedJSRuntime* aJSRuntime);
-  void ForgetJSRuntime();
+  void RegisterJSContext(CycleCollectedJSContext* aJSContext);
+  void ForgetJSContext();
 
   void SetBeforeUnlinkCallback(CC_BeforeUnlinkCallback aBeforeUnlinkCB)
   {
     CheckThreadSafety();
     mBeforeUnlinkCB = aBeforeUnlinkCB;
   }
 
   void SetForgetSkippableCallback(CC_ForgetSkippableCallback aForgetSkippableCB)
@@ -1403,17 +1403,17 @@ public:
 
 ////////////////////////////////////////////////////////////////////////
 // The static collector struct
 ////////////////////////////////////////////////////////////////////////
 
 struct CollectorData
 {
   RefPtr<nsCycleCollector> mCollector;
-  CycleCollectedJSRuntime* mRuntime;
+  CycleCollectedJSContext* mContext;
 };
 
 static MOZ_THREAD_LOCAL(CollectorData*) sCollectorData;
 
 ////////////////////////////////////////////////////////////////////////
 // Utility functions
 ////////////////////////////////////////////////////////////////////////
 
@@ -1825,18 +1825,18 @@ public:
       return NS_OK;
     }
 
     FILE* gcLog;
     rv = mLogSink->Open(&gcLog, &mCCLog);
     NS_ENSURE_SUCCESS(rv, rv);
     // Dump the JS heap.
     CollectorData* data = sCollectorData.get();
-    if (data && data->mRuntime) {
-      data->mRuntime->DumpJSHeap(gcLog);
+    if (data && data->mContext) {
+      data->mContext->DumpJSHeap(gcLog);
     }
     rv = mLogSink->CloseGCLog();
     NS_ENSURE_SUCCESS(rv, rv);
 
     fprintf(mCCLog, "# WantAllTraces=%s\n", mWantAllTraces ? "true" : "false");
     return NS_OK;
   }
   void NoteRefCountedObject(uint64_t aAddress, uint32_t aRefCount,
@@ -2068,17 +2068,17 @@ private:
   nsCString mNextEdgeName;
   RefPtr<nsCycleCollectorLogger> mLogger;
   bool mMergeZones;
   nsAutoPtr<NodePool::Enumerator> mCurrNode;
 
 public:
   CCGraphBuilder(CCGraph& aGraph,
                  CycleCollectorResults& aResults,
-                 CycleCollectedJSRuntime* aJSRuntime,
+                 CycleCollectedJSContext* aJSContext,
                  nsCycleCollectorLogger* aLogger,
                  bool aMergeZones);
   virtual ~CCGraphBuilder();
 
   bool WantAllTraces() const
   {
     return nsCycleCollectionNoteRootCallback::WantAllTraces();
   }
@@ -2166,31 +2166,31 @@ private:
       return nullptr;
     }
     return zone;
   }
 };
 
 CCGraphBuilder::CCGraphBuilder(CCGraph& aGraph,
                                CycleCollectorResults& aResults,
-                               CycleCollectedJSRuntime* aJSRuntime,
+                               CycleCollectedJSContext* aJSContext,
                                nsCycleCollectorLogger* aLogger,
                                bool aMergeZones)
   : mGraph(aGraph)
   , mResults(aResults)
   , mNodeBuilder(aGraph.mNodes)
   , mEdgeBuilder(aGraph.mEdges)
   , mJSParticipant(nullptr)
   , mJSZoneParticipant(nullptr)
   , mLogger(aLogger)
   , mMergeZones(aMergeZones)
 {
-  if (aJSRuntime) {
-    mJSParticipant = aJSRuntime->GCThingParticipant();
-    mJSZoneParticipant = aJSRuntime->ZoneParticipant();
+  if (aJSContext) {
+    mJSParticipant = aJSContext->GCThingParticipant();
+    mJSZoneParticipant = aJSContext->ZoneParticipant();
   }
 
   if (mLogger) {
     mFlags |= nsCycleCollectionTraversalCallback::WANT_DEBUG_INFO;
     if (mLogger->IsAllTraces()) {
       mFlags |= nsCycleCollectionTraversalCallback::WANT_ALL_TRACES;
       mWantAllTraces = true; // for nsCycleCollectionNoteRootCallback
     }
@@ -2866,18 +2866,18 @@ nsCycleCollector::ForgetSkippable(bool a
   if (NS_IsMainThread()) {
     marker.emplace("nsCycleCollector::ForgetSkippable", MarkerStackRequest::NO_STACK);
   }
 
   // If we remove things from the purple buffer during graph building, we may
   // lose track of an object that was mutated during graph building.
   MOZ_ASSERT(IsIdle());
 
-  if (mJSRuntime) {
-    mJSRuntime->PrepareForForgetSkippable();
+  if (mJSContext) {
+    mJSContext->PrepareForForgetSkippable();
   }
   MOZ_ASSERT(!mScanInProgress,
              "Don't forget skippable or free snow-white while scan is in progress.");
   mPurpleBuf.RemoveSkippable(this, aRemoveChildlessNodes,
                              aAsyncSnowWhiteFreeing, mForgetSkippableCB);
 }
 
 MOZ_NEVER_INLINE void
@@ -3050,21 +3050,21 @@ nsCycleCollector::ScanIncrementalRoots()
   // buffer here, so these objects will be suspected and freed in the next CC
   // if they are garbage.
   bool failed = false;
   PurpleScanBlackVisitor purpleScanBlackVisitor(mGraph, mLogger,
                                                 mWhiteNodeCount, failed);
   mPurpleBuf.VisitEntries(purpleScanBlackVisitor);
   timeLog.Checkpoint("ScanIncrementalRoots::fix purple");
 
-  bool hasJSRuntime = !!mJSRuntime;
+  bool hasJSContext = !!mJSContext;
   nsCycleCollectionParticipant* jsParticipant =
-    hasJSRuntime ? mJSRuntime->GCThingParticipant() : nullptr;
+    hasJSContext ? mJSContext->GCThingParticipant() : nullptr;
   nsCycleCollectionParticipant* zoneParticipant =
-    hasJSRuntime ? mJSRuntime->ZoneParticipant() : nullptr;
+    hasJSContext ? mJSContext->ZoneParticipant() : nullptr;
   bool hasLogger = !!mLogger;
 
   NodePool::Enumerator etor(mGraph.mNodes);
   while (!etor.IsDone()) {
     PtrInfo* pi = etor.GetNext();
 
     // As an optimization, if an object has already been determined to be live,
     // don't consider it further.  We can't do this if there is a listener,
@@ -3073,17 +3073,17 @@ nsCycleCollector::ScanIncrementalRoots()
       continue;
     }
 
     // Garbage collected objects:
     // If a GCed object was added to the graph with a refcount of zero, and is
     // now marked black by the GC, it was probably gray before and was exposed
     // to active JS, so it may have been stored somewhere, so it needs to be
     // treated as live.
-    if (pi->IsGrayJS() && MOZ_LIKELY(hasJSRuntime)) {
+    if (pi->IsGrayJS() && MOZ_LIKELY(hasJSContext)) {
       // If the object is still marked gray by the GC, nothing could have gotten
       // hold of it, so it isn't an incremental root.
       if (pi->mParticipant == jsParticipant) {
         JS::GCCellPtr ptr(pi->mPointer, JS::GCThingTraceKind(pi->mPointer));
         if (GCThingIsGrayCCThing(ptr)) {
           continue;
         }
       } else if (pi->mParticipant == zoneParticipant) {
@@ -3285,36 +3285,36 @@ nsCycleCollector::CollectWhite()
   TimeLog timeLog;
 
   MOZ_ASSERT(mIncrementalPhase == ScanAndCollectWhitePhase);
 
   uint32_t numWhiteNodes = 0;
   uint32_t numWhiteGCed = 0;
   uint32_t numWhiteJSZones = 0;
 
-  bool hasJSRuntime = !!mJSRuntime;
+  bool hasJSContext = !!mJSContext;
   nsCycleCollectionParticipant* zoneParticipant =
-    hasJSRuntime ? mJSRuntime->ZoneParticipant() : nullptr;
+    hasJSContext ? mJSContext->ZoneParticipant() : nullptr;
 
   NodePool::Enumerator etor(mGraph.mNodes);
   while (!etor.IsDone()) {
     PtrInfo* pinfo = etor.GetNext();
     if (pinfo->mColor == white && pinfo->mParticipant) {
       if (pinfo->IsGrayJS()) {
-        MOZ_ASSERT(mJSRuntime);
+        MOZ_ASSERT(mJSContext);
         ++numWhiteGCed;
         JS::Zone* zone;
         if (MOZ_UNLIKELY(pinfo->mParticipant == zoneParticipant)) {
           ++numWhiteJSZones;
           zone = static_cast<JS::Zone*>(pinfo->mPointer);
         } else {
           JS::GCCellPtr ptr(pinfo->mPointer, JS::GCThingTraceKind(pinfo->mPointer));
           zone = JS::GetTenuredGCThingZone(ptr);
         }
-        mJSRuntime->AddZoneWaitingForGC(zone);
+        mJSContext->AddZoneWaitingForGC(zone);
       } else {
         whiteNodes.InfallibleAppend(pinfo);
         pinfo->mParticipant->Root(pinfo->mPointer);
         ++numWhiteNodes;
       }
     }
   }
 
@@ -3333,18 +3333,18 @@ nsCycleCollector::CollectWhite()
   // else not in whiteNodes after here.
 
   for (auto iter = whiteNodes.Iter(); !iter.Done(); iter.Next()) {
     PtrInfo* pinfo = iter.Get();
     MOZ_ASSERT(pinfo->mParticipant,
                "Unlink shouldn't see objects removed from graph.");
     pinfo->mParticipant->Unlink(pinfo->mPointer);
 #ifdef DEBUG
-    if (mJSRuntime) {
-      mJSRuntime->AssertNoObjectsToTrace(pinfo->mPointer);
+    if (mJSContext) {
+      mJSContext->AssertNoObjectsToTrace(pinfo->mPointer);
     }
 #endif
   }
   timeLog.Checkpoint("CollectWhite::Unlink");
 
   for (auto iter = whiteNodes.Iter(); !iter.Done(); iter.Next()) {
     PtrInfo* pinfo = iter.Get();
     MOZ_ASSERT(pinfo->mParticipant,
@@ -3406,17 +3406,17 @@ nsCycleCollector::CollectReports(nsIHand
 ////////////////////////////////////////////////////////////////////////
 // Collector implementation
 ////////////////////////////////////////////////////////////////////////
 
 nsCycleCollector::nsCycleCollector() :
   mActivelyCollecting(false),
   mFreeingSnowWhite(false),
   mScanInProgress(false),
-  mJSRuntime(nullptr),
+  mJSContext(nullptr),
   mIncrementalPhase(IdlePhase),
 #ifdef DEBUG
   mThread(NS_GetCurrentThread()),
 #endif
   mWhiteNodeCount(0),
   mBeforeUnlinkCB(nullptr),
   mForgetSkippableCB(nullptr),
   mUnmergedNeeded(0),
@@ -3425,36 +3425,36 @@ nsCycleCollector::nsCycleCollector() :
 }
 
 nsCycleCollector::~nsCycleCollector()
 {
   UnregisterWeakMemoryReporter(this);
 }
 
 void
-nsCycleCollector::RegisterJSRuntime(CycleCollectedJSRuntime* aJSRuntime)
+nsCycleCollector::RegisterJSContext(CycleCollectedJSContext* aJSContext)
 {
-  MOZ_RELEASE_ASSERT(!mJSRuntime, "Multiple registrations of JS runtime in cycle collector");
-  mJSRuntime = aJSRuntime;
+  MOZ_RELEASE_ASSERT(!mJSContext, "Multiple registrations of JS context in cycle collector");
+  mJSContext = aJSContext;
 
   if (!NS_IsMainThread()) {
     return;
   }
 
   // We can't register as a reporter in nsCycleCollector() because that runs
   // before the memory reporter manager is initialized.  So we do it here
   // instead.
   RegisterWeakMemoryReporter(this);
 }
 
 void
-nsCycleCollector::ForgetJSRuntime()
+nsCycleCollector::ForgetJSContext()
 {
-  MOZ_RELEASE_ASSERT(mJSRuntime, "Forgetting JS runtime in cycle collector before a JS runtime was registered");
-  mJSRuntime = nullptr;
+  MOZ_RELEASE_ASSERT(mJSContext, "Forgetting JS context in cycle collector before a JS context was registered");
+  mJSContext = nullptr;
 }
 
 #ifdef DEBUG
 static bool
 HasParticipant(void* aPtr, nsCycleCollectionParticipant* aParti)
 {
   if (aParti) {
     return true;
@@ -3495,60 +3495,60 @@ nsCycleCollector::CheckThreadSafety()
   // XXXkhuey we can be called so late in shutdown that NS_GetCurrentThread
   // returns null (after the thread manager has shut down)
   MOZ_ASSERT(mThread == currentThread || !currentThread);
 #endif
 }
 
 // The cycle collector uses the mark bitmap to discover what JS objects
 // were reachable only from XPConnect roots that might participate in
-// cycles. We ask the JS runtime whether we need to force a GC before
+// cycles. We ask the JS context whether we need to force a GC before
 // this CC. It returns true on startup (before the mark bits have been set),
 // and also when UnmarkGray has run out of stack.  We also force GCs on shut
 // down to collect cycles involving both DOM and JS.
 void
 nsCycleCollector::FixGrayBits(bool aForceGC, TimeLog& aTimeLog)
 {
   CheckThreadSafety();
 
-  if (!mJSRuntime) {
+  if (!mJSContext) {
     return;
   }
 
   if (!aForceGC) {
-    mJSRuntime->FixWeakMappingGrayBits();
+    mJSContext->FixWeakMappingGrayBits();
     aTimeLog.Checkpoint("FixWeakMappingGrayBits");
 
-    bool needGC = !mJSRuntime->AreGCGrayBitsValid();
+    bool needGC = !mJSContext->AreGCGrayBitsValid();
     // Only do a telemetry ping for non-shutdown CCs.
     CC_TELEMETRY(_NEED_GC, needGC);
     if (!needGC) {
       return;
     }
     mResults.mForcedGC = true;
   }
 
-  mJSRuntime->GarbageCollect(aForceGC ? JS::gcreason::SHUTDOWN_CC :
+  mJSContext->GarbageCollect(aForceGC ? JS::gcreason::SHUTDOWN_CC :
                                         JS::gcreason::CC_FORCED);
   aTimeLog.Checkpoint("FixGrayBits GC");
 }
 
 bool
 nsCycleCollector::IsIncrementalGCInProgress()
 {
-  return mJSRuntime && JS::IsIncrementalGCInProgress(mJSRuntime->Context());
+  return mJSContext && JS::IsIncrementalGCInProgress(mJSContext->Context());
 }
 
 void
 nsCycleCollector::FinishAnyIncrementalGCInProgress()
 {
   if (IsIncrementalGCInProgress()) {
     NS_WARNING("Finishing incremental GC in progress during CC");
-    JS::PrepareForIncrementalGC(mJSRuntime->Context());
-    JS::FinishIncrementalGC(mJSRuntime->Context(), JS::gcreason::CC_FORCED);
+    JS::PrepareForIncrementalGC(mJSContext->Context());
+    JS::FinishIncrementalGC(mJSContext->Context(), JS::gcreason::CC_FORCED);
   }
 }
 
 void
 nsCycleCollector::CleanupAfterCollection()
 {
   TimeLog timeLog;
   MOZ_ASSERT(mIncrementalPhase == CleanupPhase);
@@ -3572,21 +3572,21 @@ nsCycleCollector::CleanupAfterCollection
 #endif
 
   CC_TELEMETRY( , interval);
   CC_TELEMETRY(_VISITED_REF_COUNTED, mResults.mVisitedRefCounted);
   CC_TELEMETRY(_VISITED_GCED, mResults.mVisitedGCed);
   CC_TELEMETRY(_COLLECTED, mWhiteNodeCount);
   timeLog.Checkpoint("CleanupAfterCollection::telemetry");
 
-  if (mJSRuntime) {
-    mJSRuntime->FinalizeDeferredThings(mResults.mAnyManual
-                                       ? CycleCollectedJSRuntime::FinalizeNow
-                                       : CycleCollectedJSRuntime::FinalizeIncrementally);
-    mJSRuntime->EndCycleCollectionCallback(mResults);
+  if (mJSContext) {
+    mJSContext->FinalizeDeferredThings(mResults.mAnyManual
+                                       ? CycleCollectedJSContext::FinalizeNow
+                                       : CycleCollectedJSContext::FinalizeIncrementally);
+    mJSContext->EndCycleCollectionCallback(mResults);
     timeLog.Checkpoint("CleanupAfterCollection::EndCycleCollectionCallback()");
   }
   mIncrementalPhase = IdlePhase;
 }
 
 void
 nsCycleCollector::ShutdownCollect()
 {
@@ -3754,17 +3754,17 @@ nsCycleCollector::FinishAnyCurrentCollec
 // Don't merge too many times in a row, and do at least a minimum
 // number of unmerged CCs in a row.
 static const uint32_t kMinConsecutiveUnmerged = 3;
 static const uint32_t kMaxConsecutiveMerged = 3;
 
 bool
 nsCycleCollector::ShouldMergeZones(ccType aCCType)
 {
-  if (!mJSRuntime) {
+  if (!mJSContext) {
     return false;
   }
 
   MOZ_ASSERT(mUnmergedNeeded <= kMinConsecutiveUnmerged);
   MOZ_ASSERT(mMergedInARow <= kMaxConsecutiveMerged);
 
   if (mMergedInARow == kMaxConsecutiveMerged) {
     MOZ_ASSERT(mUnmergedNeeded == 0);
@@ -3772,17 +3772,17 @@ nsCycleCollector::ShouldMergeZones(ccTyp
   }
 
   if (mUnmergedNeeded > 0) {
     mUnmergedNeeded--;
     mMergedInARow = 0;
     return false;
   }
 
-  if (aCCType == SliceCC && mJSRuntime->UsefulToMergeZones()) {
+  if (aCCType == SliceCC && mJSContext->UsefulToMergeZones()) {
     mMergedInARow++;
     return true;
   } else {
     mMergedInARow = 0;
     return false;
   }
 }
 
@@ -3790,18 +3790,18 @@ void
 nsCycleCollector::BeginCollection(ccType aCCType,
                                   nsICycleCollectorListener* aManualListener)
 {
   TimeLog timeLog;
   MOZ_ASSERT(IsIdle());
 
   mCollectionStart = TimeStamp::Now();
 
-  if (mJSRuntime) {
-    mJSRuntime->BeginCycleCollectionCallback();
+  if (mJSContext) {
+    mJSContext->BeginCycleCollectionCallback();
     timeLog.Checkpoint("BeginCycleCollectionCallback()");
   }
 
   bool isShutdown = (aCCType == ShutdownCC);
 
   // Set up the listener for this CC.
   MOZ_ASSERT_IF(isShutdown, !aManualListener);
   MOZ_ASSERT(!mLogger, "Forgot to clear a previous listener?");
@@ -3844,23 +3844,23 @@ nsCycleCollector::BeginCollection(ccType
   // Set up the data structures for building the graph.
   mGraph.Init();
   mResults.Init();
   mResults.mAnyManual = (aCCType != SliceCC);
   bool mergeZones = ShouldMergeZones(aCCType);
   mResults.mMergedZones = mergeZones;
 
   MOZ_ASSERT(!mBuilder, "Forgot to clear mBuilder");
-  mBuilder = new CCGraphBuilder(mGraph, mResults, mJSRuntime, mLogger,
+  mBuilder = new CCGraphBuilder(mGraph, mResults, mJSContext, mLogger,
                                 mergeZones);
   timeLog.Checkpoint("BeginCollection prepare graph builder");
 
-  if (mJSRuntime) {
-    mJSRuntime->TraverseRoots(*mBuilder);
-    timeLog.Checkpoint("mJSRuntime->TraverseRoots()");
+  if (mJSContext) {
+    mJSContext->TraverseRoots(*mBuilder);
+    timeLog.Checkpoint("mJSContext->TraverseRoots()");
   }
 
   AutoRestore<bool> ar(mScanInProgress);
   MOZ_ASSERT(!mScanInProgress);
   mScanInProgress = true;
   mPurpleBuf.SelectPointers(*mBuilder);
   timeLog.Checkpoint("SelectPointers()");
 
@@ -3906,17 +3906,17 @@ nsCycleCollector::SizeOfIncludingThis(mo
 {
   *aObjectSize = aMallocSizeOf(this);
 
   *aGraphSize = mGraph.SizeOfExcludingThis(aMallocSizeOf);
 
   *aPurpleBufferSize = mPurpleBuf.SizeOfExcludingThis(aMallocSizeOf);
 
   // These fields are deliberately not measured:
-  // - mJSRuntime: because it's non-owning and measured by JS reporters.
+  // - mJSContext: because it's non-owning and measured by JS reporters.
   // - mParams: because it only contains scalars.
 }
 
 JSPurpleBuffer*
 nsCycleCollector::GetJSPurpleBuffer()
 {
   if (!mJSPurpleBuffer) {
     // The Release call here confuses the GC analysis.
@@ -3930,57 +3930,57 @@ nsCycleCollector::GetJSPurpleBuffer()
 }
 
 ////////////////////////////////////////////////////////////////////////
 // Module public API (exported in nsCycleCollector.h)
 // Just functions that redirect into the singleton, once it's built.
 ////////////////////////////////////////////////////////////////////////
 
 void
-nsCycleCollector_registerJSRuntime(CycleCollectedJSRuntime* aRt)
+nsCycleCollector_registerJSContext(CycleCollectedJSContext* aCx)
 {
   CollectorData* data = sCollectorData.get();
 
   // We should have started the cycle collector by now.
   MOZ_ASSERT(data);
   MOZ_ASSERT(data->mCollector);
-  // But we shouldn't already have a runtime.
-  MOZ_ASSERT(!data->mRuntime);
-
-  data->mRuntime = aRt;
-  data->mCollector->RegisterJSRuntime(aRt);
+  // But we shouldn't already have a context.
+  MOZ_ASSERT(!data->mContext);
+
+  data->mContext = aCx;
+  data->mCollector->RegisterJSContext(aCx);
 }
 
 void
-nsCycleCollector_forgetJSRuntime()
+nsCycleCollector_forgetJSContext()
 {
   CollectorData* data = sCollectorData.get();
 
   // We should have started the cycle collector by now.
   MOZ_ASSERT(data);
-  // And we shouldn't have already forgotten our runtime.
-  MOZ_ASSERT(data->mRuntime);
+  // And we shouldn't have already forgotten our context.
+  MOZ_ASSERT(data->mContext);
 
   // But it may have shutdown already.
   if (data->mCollector) {
-    data->mCollector->ForgetJSRuntime();
-    data->mRuntime = nullptr;
+    data->mCollector->ForgetJSContext();
+    data->mContext = nullptr;
   } else {
-    data->mRuntime = nullptr;
+    data->mContext = nullptr;
     delete data;
     sCollectorData.set(nullptr);
   }
 }
 
-/* static */ CycleCollectedJSRuntime*
-CycleCollectedJSRuntime::Get()
+/* static */ CycleCollectedJSContext*
+CycleCollectedJSContext::Get()
 {
   CollectorData* data = sCollectorData.get();
   if (data) {
-    return data->mRuntime;
+    return data->mContext;
   }
   return nullptr;
 }
 
 MOZ_NEVER_INLINE static void
 SuspectAfterShutdown(void* aPtr, nsCycleCollectionParticipant* aCp,
                      nsCycleCollectingAutoRefCnt* aRefCnt,
                      bool* aShouldDelete)
@@ -4050,17 +4050,17 @@ void
 nsCycleCollector_startup()
 {
   if (sCollectorData.get()) {
     MOZ_CRASH();
   }
 
   CollectorData* data = new CollectorData;
   data->mCollector = new nsCycleCollector();
-  data->mRuntime = nullptr;
+  data->mContext = nullptr;
 
   sCollectorData.set(data);
 }
 
 void
 nsCycleCollector_setBeforeUnlinkCallback(CC_BeforeUnlinkCallback aCB)
 {
   CollectorData* data = sCollectorData.get();
@@ -4101,31 +4101,31 @@ nsCycleCollector_forgetSkippable(bool aR
   data->mCollector->ForgetSkippable(aRemoveChildlessNodes,
                                     aAsyncSnowWhiteFreeing);
   timeLog.Checkpoint("ForgetSkippable()");
 }
 
 void
 nsCycleCollector_dispatchDeferredDeletion(bool aContinuation, bool aPurge)
 {
-  CycleCollectedJSRuntime* rt = CycleCollectedJSRuntime::Get();
-  if (rt) {
-    rt->DispatchDeferredDeletion(aContinuation, aPurge);
+  CycleCollectedJSContext* cx = CycleCollectedJSContext::Get();
+  if (cx) {
+    cx->DispatchDeferredDeletion(aContinuation, aPurge);
   }
 }
 
 bool
 nsCycleCollector_doDeferredDeletion()
 {
   CollectorData* data = sCollectorData.get();
 
   // We should have started the cycle collector by now.
   MOZ_ASSERT(data);
   MOZ_ASSERT(data->mCollector);
-  MOZ_ASSERT(data->mRuntime);
+  MOZ_ASSERT(data->mContext);
 
   return data->mCollector->FreeSnowWhite(false);
 }
 
 already_AddRefed<nsICycleCollectorLogSink>
 nsCycleCollector_createLogSink()
 {
   nsCOMPtr<nsICycleCollectorLogSink> sink = new nsCycleCollectorLogSinkToFile();
@@ -4199,19 +4199,19 @@ nsCycleCollector_shutdown(bool aDoCollec
 
   if (data) {
     MOZ_ASSERT(data->mCollector);
     PROFILER_LABEL("nsCycleCollector", "shutdown",
                    js::ProfileEntry::Category::CC);
 
     data->mCollector->Shutdown(aDoCollect);
     data->mCollector = nullptr;
-    if (data->mRuntime) {
+    if (data->mContext) {
       // Run any remaining tasks that may have been enqueued via
       // RunInStableState during the final cycle collection.
-      data->mRuntime->ProcessStableStateQueue();
+      data->mContext->ProcessStableStateQueue();
     }
-    if (!data->mRuntime) {
+    if (!data->mContext) {
       delete data;
       sCollectorData.set(nullptr);
     }
   }
 }
--- a/xpcom/base/nsCycleCollector.h
+++ b/xpcom/base/nsCycleCollector.h
@@ -13,17 +13,17 @@ class nsISupports;
 template<class T> struct already_AddRefed;
 
 #include "nsError.h"
 #include "nsID.h"
 
 #include "js/SliceBudget.h"
 
 namespace mozilla {
-class CycleCollectedJSRuntime;
+class CycleCollectedJSContext;
 } // namespace mozilla
 
 bool nsCycleCollector_init();
 
 void nsCycleCollector_startup();
 
 typedef void (*CC_BeforeUnlinkCallback)(void);
 void nsCycleCollector_setBeforeUnlinkCallback(CC_BeforeUnlinkCallback aCB);
@@ -52,18 +52,18 @@ void nsCycleCollector_collectSlice(js::S
 
 uint32_t nsCycleCollector_suspectedCount();
 
 // If aDoCollect is true, then run the GC and CC a few times before
 // shutting down the CC completely.
 void nsCycleCollector_shutdown(bool aDoCollect = true);
 
 // Helpers for interacting with JS
-void nsCycleCollector_registerJSRuntime(mozilla::CycleCollectedJSRuntime* aRt);
-void nsCycleCollector_forgetJSRuntime();
+void nsCycleCollector_registerJSContext(mozilla::CycleCollectedJSContext* aCx);
+void nsCycleCollector_forgetJSContext();
 
 #define NS_CYCLE_COLLECTOR_LOGGER_CID \
 { 0x58be81b4, 0x39d2, 0x437c, \
 { 0x94, 0xea, 0xae, 0xde, 0x2c, 0x62, 0x08, 0xd3 } }
 
 extern nsresult
 nsCycleCollectorLoggerConstructor(nsISupports* aOuter,
                                   const nsIID& aIID,
--- a/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp
+++ b/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp
@@ -12,17 +12,17 @@
 #include "jsapi.h"
 #include "nsTArray.h"
 
 #include "gtest/gtest.h"
 
 #include "js/TracingAPI.h"
 #include "js/HeapAPI.h"
 
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 
 using namespace JS;
 using namespace mozilla;
 
 template<class ArrayT>
 static void
 TraceArray(JSTracer* trc, void* data)
 {
@@ -122,19 +122,19 @@ CreateGlobalAndRunTest(JSContext* cx)
     AutoTArray<ElementT, InitialElements> array;
     RunTest(cx, &array);
   }
 
   JS_LeaveCompartment(cx, oldCompartment);
 }
 
 TEST(GCPostBarriers, nsTArray) {
-  CycleCollectedJSRuntime* ccrt = CycleCollectedJSRuntime::Get();
-  ASSERT_TRUE(ccrt != nullptr);
-  JSContext* cx = ccrt->Context();
+  CycleCollectedJSContext* ccjscx = CycleCollectedJSContext::Get();
+  ASSERT_TRUE(ccjscx != nullptr);
+  JSContext* cx = ccjscx->Context();
   ASSERT_TRUE(cx != nullptr);
 
   JS_BeginRequest(cx);
 
   CreateGlobalAndRunTest(cx);
 
   JS_EndRequest(cx);
 }
--- a/xpcom/threads/nsThread.cpp
+++ b/xpcom/threads/nsThread.cpp
@@ -16,17 +16,17 @@
 #include "mozilla/ReentrantMonitor.h"
 #include "nsMemoryPressure.h"
 #include "nsThreadManager.h"
 #include "nsIClassInfoImpl.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsQueryObject.h"
 #include "pratom.h"
-#include "mozilla/CycleCollectedJSRuntime.h"
+#include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/Logging.h"
 #include "nsIObserverService.h"
 #include "mozilla/HangMonitor.h"
 #include "mozilla/IOInterposer.h"
 #include "mozilla/ipc/MessageChannel.h"
 #include "mozilla/ipc/BackgroundChild.h"
 #include "mozilla/Services.h"
 #include "nsXPCOMPrivate.h"
@@ -1255,17 +1255,17 @@ nsThread::PopEventQueue(nsIEventTarget* 
     queue->mEventTarget.swap(target);
     target->mQueue = nullptr;
   }
 
   return NS_OK;
 }
 
 void
-nsThread::SetScriptObserver(mozilla::CycleCollectedJSRuntime* aScriptObserver)
+nsThread::SetScriptObserver(mozilla::CycleCollectedJSContext* aScriptObserver)
 {
   if (!aScriptObserver) {
     mScriptObserver = nullptr;
     return;
   }
 
   MOZ_ASSERT(!mScriptObserver);
   mScriptObserver = aScriptObserver;
--- a/xpcom/threads/nsThread.h
+++ b/xpcom/threads/nsThread.h
@@ -15,17 +15,17 @@
 #include "nsString.h"
 #include "nsTObserverArray.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/NotNull.h"
 #include "nsAutoPtr.h"
 #include "mozilla/AlreadyAddRefed.h"
 
 namespace mozilla {
-class CycleCollectedJSRuntime;
+class CycleCollectedJSContext;
 }
 
 using mozilla::NotNull;
 
 // A native thread
 class nsThread
   : public nsIThreadInternal
   , public nsISupportsPriority
@@ -67,17 +67,17 @@ public:
 
   // Clear the observer list.
   void ClearObservers()
   {
     mEventObservers.Clear();
   }
 
   void
-  SetScriptObserver(mozilla::CycleCollectedJSRuntime* aScriptObserver);
+  SetScriptObserver(mozilla::CycleCollectedJSContext* aScriptObserver);
 
   uint32_t
   RecursionDepth() const;
 
   void ShutdownComplete(NotNull<struct nsThreadShutdownContext*> aContext);
 
   void WaitForAllAsynchronousShutdowns();
 
@@ -195,17 +195,17 @@ protected:
   // This lock protects access to mObserver, mEvents and mEventsAreDoomed.
   // All of those fields are only modified on the thread itself (never from
   // another thread).  This means that we can avoid holding the lock while
   // using mObserver and mEvents on the thread itself.  When calling PutEvent
   // on mEvents, we have to hold the lock to synchronize with PopEventQueue.
   mozilla::Mutex mLock;
 
   nsCOMPtr<nsIThreadObserver> mObserver;
-  mozilla::CycleCollectedJSRuntime* mScriptObserver;
+  mozilla::CycleCollectedJSContext* mScriptObserver;
 
   // Only accessed on the target thread.
   nsAutoTObserverArray<NotNull<nsCOMPtr<nsIThreadObserver>>, 2> mEventObservers;
 
   NotNull<nsChainedEventQueue*> mEvents;  // never null
   nsChainedEventQueue mEventsRoot;
 
   int32_t   mPriority;