зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1203920 - Get rid of JS_SetStructuredCloneCallbacks, r=sfink
This commit is contained in:
Родитель
ebe535b023
Коммит
83c3255308
|
@ -236,9 +236,6 @@ class JS_PUBLIC_API(JSAutoStructuredCloneBuffer) {
|
|||
#define JS_SCERR_TRANSFERABLE 1
|
||||
#define JS_SCERR_DUP_TRANSFERABLE 2
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetStructuredCloneCallbacks(JSRuntime* rt, const JSStructuredCloneCallbacks* callbacks);
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_ReadUint32Pair(JSStructuredCloneReader* r, uint32_t* p1, uint32_t* p2);
|
||||
|
||||
|
|
|
@ -126,10 +126,9 @@ bool TestCloneObject()
|
|||
CHECK(obj1);
|
||||
JSAutoStructuredCloneBuffer cloned_buffer;
|
||||
JS::RootedValue v1(cx, JS::ObjectValue(*obj1));
|
||||
const JSStructuredCloneCallbacks* callbacks = js::GetContextStructuredCloneCallbacks(cx);
|
||||
CHECK(cloned_buffer.write(cx, v1, callbacks, nullptr));
|
||||
CHECK(cloned_buffer.write(cx, v1, nullptr, nullptr));
|
||||
JS::RootedValue v2(cx);
|
||||
CHECK(cloned_buffer.read(cx, &v2, callbacks, nullptr));
|
||||
CHECK(cloned_buffer.read(cx, &v2, nullptr, nullptr));
|
||||
JS::RootedObject obj2(cx, v2.toObjectOrNull());
|
||||
CHECK(VerifyObject(obj2, 8, 12, false));
|
||||
|
||||
|
@ -162,10 +161,9 @@ bool TestTransferObject()
|
|||
JS::RootedValue transferable(cx, JS::ObjectValue(*obj));
|
||||
|
||||
JSAutoStructuredCloneBuffer cloned_buffer;
|
||||
const JSStructuredCloneCallbacks* callbacks = js::GetContextStructuredCloneCallbacks(cx);
|
||||
CHECK(cloned_buffer.write(cx, v1, transferable, callbacks, nullptr));
|
||||
CHECK(cloned_buffer.write(cx, v1, transferable, nullptr, nullptr));
|
||||
JS::RootedValue v2(cx);
|
||||
CHECK(cloned_buffer.read(cx, &v2, callbacks, nullptr));
|
||||
CHECK(cloned_buffer.read(cx, &v2, nullptr, nullptr));
|
||||
JS::RootedObject obj2(cx, v2.toObjectOrNull());
|
||||
CHECK(VerifyObject(obj2, 8, 12, true));
|
||||
CHECK(isNeutered(obj1));
|
||||
|
|
|
@ -1025,12 +1025,6 @@ js::DumpHeap(JSRuntime* rt, FILE* fp, js::DumpHeapNurseryBehaviour nurseryBehavi
|
|||
fflush(dtrc.output);
|
||||
}
|
||||
|
||||
JS_FRIEND_API(const JSStructuredCloneCallbacks*)
|
||||
js::GetContextStructuredCloneCallbacks(JSContext* cx)
|
||||
{
|
||||
return cx->runtime()->structuredCloneCallbacks;
|
||||
}
|
||||
|
||||
JS_FRIEND_API(bool)
|
||||
js::ContextHasOutstandingRequests(const JSContext* cx)
|
||||
{
|
||||
|
|
|
@ -1083,9 +1083,6 @@ typedef void
|
|||
JS_FRIEND_API(void)
|
||||
SetActivityCallback(JSRuntime* rt, ActivityCallback cb, void* arg);
|
||||
|
||||
extern JS_FRIEND_API(const JSStructuredCloneCallbacks*)
|
||||
GetContextStructuredCloneCallbacks(JSContext* cx);
|
||||
|
||||
typedef bool
|
||||
(* DOMInstanceClassHasProtoAtDepth)(const Class* instanceClass,
|
||||
uint32_t protoID, uint32_t depth);
|
||||
|
|
|
@ -195,7 +195,6 @@ JSRuntime::JSRuntime(JSRuntime* parentRuntime)
|
|||
securityCallbacks(const_cast<JSSecurityCallbacks*>(&NullSecurityCallbacks)),
|
||||
DOMcallbacks(nullptr),
|
||||
destroyPrincipals(nullptr),
|
||||
structuredCloneCallbacks(nullptr),
|
||||
errorReporter(nullptr),
|
||||
linkedAsmJSModules(nullptr),
|
||||
propertyRemovals(0),
|
||||
|
|
|
@ -1154,9 +1154,6 @@ struct JSRuntime : public JS::shadow::Runtime,
|
|||
const js::DOMCallbacks* DOMcallbacks;
|
||||
JSDestroyPrincipalsOp destroyPrincipals;
|
||||
|
||||
/* Structured data callbacks are runtime-wide. */
|
||||
const JSStructuredCloneCallbacks* structuredCloneCallbacks;
|
||||
|
||||
/* Optional error reporter. */
|
||||
JSErrorReporter errorReporter;
|
||||
|
||||
|
|
|
@ -1966,10 +1966,7 @@ JS_ReadStructuredClone(JSContext* cx, uint64_t* buf, size_t nbytes,
|
|||
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SC_BAD_CLONE_VERSION);
|
||||
return false;
|
||||
}
|
||||
const JSStructuredCloneCallbacks* callbacks =
|
||||
optionalCallbacks ?
|
||||
optionalCallbacks :
|
||||
cx->runtime()->structuredCloneCallbacks;
|
||||
const JSStructuredCloneCallbacks* callbacks = optionalCallbacks;
|
||||
return ReadStructuredClone(cx, buf, nbytes, vp, callbacks, closure);
|
||||
}
|
||||
|
||||
|
@ -1982,10 +1979,7 @@ JS_WriteStructuredClone(JSContext* cx, HandleValue value, uint64_t** bufp, size_
|
|||
CHECK_REQUEST(cx);
|
||||
assertSameCompartment(cx, value);
|
||||
|
||||
const JSStructuredCloneCallbacks* callbacks =
|
||||
optionalCallbacks ?
|
||||
optionalCallbacks :
|
||||
cx->runtime()->structuredCloneCallbacks;
|
||||
const JSStructuredCloneCallbacks* callbacks = optionalCallbacks;
|
||||
return WriteStructuredClone(cx, value, bufp, nbytesp, callbacks, closure, transferable);
|
||||
}
|
||||
|
||||
|
@ -2028,10 +2022,7 @@ JS_StructuredClone(JSContext* cx, HandleValue value, MutableHandleValue vp,
|
|||
return true;
|
||||
}
|
||||
|
||||
const JSStructuredCloneCallbacks* callbacks =
|
||||
optionalCallbacks ?
|
||||
optionalCallbacks :
|
||||
cx->runtime()->structuredCloneCallbacks;
|
||||
const JSStructuredCloneCallbacks* callbacks = optionalCallbacks;
|
||||
|
||||
JSAutoStructuredCloneBuffer buf;
|
||||
{
|
||||
|
@ -2174,12 +2165,6 @@ JSAutoStructuredCloneBuffer::write(JSContext* cx, HandleValue value,
|
|||
return ok;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetStructuredCloneCallbacks(JSRuntime* rt, const JSStructuredCloneCallbacks* callbacks)
|
||||
{
|
||||
rt->structuredCloneCallbacks = callbacks;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_ReadUint32Pair(JSStructuredCloneReader* r, uint32_t* p1, uint32_t* p2)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче