mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1709241 - Use JSAutoStructuredCloneBuffer callbacks when set r=sfink
During calls to read() and write() for JSAutoStructuredCloneBuffer the data callbacks and closure are ignored also if none are explicitly passed. Use them in such case Differential Revision: https://phabricator.services.mozilla.com/D114195
This commit is contained in:
parent
5ae9a468e0
commit
16991ea00c
@ -3516,8 +3516,10 @@ bool JSAutoStructuredCloneBuffer::read(
|
||||
const JS::CloneDataPolicy& cloneDataPolicy,
|
||||
const JSStructuredCloneCallbacks* optionalCallbacks, void* closure) {
|
||||
MOZ_ASSERT(cx);
|
||||
return !!JS_ReadStructuredClone(cx, data_, version_, data_.scope(), vp,
|
||||
cloneDataPolicy, optionalCallbacks, closure);
|
||||
return !!JS_ReadStructuredClone(
|
||||
cx, data_, version_, data_.scope(), vp, cloneDataPolicy,
|
||||
optionalCallbacks ? optionalCallbacks : data_.callbacks_,
|
||||
optionalCallbacks ? closure : data_.closure_);
|
||||
}
|
||||
|
||||
bool JSAutoStructuredCloneBuffer::write(
|
||||
@ -3525,7 +3527,8 @@ bool JSAutoStructuredCloneBuffer::write(
|
||||
const JSStructuredCloneCallbacks* optionalCallbacks, void* closure) {
|
||||
HandleValue transferable = UndefinedHandleValue;
|
||||
return write(cx, value, transferable, JS::CloneDataPolicy(),
|
||||
optionalCallbacks, closure);
|
||||
optionalCallbacks ? optionalCallbacks : data_.callbacks_,
|
||||
optionalCallbacks ? closure : data_.closure_);
|
||||
}
|
||||
|
||||
bool JSAutoStructuredCloneBuffer::write(
|
||||
@ -3535,7 +3538,8 @@ bool JSAutoStructuredCloneBuffer::write(
|
||||
clear();
|
||||
bool ok = JS_WriteStructuredClone(
|
||||
cx, value, &data_, data_.scopeForInternalWriting(), cloneDataPolicy,
|
||||
optionalCallbacks, closure, transferable);
|
||||
optionalCallbacks ? optionalCallbacks : data_.callbacks_,
|
||||
optionalCallbacks ? closure : data_.closure_, transferable);
|
||||
|
||||
if (ok) {
|
||||
data_.ownTransferables_ = OwnTransferablePolicy::OwnsTransferablesIfAny;
|
||||
|
Loading…
Reference in New Issue
Block a user