Bug 1607791 - Get rid of IDBMutableFile.getFile() - part 3 - Rename SameProcessDifferentThread to SameProcess, r=asuth,sfink

Differential Revision: https://phabricator.services.mozilla.com/D59142

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrea Marchesini 2020-01-15 09:59:16 +00:00
Родитель 3cd17a373a
Коммит 6d6aa4cc66
14 изменённых файлов: 43 добавлений и 60 удалений

Просмотреть файл

@ -60,7 +60,7 @@ class PostMessageEvent final : public Runnable {
mHolder.construct<StructuredCloneHolder>( mHolder.construct<StructuredCloneHolder>(
StructuredCloneHolder::CloningSupported, StructuredCloneHolder::CloningSupported,
StructuredCloneHolder::TransferringSupported, StructuredCloneHolder::TransferringSupported,
JS::StructuredCloneScope::SameProcessDifferentThread); JS::StructuredCloneScope::SameProcess);
mHolder.ref<StructuredCloneHolder>().Write(aCx, aMessage, aTransfer, mHolder.ref<StructuredCloneHolder>().Write(aCx, aMessage, aTransfer,
aClonePolicy, aError); aClonePolicy, aError);
} }

Просмотреть файл

@ -15,8 +15,7 @@ namespace dom {
SerializedStackHolder::SerializedStackHolder() SerializedStackHolder::SerializedStackHolder()
: mHolder(StructuredCloneHolder::CloningSupported, : mHolder(StructuredCloneHolder::CloningSupported,
StructuredCloneHolder::TransferringNotSupported, StructuredCloneHolder::TransferringNotSupported,
StructuredCloneHolder::StructuredCloneScope:: StructuredCloneHolder::StructuredCloneScope::SameProcess) {}
SameProcessDifferentThread) {}
void SerializedStackHolder::WriteStack(JSContext* aCx, void SerializedStackHolder::WriteStack(JSContext* aCx,
JS::HandleObject aStack) { JS::HandleObject aStack) {

Просмотреть файл

@ -789,9 +789,8 @@ bool WriteFormData(JSStructuredCloneWriter* aWriter, FormData* aFormData,
JSObject* ReadWasmModule(JSContext* aCx, uint32_t aIndex, JSObject* ReadWasmModule(JSContext* aCx, uint32_t aIndex,
StructuredCloneHolder* aHolder) { StructuredCloneHolder* aHolder) {
MOZ_ASSERT(aHolder); MOZ_ASSERT(aHolder);
MOZ_ASSERT( MOZ_ASSERT(aHolder->CloneScope() ==
aHolder->CloneScope() == StructuredCloneHolder::StructuredCloneScope::SameProcess);
StructuredCloneHolder::StructuredCloneScope::SameProcessDifferentThread);
#ifdef FUZZING #ifdef FUZZING
if (aIndex >= aHolder->WasmModules().Length()) { if (aIndex >= aHolder->WasmModules().Length()) {
return nullptr; return nullptr;
@ -808,9 +807,8 @@ bool WriteWasmModule(JSStructuredCloneWriter* aWriter,
MOZ_ASSERT(aWriter); MOZ_ASSERT(aWriter);
MOZ_ASSERT(aWasmModule); MOZ_ASSERT(aWasmModule);
MOZ_ASSERT(aHolder); MOZ_ASSERT(aHolder);
MOZ_ASSERT( MOZ_ASSERT(aHolder->CloneScope() ==
aHolder->CloneScope() == StructuredCloneHolder::StructuredCloneScope::SameProcess);
StructuredCloneHolder::StructuredCloneScope::SameProcessDifferentThread);
// We store the position of the wasmModule in the array as index. // We store the position of the wasmModule in the array as index.
if (JS_WriteUint32Pair(aWriter, SCTAG_DOM_WASM, if (JS_WriteUint32Pair(aWriter, SCTAG_DOM_WASM,
@ -886,8 +884,7 @@ JSObject* StructuredCloneHolder::CustomReadHandler(
} }
if (aTag == SCTAG_DOM_IMAGEBITMAP && if (aTag == SCTAG_DOM_IMAGEBITMAP &&
mStructuredCloneScope == mStructuredCloneScope == StructuredCloneScope::SameProcess) {
StructuredCloneScope::SameProcessDifferentThread) {
// Get the current global object. // Get the current global object.
// This can be null. // This can be null.
JS::RootedObject result(aCx); JS::RootedObject result(aCx);
@ -904,8 +901,7 @@ JSObject* StructuredCloneHolder::CustomReadHandler(
} }
if (aTag == SCTAG_DOM_WASM && if (aTag == SCTAG_DOM_WASM &&
mStructuredCloneScope == mStructuredCloneScope == StructuredCloneScope::SameProcess) {
StructuredCloneScope::SameProcessDifferentThread) {
return ReadWasmModule(aCx, aIndex, this); return ReadWasmModule(aCx, aIndex, this);
} }
@ -966,8 +962,7 @@ bool StructuredCloneHolder::CustomWriteHandler(JSContext* aCx,
} }
// See if this is an ImageBitmap object. // See if this is an ImageBitmap object.
if (mStructuredCloneScope == if (mStructuredCloneScope == StructuredCloneScope::SameProcess) {
StructuredCloneScope::SameProcessDifferentThread) {
ImageBitmap* imageBitmap = nullptr; ImageBitmap* imageBitmap = nullptr;
if (NS_SUCCEEDED(UNWRAP_OBJECT(ImageBitmap, &obj, imageBitmap))) { if (NS_SUCCEEDED(UNWRAP_OBJECT(ImageBitmap, &obj, imageBitmap))) {
return ImageBitmap::WriteStructuredClone(aWriter, GetSurfaces(), return ImageBitmap::WriteStructuredClone(aWriter, GetSurfaces(),
@ -984,8 +979,7 @@ bool StructuredCloneHolder::CustomWriteHandler(JSContext* aCx,
} }
// See if this is a BrowsingContext object. // See if this is a BrowsingContext object.
if (mStructuredCloneScope == if (mStructuredCloneScope == StructuredCloneScope::SameProcess ||
StructuredCloneScope::SameProcessDifferentThread ||
mStructuredCloneScope == StructuredCloneScope::DifferentProcess) { mStructuredCloneScope == StructuredCloneScope::DifferentProcess) {
BrowsingContext* holder = nullptr; BrowsingContext* holder = nullptr;
if (NS_SUCCEEDED(UNWRAP_OBJECT(BrowsingContext, &obj, holder))) { if (NS_SUCCEEDED(UNWRAP_OBJECT(BrowsingContext, &obj, holder))) {
@ -1002,8 +996,7 @@ bool StructuredCloneHolder::CustomWriteHandler(JSContext* aCx,
} }
// See if this is a WasmModule. // See if this is a WasmModule.
if (mStructuredCloneScope == if (mStructuredCloneScope == StructuredCloneScope::SameProcess &&
StructuredCloneScope::SameProcessDifferentThread &&
JS::IsWasmModuleObject(obj)) { JS::IsWasmModuleObject(obj)) {
RefPtr<JS::WasmModule> module = JS::GetWasmModule(obj); RefPtr<JS::WasmModule> module = JS::GetWasmModule(obj);
MOZ_ASSERT(module); MOZ_ASSERT(module);
@ -1058,8 +1051,7 @@ bool StructuredCloneHolder::CustomReadTransferHandler(
} }
if (aTag == SCTAG_DOM_CANVAS && if (aTag == SCTAG_DOM_CANVAS &&
mStructuredCloneScope == mStructuredCloneScope == StructuredCloneScope::SameProcess) {
StructuredCloneScope::SameProcessDifferentThread) {
MOZ_ASSERT(aContent); MOZ_ASSERT(aContent);
OffscreenCanvasCloneData* data = OffscreenCanvasCloneData* data =
static_cast<OffscreenCanvasCloneData*>(aContent); static_cast<OffscreenCanvasCloneData*>(aContent);
@ -1078,8 +1070,7 @@ bool StructuredCloneHolder::CustomReadTransferHandler(
} }
if (aTag == SCTAG_DOM_IMAGEBITMAP && if (aTag == SCTAG_DOM_IMAGEBITMAP &&
mStructuredCloneScope == mStructuredCloneScope == StructuredCloneScope::SameProcess) {
StructuredCloneScope::SameProcessDifferentThread) {
MOZ_ASSERT(aContent); MOZ_ASSERT(aContent);
ImageBitmapCloneData* data = static_cast<ImageBitmapCloneData*>(aContent); ImageBitmapCloneData* data = static_cast<ImageBitmapCloneData*>(aContent);
RefPtr<ImageBitmap> bitmap = RefPtr<ImageBitmap> bitmap =
@ -1131,8 +1122,7 @@ bool StructuredCloneHolder::CustomWriteTransferHandler(
return true; return true;
} }
if (mStructuredCloneScope == if (mStructuredCloneScope == StructuredCloneScope::SameProcess) {
StructuredCloneScope::SameProcessDifferentThread) {
OffscreenCanvas* canvas = nullptr; OffscreenCanvas* canvas = nullptr;
rv = UNWRAP_OBJECT(OffscreenCanvas, &obj, canvas); rv = UNWRAP_OBJECT(OffscreenCanvas, &obj, canvas);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
@ -1196,8 +1186,7 @@ void StructuredCloneHolder::CustomFreeTransferHandler(
} }
if (aTag == SCTAG_DOM_CANVAS && if (aTag == SCTAG_DOM_CANVAS &&
mStructuredCloneScope == mStructuredCloneScope == StructuredCloneScope::SameProcess) {
StructuredCloneScope::SameProcessDifferentThread) {
MOZ_ASSERT(aContent); MOZ_ASSERT(aContent);
OffscreenCanvasCloneData* data = OffscreenCanvasCloneData* data =
static_cast<OffscreenCanvasCloneData*>(aContent); static_cast<OffscreenCanvasCloneData*>(aContent);
@ -1206,8 +1195,7 @@ void StructuredCloneHolder::CustomFreeTransferHandler(
} }
if (aTag == SCTAG_DOM_IMAGEBITMAP && if (aTag == SCTAG_DOM_IMAGEBITMAP &&
mStructuredCloneScope == mStructuredCloneScope == StructuredCloneScope::SameProcess) {
StructuredCloneScope::SameProcessDifferentThread) {
MOZ_ASSERT(aContent); MOZ_ASSERT(aContent);
ImageBitmapCloneData* data = static_cast<ImageBitmapCloneData*>(aContent); ImageBitmapCloneData* data = static_cast<ImageBitmapCloneData*>(aContent);
delete data; delete data;
@ -1230,8 +1218,7 @@ bool StructuredCloneHolder::CustomCanTransferHandler(
return true; return true;
} }
if (mStructuredCloneScope == if (mStructuredCloneScope == StructuredCloneScope::SameProcess) {
StructuredCloneScope::SameProcessDifferentThread) {
OffscreenCanvas* canvas = nullptr; OffscreenCanvas* canvas = nullptr;
rv = UNWRAP_OBJECT(OffscreenCanvas, &obj, canvas); rv = UNWRAP_OBJECT(OffscreenCanvas, &obj, canvas);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {

Просмотреть файл

@ -39,8 +39,7 @@ class StructuredCloneHolderBase {
typedef JS::StructuredCloneScope StructuredCloneScope; typedef JS::StructuredCloneScope StructuredCloneScope;
StructuredCloneHolderBase( StructuredCloneHolderBase(
StructuredCloneScope aScope = StructuredCloneScope aScope = StructuredCloneScope::SameProcess);
StructuredCloneScope::SameProcessDifferentThread);
virtual ~StructuredCloneHolderBase(); virtual ~StructuredCloneHolderBase();
// Note, it is unsafe to std::move() a StructuredCloneHolderBase since a raw // Note, it is unsafe to std::move() a StructuredCloneHolderBase since a raw

Просмотреть файл

@ -520,7 +520,7 @@ already_AddRefed<AudioWorkletNode> AudioWorkletNode::Constructor(
MakeUnique<StructuredCloneHolder>( MakeUnique<StructuredCloneHolder>(
StructuredCloneHolder::CloningSupported, StructuredCloneHolder::CloningSupported,
StructuredCloneHolder::TransferringNotSupported, StructuredCloneHolder::TransferringNotSupported,
JS::StructuredCloneScope::SameProcessDifferentThread); JS::StructuredCloneScope::SameProcess);
serializedOptions->Write(cx, optionsVal, aRv); serializedOptions->Write(cx, optionsVal, aRv);
if (NS_WARN_IF(aRv.Failed())) { if (NS_WARN_IF(aRv.Failed())) {
return nullptr; return nullptr;

Просмотреть файл

@ -21,7 +21,7 @@ MessageEventRunnable::MessageEventRunnable(WorkerPrivate* aWorkerPrivate,
TargetAndBusyBehavior aBehavior) TargetAndBusyBehavior aBehavior)
: WorkerDebuggeeRunnable(aWorkerPrivate, aBehavior), : WorkerDebuggeeRunnable(aWorkerPrivate, aBehavior),
StructuredCloneHolder(CloningSupported, TransferringSupported, StructuredCloneHolder(CloningSupported, TransferringSupported,
StructuredCloneScope::SameProcessDifferentThread) {} StructuredCloneScope::SameProcess) {}
bool MessageEventRunnable::DispatchDOMEvent(JSContext* aCx, bool MessageEventRunnable::DispatchDOMEvent(JSContext* aCx,
WorkerPrivate* aWorkerPrivate, WorkerPrivate* aWorkerPrivate,

Просмотреть файл

@ -237,7 +237,7 @@ class SendRunnable final : public WorkerThreadProxySyncRunnable,
const nsAString& aStringBody) const nsAString& aStringBody)
: WorkerThreadProxySyncRunnable(aWorkerPrivate, aProxy), : WorkerThreadProxySyncRunnable(aWorkerPrivate, aProxy),
StructuredCloneHolder(CloningSupported, TransferringNotSupported, StructuredCloneHolder(CloningSupported, TransferringNotSupported,
StructuredCloneScope::SameProcessDifferentThread), StructuredCloneScope::SameProcess),
mStringBody(aStringBody), mStringBody(aStringBody),
mHasUploadListeners(false) {} mHasUploadListeners(false) {}

Просмотреть файл

@ -137,7 +137,7 @@ enum class StructuredCloneScope : uint32_t {
* as part of the SCTAG_HEADER, and IndexedDB persists the representation to * as part of the SCTAG_HEADER, and IndexedDB persists the representation to
* disk. * disk.
*/ */
SameProcessDifferentThread = 1, SameProcess = 1,
/** /**
* When writing, this means we're writing for an audience in a different * When writing, this means we're writing for an audience in a different
@ -156,8 +156,8 @@ enum class StructuredCloneScope : uint32_t {
/** /**
* Handle a backwards-compatibility case with IndexedDB (bug 1434308): when * Handle a backwards-compatibility case with IndexedDB (bug 1434308): when
* reading, this means to treat legacy SameProcessDifferentThread data as if * reading, this means to treat legacy SameProcess data as if it were
* it were DifferentProcess. * DifferentProcess.
* *
* Do not use this for writing; use DifferentProcess instead. * Do not use this for writing; use DifferentProcess instead.
*/ */

Просмотреть файл

@ -3381,8 +3381,8 @@ static mozilla::Maybe<JS::StructuredCloneScope> ParseCloneScope(
return scope; return scope;
} }
if (StringEqualsLiteral(scopeStr, "SameProcessDifferentThread")) { if (StringEqualsLiteral(scopeStr, "SameProcess")) {
scope.emplace(JS::StructuredCloneScope::SameProcessDifferentThread); scope.emplace(JS::StructuredCloneScope::SameProcess);
} else if (StringEqualsLiteral(scopeStr, "DifferentProcess")) { } else if (StringEqualsLiteral(scopeStr, "DifferentProcess")) {
scope.emplace(JS::StructuredCloneScope::DifferentProcess); scope.emplace(JS::StructuredCloneScope::DifferentProcess);
} else if (StringEqualsLiteral(scopeStr, "DifferentProcessForIndexedDB")) { } else if (StringEqualsLiteral(scopeStr, "DifferentProcessForIndexedDB")) {
@ -3448,8 +3448,7 @@ bool js::testingFunc_serialize(JSContext* cx, unsigned argc, Value* vp) {
} }
if (!clonebuf) { if (!clonebuf) {
clonebuf.emplace(JS::StructuredCloneScope::SameProcessDifferentThread, clonebuf.emplace(JS::StructuredCloneScope::SameProcess, nullptr, nullptr);
nullptr, nullptr);
} }
if (!clonebuf->write(cx, args.get(0), args.get(1), policy)) { if (!clonebuf->write(cx, args.get(0), args.get(1), policy)) {
@ -3478,7 +3477,7 @@ static bool Deserialize(JSContext* cx, unsigned argc, Value* vp) {
JS::CloneDataPolicy policy; JS::CloneDataPolicy policy;
JS::StructuredCloneScope scope = JS::StructuredCloneScope scope =
obj->isSynthetic() ? JS::StructuredCloneScope::DifferentProcess obj->isSynthetic() ? JS::StructuredCloneScope::DifferentProcess
: JS::StructuredCloneScope::SameProcessDifferentThread; : JS::StructuredCloneScope::SameProcess;
if (args.get(1).isObject()) { if (args.get(1).isObject()) {
RootedObject opts(cx, &args[1].toObject()); RootedObject opts(cx, &args[1].toObject());
if (!opts) { if (!opts) {
@ -6743,7 +6742,7 @@ gc::ZealModeHelpText),
" clone buffer object. 'policy' may be an options hash. Valid keys:\n" " clone buffer object. 'policy' may be an options hash. Valid keys:\n"
" 'SharedArrayBuffer' - either 'allow' or 'deny' (the default)\n" " 'SharedArrayBuffer' - either 'allow' or 'deny' (the default)\n"
" to specify whether SharedArrayBuffers may be serialized.\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" " DifferentProcessForIndexedDB. Determines how some values will be\n"
" serialized. Clone buffers may only be deserialized with a compatible\n" " serialized. Clone buffers may only be deserialized with a compatible\n"
" scope. NOTE - For DifferentProcess/DifferentProcessForIndexedDB,\n" " scope. NOTE - For DifferentProcess/DifferentProcessForIndexedDB,\n"
@ -6757,10 +6756,10 @@ gc::ZealModeHelpText),
" 'SharedArrayBuffer' - either 'allow' or 'deny' (the default)\n" " 'SharedArrayBuffer' - either 'allow' or 'deny' (the default)\n"
" to specify whether SharedArrayBuffers may be serialized.\n" " to specify whether SharedArrayBuffers may be serialized.\n"
" 'scope', which limits the clone buffers that are considered\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" " and 'DifferentProcessForIndexedDB'. So for example, a\n"
" DifferentProcessForIndexedDB clone buffer may be deserialized in any scope, but\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."), " DifferentProcess scope."),
JS_FN_HELP("detachArrayBuffer", DetachArrayBuffer, 1, 0, JS_FN_HELP("detachArrayBuffer", DetachArrayBuffer, 1, 0,

Просмотреть файл

@ -134,7 +134,7 @@ bool TestCloneObject() {
JS::RootedObject obj1(cx, CreateNewObject(8, 12)); JS::RootedObject obj1(cx, CreateNewObject(8, 12));
CHECK(obj1); CHECK(obj1);
JSAutoStructuredCloneBuffer cloned_buffer( JSAutoStructuredCloneBuffer cloned_buffer(
JS::StructuredCloneScope::SameProcessDifferentThread, nullptr, nullptr); JS::StructuredCloneScope::SameProcess, nullptr, nullptr);
JS::RootedValue v1(cx, JS::ObjectValue(*obj1)); JS::RootedValue v1(cx, JS::ObjectValue(*obj1));
CHECK(cloned_buffer.write(cx, v1, nullptr, nullptr)); CHECK(cloned_buffer.write(cx, v1, nullptr, nullptr));
JS::RootedValue v2(cx); JS::RootedValue v2(cx);
@ -173,7 +173,7 @@ bool TestTransferObject() {
JS::RootedValue transferable(cx, JS::ObjectValue(*obj)); JS::RootedValue transferable(cx, JS::ObjectValue(*obj));
JSAutoStructuredCloneBuffer cloned_buffer( JSAutoStructuredCloneBuffer cloned_buffer(
JS::StructuredCloneScope::SameProcessDifferentThread, nullptr, nullptr); JS::StructuredCloneScope::SameProcess, nullptr, nullptr);
JS::CloneDataPolicy policy; JS::CloneDataPolicy policy;
CHECK(cloned_buffer.write(cx, v1, transferable, policy, nullptr, nullptr)); CHECK(cloned_buffer.write(cx, v1, transferable, policy, nullptr, nullptr));
JS::RootedValue v2(cx); JS::RootedValue v2(cx);

Просмотреть файл

@ -137,8 +137,7 @@ BEGIN_TEST(testStructuredClone_externalArrayBuffer) {
END_TEST(testStructuredClone_externalArrayBuffer) END_TEST(testStructuredClone_externalArrayBuffer)
BEGIN_TEST(testStructuredClone_externalArrayBufferDifferentThreadOrProcess) { BEGIN_TEST(testStructuredClone_externalArrayBufferDifferentThreadOrProcess) {
CHECK(testStructuredCloneCopy( CHECK(testStructuredCloneCopy(JS::StructuredCloneScope::SameProcess));
JS::StructuredCloneScope::SameProcessDifferentThread));
CHECK(testStructuredCloneCopy(JS::StructuredCloneScope::DifferentProcess)); CHECK(testStructuredCloneCopy(JS::StructuredCloneScope::DifferentProcess));
return true; return true;
} }

Просмотреть файл

@ -23,8 +23,8 @@ check(new Proxy({}, {}));
check({get x() { throw new Error("fail"); }}); check({get x() { throw new Error("fail"); }});
// Mismatched scopes. // Mismatched scopes.
for (let [write_scope, read_scope] of [['SameProcessDifferentThread', 'DifferentProcessForIndexedDB'], for (let [write_scope, read_scope] of [['SameProcess', 'DifferentProcessForIndexedDB'],
['SameProcessDifferentThread', 'DifferentProcess']]) ['SameProcess', 'DifferentProcess']])
{ {
var ab = new ArrayBuffer(12); var ab = new ArrayBuffer(12);
var buffer = serialize(ab, [ab], { scope: write_scope }); var buffer = serialize(ab, [ab], { scope: write_scope });

Просмотреть файл

@ -3,7 +3,7 @@
// http://creativecommons.org/licenses/publicdomain/ // http://creativecommons.org/licenses/publicdomain/
function* buffer_options() { function* buffer_options() {
for (var scope of ["SameProcessDifferentThread", for (var scope of ["SameProcess",
"DifferentProcess", "DifferentProcess",
"DifferentProcessForIndexedDB"]) "DifferentProcessForIndexedDB"])
{ {

Просмотреть файл

@ -428,7 +428,7 @@ struct JSStructuredCloneReader {
SCInput& in; SCInput& in;
// The widest scope that the caller will accept, where // 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 // and DifferentProcess is the narrowest (it cannot contain pointers and must
// be valid cross-process.) // be valid cross-process.)
JS::StructuredCloneScope allowedScope; JS::StructuredCloneScope allowedScope;
@ -1267,7 +1267,7 @@ bool JSStructuredCloneWriter::writeSharedArrayBuffer(HandleObject obj) {
// cross-process. The cloneDataPolicy should have guarded against this; // cross-process. The cloneDataPolicy should have guarded against this;
// since it did not then throw, with a very explicit message. // 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, JS_ReportErrorNumberASCII(context(), GetErrorMessage, nullptr,
JSMSG_SC_SHMEM_POLICY); JSMSG_SC_SHMEM_POLICY);
return false; return false;
@ -2658,10 +2658,10 @@ bool JSStructuredCloneReader::readHeader() {
// Backward compatibility with old structured clone buffers. Value '0' was // Backward compatibility with old structured clone buffers. Value '0' was
// used for SameProcessSameThread scope. // used for SameProcessSameThread scope.
if ((int)storedScope == 0) { 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) { storedScope > JS::StructuredCloneScope::DifferentProcessForIndexedDB) {
JS_ReportErrorNumberASCII(context(), GetErrorMessage, nullptr, JS_ReportErrorNumberASCII(context(), GetErrorMessage, nullptr,
JSMSG_SC_BAD_SERIALIZED_DATA, JSMSG_SC_BAD_SERIALIZED_DATA,
@ -3090,8 +3090,8 @@ JS_PUBLIC_API bool JS_StructuredClone(
const JSStructuredCloneCallbacks* callbacks = optionalCallbacks; const JSStructuredCloneCallbacks* callbacks = optionalCallbacks;
JSAutoStructuredCloneBuffer buf( JSAutoStructuredCloneBuffer buf(JS::StructuredCloneScope::SameProcess,
JS::StructuredCloneScope::SameProcessDifferentThread, callbacks, closure); callbacks, closure);
{ {
if (value.isObject()) { if (value.isObject()) {
RootedObject obj(cx, &value.toObject()); RootedObject obj(cx, &value.toObject());