Bug 1613974 - Fix transfer-errors.window.js WPT failures, r=ttung,sfink

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrea Marchesini 2020-02-07 19:13:15 +00:00
Родитель c508a968ca
Коммит 5419708e2a
3 изменённых файлов: 14 добавлений и 10 удалений

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

@ -701,6 +701,8 @@ class JS_PUBLIC_API JSAutoStructuredCloneBuffer {
#define JS_SCERR_DUP_TRANSFERABLE 2
#define JS_SCERR_UNSUPPORTED_TYPE 3
#define JS_SCERR_SHMEM_TRANSFERABLE 4
#define JS_SCERR_TYPED_ARRAY_DETACHED 5
#define JS_SCERR_WASM_NO_TRANSFER 6
JS_PUBLIC_API bool JS_ReadUint32Pair(JSStructuredCloneReader* r, uint32_t* p1,
uint32_t* p2);

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

@ -617,6 +617,16 @@ static void ReportDataCloneError(JSContext* cx,
JSMSG_SC_SHMEM_TRANSFERABLE);
break;
case JS_SCERR_TYPED_ARRAY_DETACHED:
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
JSMSG_TYPED_ARRAY_DETACHED);
break;
case JS_SCERR_WASM_NO_TRANSFER:
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
JSMSG_WASM_NO_TRANSFER);
break;
default:
MOZ_CRASH("Unkown errorId");
break;
@ -1866,14 +1876,12 @@ bool JSStructuredCloneWriter::transferOwnership() {
JSAutoRealm ar(cx, arrayBuffer);
if (arrayBuffer->isDetached()) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
JSMSG_TYPED_ARRAY_DETACHED);
reportDataCloneError(JS_SCERR_TYPED_ARRAY_DETACHED);
return false;
}
if (arrayBuffer->isPreparedForAsmJS()) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
JSMSG_WASM_NO_TRANSFER);
reportDataCloneError(JS_SCERR_WASM_NO_TRANSFER);
return false;
}

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

@ -1,10 +1,4 @@
[transfer-errors.window.html]
[Serialize should make the ArrayBuffer detached, so it cannot be transferred again]
expected: FAIL
[Cannot transfer ArrayBuffer detached while the message was serialized]
expected: FAIL
[Cannot transfer the same OffscreenCanvas twice]
expected: FAIL