Bug 1607791 - Get rid of IDBMutableFile.getFile() - part 3 - Rename SameProcessDifferentThread to SameProcess, r=asuth,sfink
☠☠ backed out by 0bb7d3150587 ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 15 Jan 2020 09:59:16 +0000
changeset 510326 4c92f506cf62ca943a9ab14946e065e6ba28b4f3
parent 510325 80707bcc8427414d0c793e316e26ae700da863b9
child 510327 f15835338319b31529057f4e64b5310d906576de
push id37020
push userccoroiu@mozilla.com
push dateWed, 15 Jan 2020 21:36:21 +0000
treeherdermozilla-central@c35bb210b8ae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth, sfink
bugs1607791
milestone74.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 1607791 - Get rid of IDBMutableFile.getFile() - part 3 - Rename SameProcessDifferentThread to SameProcess, r=asuth,sfink Differential Revision: https://phabricator.services.mozilla.com/D59142
dom/base/PostMessageEvent.h
dom/base/SerializedStackHolder.cpp
dom/base/StructuredCloneHolder.cpp
dom/base/StructuredCloneHolder.h
dom/media/webaudio/AudioWorkletNode.cpp
dom/workers/MessageEventRunnable.cpp
dom/xhr/XMLHttpRequestWorker.cpp
js/public/StructuredClone.h
js/src/builtin/TestingFunctions.cpp
js/src/jsapi-tests/testMappedArrayBuffer.cpp
js/src/jsapi-tests/testStructuredClone.cpp
js/src/tests/non262/extensions/clone-errors.js
js/src/tests/non262/extensions/clone-transferables.js
js/src/vm/StructuredClone.cpp
--- a/dom/base/PostMessageEvent.h
+++ b/dom/base/PostMessageEvent.h
@@ -55,17 +55,17 @@ class PostMessageEvent final : public Ru
                          aIsFromPrivateWindow, Nothing()) {}
 
   void Write(JSContext* aCx, JS::Handle<JS::Value> aMessage,
              JS::Handle<JS::Value> aTransfer, JS::CloneDataPolicy aClonePolicy,
              ErrorResult& aError) {
     mHolder.construct<StructuredCloneHolder>(
         StructuredCloneHolder::CloningSupported,
         StructuredCloneHolder::TransferringSupported,
-        JS::StructuredCloneScope::SameProcessDifferentThread);
+        JS::StructuredCloneScope::SameProcess);
     mHolder.ref<StructuredCloneHolder>().Write(aCx, aMessage, aTransfer,
                                                aClonePolicy, aError);
   }
   void UnpackFrom(const ClonedMessageData& aMessageData) {
     mHolder.construct<ipc::StructuredCloneData>();
     // FIXME Want to steal!
     //       See https://bugzilla.mozilla.org/show_bug.cgi?id=1516349.
     mHolder.ref<ipc::StructuredCloneData>().CopyFromClonedMessageDataForChild(
--- a/dom/base/SerializedStackHolder.cpp
+++ b/dom/base/SerializedStackHolder.cpp
@@ -10,18 +10,17 @@
 #include "mozilla/dom/WorkerPrivate.h"
 
 namespace mozilla {
 namespace dom {
 
 SerializedStackHolder::SerializedStackHolder()
     : mHolder(StructuredCloneHolder::CloningSupported,
               StructuredCloneHolder::TransferringNotSupported,
-              StructuredCloneHolder::StructuredCloneScope::
-                  SameProcessDifferentThread) {}
+              StructuredCloneHolder::StructuredCloneScope::SameProcess) {}
 
 void SerializedStackHolder::WriteStack(JSContext* aCx,
                                        JS::HandleObject aStack) {
   JS::RootedValue stackValue(aCx, JS::ObjectValue(*aStack));
   mHolder.Write(aCx, stackValue, IgnoreErrors());
 
   // StructuredCloneHolder::Write can leave a pending exception on the context.
   JS_ClearPendingException(aCx);
--- a/dom/base/StructuredCloneHolder.cpp
+++ b/dom/base/StructuredCloneHolder.cpp
@@ -784,38 +784,36 @@ bool WriteFormData(JSStructuredCloneWrit
   };
   Closure closure(aWriter, aHolder);
   return aFormData->ForEach(Closure::Write, &closure);
 }
 
 JSObject* ReadWasmModule(JSContext* aCx, uint32_t aIndex,
                          StructuredCloneHolder* aHolder) {
   MOZ_ASSERT(aHolder);
-  MOZ_ASSERT(
-      aHolder->CloneScope() ==
-      StructuredCloneHolder::StructuredCloneScope::SameProcessDifferentThread);
+  MOZ_ASSERT(aHolder->CloneScope() ==
+             StructuredCloneHolder::StructuredCloneScope::SameProcess);
 #ifdef FUZZING
   if (aIndex >= aHolder->WasmModules().Length()) {
     return nullptr;
   }
 #endif
   MOZ_ASSERT(aIndex < aHolder->WasmModules().Length());
 
   return aHolder->WasmModules()[aIndex]->createObject(aCx);
 }
 
 bool WriteWasmModule(JSStructuredCloneWriter* aWriter,
                      JS::WasmModule* aWasmModule,
                      StructuredCloneHolder* aHolder) {
   MOZ_ASSERT(aWriter);
   MOZ_ASSERT(aWasmModule);
   MOZ_ASSERT(aHolder);
-  MOZ_ASSERT(
-      aHolder->CloneScope() ==
-      StructuredCloneHolder::StructuredCloneScope::SameProcessDifferentThread);
+  MOZ_ASSERT(aHolder->CloneScope() ==
+             StructuredCloneHolder::StructuredCloneScope::SameProcess);
 
   // We store the position of the wasmModule in the array as index.
   if (JS_WriteUint32Pair(aWriter, SCTAG_DOM_WASM,
                          aHolder->WasmModules().Length())) {
     aHolder->WasmModules().AppendElement(aWasmModule);
     return true;
   }
 
@@ -881,36 +879,34 @@ JSObject* StructuredCloneHolder::CustomR
     return ReadFileList(aCx, aReader, aIndex, this);
   }
 
   if (aTag == SCTAG_DOM_FORMDATA) {
     return ReadFormData(aCx, aReader, aIndex, this);
   }
 
   if (aTag == SCTAG_DOM_IMAGEBITMAP &&
-      mStructuredCloneScope ==
-          StructuredCloneScope::SameProcessDifferentThread) {
+      mStructuredCloneScope == StructuredCloneScope::SameProcess) {
     // Get the current global object.
     // This can be null.
     JS::RootedObject result(aCx);
     {
       // aIndex is the index of the cloned image.
       result = ImageBitmap::ReadStructuredClone(aCx, aReader, mGlobal,
                                                 GetSurfaces(), aIndex);
     }
     return result;
   }
 
   if (aTag == SCTAG_DOM_STRUCTURED_CLONE_HOLDER) {
     return StructuredCloneBlob::ReadStructuredClone(aCx, aReader, this);
   }
 
   if (aTag == SCTAG_DOM_WASM &&
-      mStructuredCloneScope ==
-          StructuredCloneScope::SameProcessDifferentThread) {
+      mStructuredCloneScope == StructuredCloneScope::SameProcess) {
     return ReadWasmModule(aCx, aIndex, this);
   }
 
   if (aTag == SCTAG_DOM_INPUTSTREAM) {
     return ReadInputStream(aCx, aIndex, this);
   }
 
   if (aTag == SCTAG_DOM_BROWSING_CONTEXT) {
@@ -961,54 +957,51 @@ bool StructuredCloneHolder::CustomWriteH
   {
     FormData* formData = nullptr;
     if (NS_SUCCEEDED(UNWRAP_OBJECT(FormData, &obj, formData))) {
       return WriteFormData(aWriter, formData, this);
     }
   }
 
   // See if this is an ImageBitmap object.
-  if (mStructuredCloneScope ==
-      StructuredCloneScope::SameProcessDifferentThread) {
+  if (mStructuredCloneScope == StructuredCloneScope::SameProcess) {
     ImageBitmap* imageBitmap = nullptr;
     if (NS_SUCCEEDED(UNWRAP_OBJECT(ImageBitmap, &obj, imageBitmap))) {
       return ImageBitmap::WriteStructuredClone(aWriter, GetSurfaces(),
                                                imageBitmap);
     }
   }
 
   // See if this is a StructuredCloneBlob object.
   {
     StructuredCloneBlob* holder = nullptr;
     if (NS_SUCCEEDED(UNWRAP_OBJECT(StructuredCloneHolder, &obj, holder))) {
       return holder->WriteStructuredClone(aCx, aWriter, this);
     }
   }
 
   // See if this is a BrowsingContext object.
-  if (mStructuredCloneScope ==
-          StructuredCloneScope::SameProcessDifferentThread ||
+  if (mStructuredCloneScope == StructuredCloneScope::SameProcess ||
       mStructuredCloneScope == StructuredCloneScope::DifferentProcess) {
     BrowsingContext* holder = nullptr;
     if (NS_SUCCEEDED(UNWRAP_OBJECT(BrowsingContext, &obj, holder))) {
       return holder->WriteStructuredClone(aCx, aWriter, this);
     }
   }
 
   // See if this is a ClonedErrorHolder object.
   {
     ClonedErrorHolder* holder = nullptr;
     if (NS_SUCCEEDED(UNWRAP_OBJECT(ClonedErrorHolder, &obj, holder))) {
       return holder->WriteStructuredClone(aCx, aWriter, this);
     }
   }
 
   // See if this is a WasmModule.
-  if (mStructuredCloneScope ==
-          StructuredCloneScope::SameProcessDifferentThread &&
+  if (mStructuredCloneScope == StructuredCloneScope::SameProcess &&
       JS::IsWasmModuleObject(obj)) {
     RefPtr<JS::WasmModule> module = JS::GetWasmModule(obj);
     MOZ_ASSERT(module);
 
     return WriteWasmModule(aWriter, module, this);
   }
 
   {
@@ -1053,18 +1046,17 @@ bool StructuredCloneHolder::CustomReadTr
       return false;
     }
 
     aReturnObject.set(&value.toObject());
     return true;
   }
 
   if (aTag == SCTAG_DOM_CANVAS &&
-      mStructuredCloneScope ==
-          StructuredCloneScope::SameProcessDifferentThread) {
+      mStructuredCloneScope == StructuredCloneScope::SameProcess) {
     MOZ_ASSERT(aContent);
     OffscreenCanvasCloneData* data =
         static_cast<OffscreenCanvasCloneData*>(aContent);
     RefPtr<OffscreenCanvas> canvas =
         OffscreenCanvas::CreateFromCloneData(mGlobal, data);
     delete data;
 
     JS::Rooted<JS::Value> value(aCx);
@@ -1073,18 +1065,17 @@ bool StructuredCloneHolder::CustomReadTr
       return false;
     }
 
     aReturnObject.set(&value.toObject());
     return true;
   }
 
   if (aTag == SCTAG_DOM_IMAGEBITMAP &&
-      mStructuredCloneScope ==
-          StructuredCloneScope::SameProcessDifferentThread) {
+      mStructuredCloneScope == StructuredCloneScope::SameProcess) {
     MOZ_ASSERT(aContent);
     ImageBitmapCloneData* data = static_cast<ImageBitmapCloneData*>(aContent);
     RefPtr<ImageBitmap> bitmap =
         ImageBitmap::CreateFromCloneData(mGlobal, data);
     delete data;
 
     JS::Rooted<JS::Value> value(aCx);
     if (!GetOrCreateDOMReflector(aCx, bitmap, &value)) {
@@ -1126,18 +1117,17 @@ bool StructuredCloneHolder::CustomWriteT
 
       *aTag = SCTAG_DOM_MAP_MESSAGEPORT;
       *aOwnership = JS::SCTAG_TMO_CUSTOM;
       *aContent = nullptr;
 
       return true;
     }
 
-    if (mStructuredCloneScope ==
-        StructuredCloneScope::SameProcessDifferentThread) {
+    if (mStructuredCloneScope == StructuredCloneScope::SameProcess) {
       OffscreenCanvas* canvas = nullptr;
       rv = UNWRAP_OBJECT(OffscreenCanvas, &obj, canvas);
       if (NS_SUCCEEDED(rv)) {
         MOZ_ASSERT(canvas);
 
         if (canvas->IsNeutered()) {
           return false;
         }
@@ -1191,28 +1181,26 @@ void StructuredCloneHolder::CustomFreeTr
     }
 #endif
     MOZ_ASSERT(aExtraData < mPortIdentifiers.Length());
     MessagePort::ForceClose(mPortIdentifiers[aExtraData]);
     return;
   }
 
   if (aTag == SCTAG_DOM_CANVAS &&
-      mStructuredCloneScope ==
-          StructuredCloneScope::SameProcessDifferentThread) {
+      mStructuredCloneScope == StructuredCloneScope::SameProcess) {
     MOZ_ASSERT(aContent);
     OffscreenCanvasCloneData* data =
         static_cast<OffscreenCanvasCloneData*>(aContent);
     delete data;
     return;
   }
 
   if (aTag == SCTAG_DOM_IMAGEBITMAP &&
-      mStructuredCloneScope ==
-          StructuredCloneScope::SameProcessDifferentThread) {
+      mStructuredCloneScope == StructuredCloneScope::SameProcess) {
     MOZ_ASSERT(aContent);
     ImageBitmapCloneData* data = static_cast<ImageBitmapCloneData*>(aContent);
     delete data;
     return;
   }
 }
 
 bool StructuredCloneHolder::CustomCanTransferHandler(
@@ -1225,18 +1213,17 @@ bool StructuredCloneHolder::CustomCanTra
 
   {
     MessagePort* port = nullptr;
     nsresult rv = UNWRAP_OBJECT(MessagePort, &obj, port);
     if (NS_SUCCEEDED(rv)) {
       return true;
     }
 
-    if (mStructuredCloneScope ==
-        StructuredCloneScope::SameProcessDifferentThread) {
+    if (mStructuredCloneScope == StructuredCloneScope::SameProcess) {
       OffscreenCanvas* canvas = nullptr;
       rv = UNWRAP_OBJECT(OffscreenCanvas, &obj, canvas);
       if (NS_SUCCEEDED(rv)) {
         return true;
       }
 
       ImageBitmap* bitmap = nullptr;
       rv = UNWRAP_OBJECT(ImageBitmap, &obj, bitmap);
--- a/dom/base/StructuredCloneHolder.h
+++ b/dom/base/StructuredCloneHolder.h
@@ -34,18 +34,17 @@ class DataSourceSurface;
 
 namespace dom {
 
 class StructuredCloneHolderBase {
  public:
   typedef JS::StructuredCloneScope StructuredCloneScope;
 
   StructuredCloneHolderBase(
-      StructuredCloneScope aScope =
-          StructuredCloneScope::SameProcessDifferentThread);
+      StructuredCloneScope aScope = StructuredCloneScope::SameProcess);
   virtual ~StructuredCloneHolderBase();
 
   // Note, it is unsafe to std::move() a StructuredCloneHolderBase since a raw
   // this pointer is passed to mBuffer as a callback closure.  That must
   // be fixed if you want to implement a move constructor here.
   StructuredCloneHolderBase(StructuredCloneHolderBase&& aOther) = delete;
 
   // These methods should be implemented in order to clone data.
--- a/dom/media/webaudio/AudioWorkletNode.cpp
+++ b/dom/media/webaudio/AudioWorkletNode.cpp
@@ -515,17 +515,17 @@ already_AddRefed<AudioWorkletNode> Audio
    *    StructuredSerialize(optionsObject).
    */
   // StructuredCloneHolder does not have a move constructor.  Instead allocate
   // memory so that the pointer can be passed to the rendering thread.
   UniquePtr<StructuredCloneHolder> serializedOptions =
       MakeUnique<StructuredCloneHolder>(
           StructuredCloneHolder::CloningSupported,
           StructuredCloneHolder::TransferringNotSupported,
-          JS::StructuredCloneScope::SameProcessDifferentThread);
+          JS::StructuredCloneScope::SameProcess);
   serializedOptions->Write(cx, optionsVal, aRv);
   if (NS_WARN_IF(aRv.Failed())) {
     return nullptr;
   }
   /**
    * 10. Set node’s port to nodePort.
    */
   audioWorkletNode->mPort = messageChannel->Port1();
--- a/dom/workers/MessageEventRunnable.cpp
+++ b/dom/workers/MessageEventRunnable.cpp
@@ -16,17 +16,17 @@
 
 namespace mozilla {
 namespace dom {
 
 MessageEventRunnable::MessageEventRunnable(WorkerPrivate* aWorkerPrivate,
                                            TargetAndBusyBehavior aBehavior)
     : WorkerDebuggeeRunnable(aWorkerPrivate, aBehavior),
       StructuredCloneHolder(CloningSupported, TransferringSupported,
-                            StructuredCloneScope::SameProcessDifferentThread) {}
+                            StructuredCloneScope::SameProcess) {}
 
 bool MessageEventRunnable::DispatchDOMEvent(JSContext* aCx,
                                             WorkerPrivate* aWorkerPrivate,
                                             DOMEventTargetHelper* aTarget,
                                             bool aIsMainThread) {
   nsCOMPtr<nsIGlobalObject> parent = aTarget->GetParentObject();
 
   // For some workers without window, parent is null and we try to find it
--- a/dom/xhr/XMLHttpRequestWorker.cpp
+++ b/dom/xhr/XMLHttpRequestWorker.cpp
@@ -232,17 +232,17 @@ class SendRunnable final : public Worker
   nsCOMPtr<nsIEventTarget> mSyncLoopTarget;
   bool mHasUploadListeners;
 
  public:
   SendRunnable(WorkerPrivate* aWorkerPrivate, Proxy* aProxy,
                const nsAString& aStringBody)
       : WorkerThreadProxySyncRunnable(aWorkerPrivate, aProxy),
         StructuredCloneHolder(CloningSupported, TransferringNotSupported,
-                              StructuredCloneScope::SameProcessDifferentThread),
+                              StructuredCloneScope::SameProcess),
         mStringBody(aStringBody),
         mHasUploadListeners(false) {}
 
   void SetHaveUploadListeners(bool aHasUploadListeners) {
     mHasUploadListeners = aHasUploadListeners;
   }
 
   void SetSyncLoopTarget(nsIEventTarget* aSyncLoopTarget) {
--- a/js/public/StructuredClone.h
+++ b/js/public/StructuredClone.h
@@ -132,17 +132,17 @@ enum class StructuredCloneScope : uint32
    * using this API (otherwise, the serialized data may contain bogus
    * pointers, leading to undefined behavior).
    *
    * Starts from 1 because there used to be a SameProcessSameThread enum value
    * of 0 and these values are encoded into the structured serialization format
    * as part of the SCTAG_HEADER, and IndexedDB persists the representation to
    * disk.
    */
-  SameProcessDifferentThread = 1,
+  SameProcess = 1,
 
   /**
    * When writing, this means we're writing for an audience in a different
    * process. Produce serialized data that can be sent to other processes,
    * bitwise copied, or even stored as bytes in a database and read by later
    * versions of Firefox years from now. The HTML5 spec refers to this as
    * "ForStorage" as in StructuredSerializeForStorage, though we use
    * DifferentProcess for IPC as well as storage.
@@ -151,18 +151,18 @@ enum class StructuredCloneScope : uint32
    * copied into the serialized data (rather than just writing a pointer).
    *
    * When reading, this means: Do not accept pointers.
    */
   DifferentProcess,
 
   /**
    * Handle a backwards-compatibility case with IndexedDB (bug 1434308): when
-   * reading, this means to treat legacy SameProcessDifferentThread data as if
-   * it were DifferentProcess.
+   * reading, this means to treat legacy SameProcess data as if it were
+   * DifferentProcess.
    *
    * Do not use this for writing; use DifferentProcess instead.
    */
   DifferentProcessForIndexedDB,
 
   /**
    * Existing code wants to be able to create an uninitialized
    * JSStructuredCloneData without knowing the scope, then populate it with
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -3376,18 +3376,18 @@ static mozilla::Maybe<JS::StructuredClon
     JSContext* cx, HandleString str) {
   mozilla::Maybe<JS::StructuredCloneScope> scope;
 
   JSLinearString* scopeStr = str->ensureLinear(cx);
   if (!scopeStr) {
     return scope;
   }
 
-  if (StringEqualsLiteral(scopeStr, "SameProcessDifferentThread")) {
-    scope.emplace(JS::StructuredCloneScope::SameProcessDifferentThread);
+  if (StringEqualsLiteral(scopeStr, "SameProcess")) {
+    scope.emplace(JS::StructuredCloneScope::SameProcess);
   } else if (StringEqualsLiteral(scopeStr, "DifferentProcess")) {
     scope.emplace(JS::StructuredCloneScope::DifferentProcess);
   } else if (StringEqualsLiteral(scopeStr, "DifferentProcessForIndexedDB")) {
     scope.emplace(JS::StructuredCloneScope::DifferentProcessForIndexedDB);
   }
 
   return scope;
 }
@@ -3443,18 +3443,17 @@ bool js::testingFunc_serialize(JSContext
         JS_ReportErrorASCII(cx, "Invalid structured clone scope");
         return false;
       }
       clonebuf.emplace(*scope, nullptr, nullptr);
     }
   }
 
   if (!clonebuf) {
-    clonebuf.emplace(JS::StructuredCloneScope::SameProcessDifferentThread,
-                     nullptr, nullptr);
+    clonebuf.emplace(JS::StructuredCloneScope::SameProcess, nullptr, nullptr);
   }
 
   if (!clonebuf->write(cx, args.get(0), args.get(1), policy)) {
     return false;
   }
 
   RootedObject obj(cx, CloneBufferObject::Create(cx, clonebuf.ptr()));
   if (!obj) {
@@ -3473,17 +3472,17 @@ static bool Deserialize(JSContext* cx, u
     return false;
   }
   Rooted<CloneBufferObject*> obj(cx,
                                  &args[0].toObject().as<CloneBufferObject>());
 
   JS::CloneDataPolicy policy;
   JS::StructuredCloneScope scope =
       obj->isSynthetic() ? JS::StructuredCloneScope::DifferentProcess
-                         : JS::StructuredCloneScope::SameProcessDifferentThread;
+                         : JS::StructuredCloneScope::SameProcess;
   if (args.get(1).isObject()) {
     RootedObject opts(cx, &args[1].toObject());
     if (!opts) {
       return false;
     }
 
     RootedValue v(cx);
     if (!JS_GetProperty(cx, opts, "SharedArrayBuffer", &v)) {
@@ -6738,34 +6737,34 @@ gc::ZealModeHelpText),
 "  (wasm) programs."),
 
     JS_FN_HELP("serialize", testingFunc_serialize, 1, 0,
 "serialize(data, [transferables, [policy]])",
 "  Serialize 'data' using JS_WriteStructuredClone. Returns a structured\n"
 "  clone buffer object. 'policy' may be an options hash. Valid keys:\n"
 "    'SharedArrayBuffer' - either 'allow' or 'deny' (the default)\n"
 "      to specify whether SharedArrayBuffers may be serialized.\n"
-"    'scope' - SameProcessDifferentThread, DifferentProcess, or\n"
+"    'scope' - SameProcess, DifferentProcess, or\n"
 "      DifferentProcessForIndexedDB. Determines how some values will be\n"
 "      serialized. Clone buffers may only be deserialized with a compatible\n"
 "      scope. NOTE - For DifferentProcess/DifferentProcessForIndexedDB,\n"
 "      must also set SharedArrayBuffer:'deny' if data contains any shared memory\n"
 "      object."),
 
     JS_FN_HELP("deserialize", Deserialize, 1, 0,
 "deserialize(clonebuffer[, opts])",
 "  Deserialize data generated by serialize. 'opts' may be an options hash.\n"
 "  Valid keys:\n"
 "    'SharedArrayBuffer' - either 'allow' or 'deny' (the default)\n"
 "      to specify whether SharedArrayBuffers may be serialized.\n"
 "    'scope', which limits the clone buffers that are considered\n"
-"  valid. Allowed values: ''SameProcessDifferentThread', 'DifferentProcess',\n"
+"  valid. Allowed values: ''SameProcess', 'DifferentProcess',\n"
 "  and 'DifferentProcessForIndexedDB'. So for example, a\n"
 "  DifferentProcessForIndexedDB clone buffer may be deserialized in any scope, but\n"
-"  a SameProcessDifferentThread clone buffer cannot be deserialized in a\n"
+"  a SameProcess clone buffer cannot be deserialized in a\n"
 "  DifferentProcess scope."),
 
     JS_FN_HELP("detachArrayBuffer", DetachArrayBuffer, 1, 0,
 "detachArrayBuffer(buffer)",
 "  Detach the given ArrayBuffer object from its memory, i.e. as if it\n"
 "  had been transferred to a WebWorker."),
 
     JS_FN_HELP("helperThreadCount", HelperThreadCount, 0, 0,
--- a/js/src/jsapi-tests/testMappedArrayBuffer.cpp
+++ b/js/src/jsapi-tests/testMappedArrayBuffer.cpp
@@ -129,17 +129,17 @@ bool TestDetachObject() {
 
   return true;
 }
 
 bool TestCloneObject() {
   JS::RootedObject obj1(cx, CreateNewObject(8, 12));
   CHECK(obj1);
   JSAutoStructuredCloneBuffer cloned_buffer(
-      JS::StructuredCloneScope::SameProcessDifferentThread, nullptr, nullptr);
+      JS::StructuredCloneScope::SameProcess, nullptr, nullptr);
   JS::RootedValue v1(cx, JS::ObjectValue(*obj1));
   CHECK(cloned_buffer.write(cx, v1, nullptr, nullptr));
   JS::RootedValue v2(cx);
   CHECK(cloned_buffer.read(cx, &v2, JS::CloneDataPolicy(), nullptr, nullptr));
   JS::RootedObject obj2(cx, v2.toObjectOrNull());
   CHECK(VerifyObject(obj2, 8, 12, false));
 
   return true;
@@ -168,17 +168,17 @@ bool TestTransferObject() {
   }
 
   JS::RootedObject obj(
       cx, JS::NewArrayObject(cx, JS::HandleValueArray::subarray(argv, 0, 1)));
   CHECK(obj);
   JS::RootedValue transferable(cx, JS::ObjectValue(*obj));
 
   JSAutoStructuredCloneBuffer cloned_buffer(
-      JS::StructuredCloneScope::SameProcessDifferentThread, nullptr, nullptr);
+      JS::StructuredCloneScope::SameProcess, nullptr, nullptr);
   JS::CloneDataPolicy policy;
   CHECK(cloned_buffer.write(cx, v1, transferable, policy, nullptr, nullptr));
   JS::RootedValue v2(cx);
   CHECK(cloned_buffer.read(cx, &v2, policy, nullptr, nullptr));
   JS::RootedObject obj2(cx, v2.toObjectOrNull());
   CHECK(VerifyObject(obj2, 8, 12, true));
   CHECK(JS::IsDetachedArrayBufferObject(obj1));
 
--- a/js/src/jsapi-tests/testStructuredClone.cpp
+++ b/js/src/jsapi-tests/testStructuredClone.cpp
@@ -132,18 +132,17 @@ BEGIN_TEST(testStructuredClone_externalA
 
   CHECK(data.wasFreed());
 
   return true;
 }
 END_TEST(testStructuredClone_externalArrayBuffer)
 
 BEGIN_TEST(testStructuredClone_externalArrayBufferDifferentThreadOrProcess) {
-  CHECK(testStructuredCloneCopy(
-      JS::StructuredCloneScope::SameProcessDifferentThread));
+  CHECK(testStructuredCloneCopy(JS::StructuredCloneScope::SameProcess));
   CHECK(testStructuredCloneCopy(JS::StructuredCloneScope::DifferentProcess));
   return true;
 }
 
 bool testStructuredCloneCopy(JS::StructuredCloneScope scope) {
   ExternalData data("One two three four");
   JS::RootedObject buffer(
       cx, JS::NewExternalArrayBuffer(cx, data.len(), data.contents(),
--- a/js/src/tests/non262/extensions/clone-errors.js
+++ b/js/src/tests/non262/extensions/clone-errors.js
@@ -18,18 +18,18 @@ check(this);
 check(Math);
 check(function () {});
 check(new Proxy({}, {}));
 
 // A failing getter.
 check({get x() { throw new Error("fail"); }});
 
 // Mismatched scopes.
-for (let [write_scope, read_scope] of [['SameProcessDifferentThread', 'DifferentProcessForIndexedDB'],
-                                       ['SameProcessDifferentThread', 'DifferentProcess']])
+for (let [write_scope, read_scope] of [['SameProcess', 'DifferentProcessForIndexedDB'],
+                                       ['SameProcess', 'DifferentProcess']])
 {
   var ab = new ArrayBuffer(12);
   var buffer = serialize(ab, [ab], { scope: write_scope });
   var caught = false;
   try {
     deserialize(buffer, { scope: read_scope });
   } catch (exc) {
     caught = true;
--- a/js/src/tests/non262/extensions/clone-transferables.js
+++ b/js/src/tests/non262/extensions/clone-transferables.js
@@ -1,14 +1,14 @@
 // |reftest| skip-if(!xulRuntime.shell)
 // Any copyright is dedicated to the Public Domain.
 // http://creativecommons.org/licenses/publicdomain/
 
 function* buffer_options() {
-    for (var scope of ["SameProcessDifferentThread",
+    for (var scope of ["SameProcess",
                        "DifferentProcess",
                        "DifferentProcessForIndexedDB"])
     {
         for (var size of [0, 8, 16, 200, 1000, 4096, 8192, 65536]) {
             yield { scope, size };
         }
     }
 }
--- a/js/src/vm/StructuredClone.cpp
+++ b/js/src/vm/StructuredClone.cpp
@@ -423,17 +423,17 @@ struct JSStructuredCloneReader {
   MOZ_MUST_USE bool readV1ArrayBuffer(uint32_t arrayType, uint32_t nelems,
                                       MutableHandleValue vp);
   JSObject* readSavedFrame(uint32_t principalsTag);
   MOZ_MUST_USE bool startRead(MutableHandleValue vp);
 
   SCInput& in;
 
   // The widest scope that the caller will accept, where
-  // SameProcessDifferentThread is the widest (it can store anything it wants)
+  // SameProcess is the widest (it can store anything it wants)
   // and DifferentProcess is the narrowest (it cannot contain pointers and must
   // be valid cross-process.)
   JS::StructuredCloneScope allowedScope;
 
   const JS::CloneDataPolicy cloneDataPolicy;
 
   // Stack of objects with properties remaining to be read.
   RootedValueVector objs;
@@ -1262,17 +1262,17 @@ bool JSStructuredCloneWriter::writeShare
                               "SharedArrayBuffer");
     return false;
   }
 
   // We must not transmit SAB pointers (including for WebAssembly.Memory)
   // cross-process.  The cloneDataPolicy should have guarded against this;
   // since it did not then throw, with a very explicit message.
 
-  if (output().scope() > JS::StructuredCloneScope::SameProcessDifferentThread) {
+  if (output().scope() > JS::StructuredCloneScope::SameProcess) {
     JS_ReportErrorNumberASCII(context(), GetErrorMessage, nullptr,
                               JSMSG_SC_SHMEM_POLICY);
     return false;
   }
 
   Rooted<SharedArrayBufferObject*> sharedArrayBuffer(
       context(), obj->maybeUnwrapAs<SharedArrayBufferObject>());
   SharedArrayRawBuffer* rawbuf = sharedArrayBuffer->rawBufferObject();
@@ -2653,20 +2653,20 @@ bool JSStructuredCloneReader::readHeader
   } else {
     // Old structured clone buffer. We must have read it from disk.
     storedScope = JS::StructuredCloneScope::DifferentProcessForIndexedDB;
   }
 
   // Backward compatibility with old structured clone buffers. Value '0' was
   // used for SameProcessSameThread scope.
   if ((int)storedScope == 0) {
-    storedScope = JS::StructuredCloneScope::SameProcessDifferentThread;
+    storedScope = JS::StructuredCloneScope::SameProcess;
   }
 
-  if (storedScope < JS::StructuredCloneScope::SameProcessDifferentThread ||
+  if (storedScope < JS::StructuredCloneScope::SameProcess ||
       storedScope > JS::StructuredCloneScope::DifferentProcessForIndexedDB) {
     JS_ReportErrorNumberASCII(context(), GetErrorMessage, nullptr,
                               JSMSG_SC_BAD_SERIALIZED_DATA,
                               "invalid structured clone scope");
     return false;
   }
 
   if (allowedScope == JS::StructuredCloneScope::DifferentProcessForIndexedDB) {
@@ -3085,18 +3085,18 @@ JS_PUBLIC_API bool JS_StructuredClone(
       return false;
     }
     vp.setString(strValue);
     return true;
   }
 
   const JSStructuredCloneCallbacks* callbacks = optionalCallbacks;
 
-  JSAutoStructuredCloneBuffer buf(
-      JS::StructuredCloneScope::SameProcessDifferentThread, callbacks, closure);
+  JSAutoStructuredCloneBuffer buf(JS::StructuredCloneScope::SameProcess,
+                                  callbacks, closure);
   {
     if (value.isObject()) {
       RootedObject obj(cx, &value.toObject());
       obj = CheckedUnwrapStatic(obj);
       if (!obj) {
         ReportAccessDenied(cx);
         return false;
       }