Bug 1728985 - Only expose WebAssembly.Function if it works; r=rhunt

Differential Revision: https://phabricator.services.mozilla.com/D124458
This commit is contained in:
Ms2ger 2021-09-04 16:34:49 +00:00
Родитель a38b85400e
Коммит 915ec43e3f
3 изменённых файлов: 13 добавлений и 7 удалений

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

@ -40,7 +40,13 @@
# define IF_INTL(REAL, IMAGINARY) IMAGINARY
#endif
#define JS_FOR_PROTOTYPES_(REAL, IMAGINARY, REAL_IF_INTL) \
#ifdef ENABLE_WASM_TYPE_REFLECTIONS
# define IF_WASM_TYPE(REAL, IMAGINARY) REAL
#else
# define IF_WASM_TYPE(REAL, IMAGINARY) IMAGINARY
#endif
#define JS_FOR_PROTOTYPES_(REAL, IMAGINARY, REAL_IF_INTL, REAL_IF_WASM_TYPE) \
IMAGINARY(Null, dummy) \
REAL(Object, OCLASP(Plain)) \
REAL(Function, &FunctionClass) \
@ -122,15 +128,16 @@
REAL(WasmTable, OCLASP(WasmTable)) \
REAL(WasmGlobal, OCLASP(WasmGlobal)) \
REAL(WasmTag, OCLASP(WasmTag)) \
REAL(WasmFunction, CLASP(WasmFunction)) \
REAL_IF_WASM_TYPE(WasmFunction, CLASP(WasmFunction)) \
REAL(WasmException, OCLASP(WasmException)) \
REAL(FinalizationRegistry, OCLASP(FinalizationRegistry)) \
REAL(WeakRef, OCLASP(WeakRef)) \
REAL(Iterator, OCLASP(Iterator)) \
REAL(AsyncIterator, OCLASP(AsyncIterator))
#define JS_FOR_PROTOTYPES(REAL, IMAGINARY) \
JS_FOR_PROTOTYPES_(REAL, IMAGINARY, IF_INTL(REAL, IMAGINARY))
#define JS_FOR_PROTOTYPES(REAL, IMAGINARY) \
JS_FOR_PROTOTYPES_(REAL, IMAGINARY, IF_INTL(REAL, IMAGINARY), \
IF_WASM_TYPE(REAL, IMAGINARY))
#define JS_FOR_EACH_PROTOTYPE(MACRO) JS_FOR_PROTOTYPES(MACRO, MACRO)

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

@ -162,7 +162,9 @@ bool GlobalObject::skipDeselectedConstructor(JSContext* cx, JSProtoKey key) {
case JSProto_WasmTable:
case JSProto_WasmGlobal:
case JSProto_WasmTag:
#ifdef ENABLE_WASM_TYPE_REFLECTIONS
case JSProto_WasmFunction:
#endif
case JSProto_WasmException:
return false;

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

@ -4310,9 +4310,6 @@ const ClassSpec WasmFunctionClassSpec = {CreateWasmFunctionConstructor,
const JSClass js::WasmFunctionClass = {
"WebAssembly.Function", 0, JS_NULL_CLASS_OPS, &WasmFunctionClassSpec};
#else
const JSClass js::WasmFunctionClass = {"WebAssembly.Function", 0,
JS_NULL_CLASS_OPS, JS_NULL_CLASS_SPEC};
#endif
// ============================================================================