Bug 1611855 - Worklet must be part of the same parent's agentCluster - part 3 - update the scope after a writing, r=smaug

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrea Marchesini 2020-02-05 22:08:39 +00:00
Родитель 87b1a8a547
Коммит 94658a20fe
3 изменённых файлов: 12 добавлений и 3 удалений

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

@ -193,6 +193,10 @@ bool StructuredCloneHolderBase::Write(
return false;
}
// Let's update our scope to the final one. The new one could be more
// restrictive of the current one.
MOZ_ASSERT(mStructuredCloneScope >= mBuffer->scope());
mStructuredCloneScope = mBuffer->scope();
return true;
}

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

@ -552,6 +552,11 @@ class MOZ_NON_MEMMOVABLE JS_PUBLIC_API JSStructuredCloneData {
}
void discardTransferables();
private:
// This internal method exposes the real value of scope_. It's meant to be
// used only when starting the writing.
JS::StructuredCloneScope scopeForInternalWriting() const { return scope_; }
};
/**

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

@ -3211,8 +3211,8 @@ bool JSAutoStructuredCloneBuffer::write(
const JS::CloneDataPolicy& cloneDataPolicy,
const JSStructuredCloneCallbacks* optionalCallbacks, void* closure) {
clear();
bool ok =
JS_WriteStructuredClone(cx, value, &data_, data_.scope(), cloneDataPolicy,
bool ok = JS_WriteStructuredClone(
cx, value, &data_, data_.scopeForInternalWriting(), cloneDataPolicy,
optionalCallbacks, closure, transferable);
if (ok) {