summaryrefslogtreecommitdiffstats
path: root/dom/base/StructuredCloneHolder.cpp
diff options
context:
space:
mode:
authorAndrea Marchesini <amarchesini@mozilla.com>2018-05-10 09:02:16 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-06-07 06:09:07 +0200
commite597487f31726085464a6188ad004fb10fad8305 (patch)
tree7913b90275a8d57553c66efb512c9e69469ed23e /dom/base/StructuredCloneHolder.cpp
parent6b36aa089d31573cf9a72da530dc423b3978fda3 (diff)
downloadUXP-e597487f31726085464a6188ad004fb10fad8305.tar
UXP-e597487f31726085464a6188ad004fb10fad8305.tar.gz
UXP-e597487f31726085464a6188ad004fb10fad8305.tar.lz
UXP-e597487f31726085464a6188ad004fb10fad8305.tar.xz
UXP-e597487f31726085464a6188ad004fb10fad8305.zip
Bug 1452576 - Improve StructuredCloneHolder for fuzzy tests, r=decoder a=jcristau
--HG-- extra : rebase_source : eb2bc60ffcac9afd44da7a2f5c99913829cd4753
Diffstat (limited to 'dom/base/StructuredCloneHolder.cpp')
-rw-r--r--dom/base/StructuredCloneHolder.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/dom/base/StructuredCloneHolder.cpp b/dom/base/StructuredCloneHolder.cpp
index 1c27c632e..8e7cee340 100644
--- a/dom/base/StructuredCloneHolder.cpp
+++ b/dom/base/StructuredCloneHolder.cpp
@@ -1075,9 +1075,9 @@ StructuredCloneHolder::CustomReadHandler(JSContext* aCx,
return ReadFormData(aCx, aReader, aIndex, this);
}
- if (aTag == SCTAG_DOM_IMAGEBITMAP) {
- MOZ_ASSERT(mStructuredCloneScope == StructuredCloneScope::SameProcessSameThread ||
- mStructuredCloneScope == StructuredCloneScope::SameProcessDifferentThread);
+ if (aTag == SCTAG_DOM_IMAGEBITMAP &&
+ (mStructuredCloneScope == StructuredCloneScope::SameProcessSameThread ||
+ mStructuredCloneScope == StructuredCloneScope::SameProcessDifferentThread)) {
// Get the current global object.
// This can be null.
@@ -1087,7 +1087,9 @@ StructuredCloneHolder::CustomReadHandler(JSContext* aCx,
parent, GetSurfaces(), aIndex);
}
- if (aTag == SCTAG_DOM_WASM) {
+ if (aTag == SCTAG_DOM_WASM &&
+ (mStructuredCloneScope == StructuredCloneScope::SameProcessSameThread ||
+ mStructuredCloneScope == StructuredCloneScope::SameProcessDifferentThread)) {
return ReadWasmModule(aCx, aIndex, this);
}
@@ -1202,9 +1204,9 @@ StructuredCloneHolder::CustomReadTransferHandler(JSContext* aCx,
return true;
}
- if (aTag == SCTAG_DOM_CANVAS) {
- MOZ_ASSERT(mStructuredCloneScope == StructuredCloneScope::SameProcessSameThread ||
- mStructuredCloneScope == StructuredCloneScope::SameProcessDifferentThread);
+ if (aTag == SCTAG_DOM_CANVAS &&
+ (mStructuredCloneScope == StructuredCloneScope::SameProcessSameThread ||
+ mStructuredCloneScope == StructuredCloneScope::SameProcessDifferentThread)) {
MOZ_ASSERT(aContent);
OffscreenCanvasCloneData* data =
static_cast<OffscreenCanvasCloneData*>(aContent);
@@ -1222,9 +1224,9 @@ StructuredCloneHolder::CustomReadTransferHandler(JSContext* aCx,
return true;
}
- if (aTag == SCTAG_DOM_IMAGEBITMAP) {
- MOZ_ASSERT(mStructuredCloneScope == StructuredCloneScope::SameProcessSameThread ||
- mStructuredCloneScope == StructuredCloneScope::SameProcessDifferentThread);
+ if (aTag == SCTAG_DOM_IMAGEBITMAP &&
+ (mStructuredCloneScope == StructuredCloneScope::SameProcessSameThread ||
+ mStructuredCloneScope == StructuredCloneScope::SameProcessDifferentThread)) {
MOZ_ASSERT(aContent);
ImageBitmapCloneData* data =
static_cast<ImageBitmapCloneData*>(aContent);
@@ -1328,9 +1330,9 @@ StructuredCloneHolder::CustomFreeTransferHandler(uint32_t aTag,
return;
}
- if (aTag == SCTAG_DOM_CANVAS) {
- MOZ_ASSERT(mStructuredCloneScope == StructuredCloneScope::SameProcessSameThread ||
- mStructuredCloneScope == StructuredCloneScope::SameProcessDifferentThread);
+ if (aTag == SCTAG_DOM_CANVAS &&
+ (mStructuredCloneScope == StructuredCloneScope::SameProcessSameThread ||
+ mStructuredCloneScope == StructuredCloneScope::SameProcessDifferentThread)) {
MOZ_ASSERT(aContent);
OffscreenCanvasCloneData* data =
static_cast<OffscreenCanvasCloneData*>(aContent);
@@ -1338,9 +1340,9 @@ StructuredCloneHolder::CustomFreeTransferHandler(uint32_t aTag,
return;
}
- if (aTag == SCTAG_DOM_IMAGEBITMAP) {
- MOZ_ASSERT(mStructuredCloneScope == StructuredCloneScope::SameProcessSameThread ||
- mStructuredCloneScope == StructuredCloneScope::SameProcessDifferentThread);
+ if (aTag == SCTAG_DOM_IMAGEBITMAP &&
+ (mStructuredCloneScope == StructuredCloneScope::SameProcessSameThread ||
+ mStructuredCloneScope == StructuredCloneScope::SameProcessDifferentThread)) {
MOZ_ASSERT(aContent);
ImageBitmapCloneData* data =
static_cast<ImageBitmapCloneData*>(aContent);