TestingFunctions.h (1691B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * vim: set ts=8 sts=2 et sw=2 tw=80: 3 * This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef builtin_TestingFunctions_h 8 #define builtin_TestingFunctions_h 9 10 #include "NamespaceImports.h" // JSContext, JSFunction, HandleObject, HandleValue, Value 11 12 namespace js { 13 14 [[nodiscard]] bool InitTestingFunctions(); 15 16 [[nodiscard]] bool DefineTestingFunctions(JSContext* cx, HandleObject obj, 17 bool fuzzingSafe, 18 bool disableOOMFunctions); 19 20 [[nodiscard]] bool testingFunc_assertFloat32(JSContext* cx, unsigned argc, 21 Value* vp); 22 23 [[nodiscard]] bool testingFunc_assertRecoveredOnBailout(JSContext* cx, 24 unsigned argc, 25 Value* vp); 26 27 [[nodiscard]] bool testingFunc_serialize(JSContext* cx, unsigned argc, 28 Value* vp); 29 30 extern JSScript* TestingFunctionArgumentToScript(JSContext* cx, HandleValue v, 31 JSFunction** funp = nullptr); 32 33 #ifdef FUZZING_JS_FUZZILLI 34 uint32_t FuzzilliHashDouble(double value); 35 36 uint32_t FuzzilliHashBigInt(BigInt* bigInt); 37 38 void FuzzilliHashObjectInl(JSContext* cx, JSObject* obj, uint32_t* out); 39 void FuzzilliHashObject(JSContext* cx, JSObject* obj); 40 #endif 41 42 } /* namespace js */ 43 44 #endif /* builtin_TestingFunctions_h */