diff --git a/mozjs/js/src/vm/SelfHosting.cpp b/mozjs/js/src/vm/SelfHosting.cpp index 4395c09..3cc6f73 100644 --- a/mozjs/js/src/vm/SelfHosting.cpp +++ b/mozjs/js/src/vm/SelfHosting.cpp @@ -875,6 +875,23 @@ intrinsic_ConstructorForTypedArray(JSContext *cx, unsigned argc, Value *vp) return true; } +static bool intrinsic_CheckDOMProtochain(JSContext *cx, unsigned argc, Value *vp) +{ + CallArgs args = CallArgsFromVp(argc, vp); + MOZ_ASSERT(args.length() == 3); + MOZ_ASSERT(args[0].isObject()); + MOZ_ASSERT(args[1].isInt32()); + MOZ_ASSERT(args[2].isInt32()); + + RootedObject object(cx, &args[0].toObject()); + const Class *clasp = object->getClass(); + bool match = clasp->isDOMClass() && + cx->runtime()->DOMcallbacks->instanceClassMatchesProto( + clasp, args[1].toInt32(), args[2].toInt32()); + args.rval().setBoolean(match); + return true; +} + // The self-hosting global isn't initialized with the normal set of builtins. // Instead, individual C++-implemented functions that're required by // self-hosted code are defined as global functions. Accessing these @@ -1071,6 +1088,8 @@ static const JSFunctionSpec intrinsic_functions[] = { JS_FN("regexp_test_no_statics", regexp_test_no_statics, 2,0), JS_FN("regexp_construct_no_statics", regexp_construct_no_statics, 2,0), + JS_FN("CheckDOMProtochain", intrinsic_CheckDOMProtochain, 3, 0), + JS_FS_END };