@@ -77,27 +77,6 @@ namespace Request {
7777JSObject *response_promise (JSObject *obj);
7878}
7979
80- typedef bool InternalMethod (JSContext *cx, HandleObject receiver, HandleValue extra, CallArgs args);
81- template <InternalMethod fun> bool internal_method (JSContext *cx, unsigned argc, Value *vp) {
82- CallArgs args = CallArgsFromVp (argc, vp);
83- RootedObject self (cx, &js::GetFunctionNativeReserved (&args.callee (), 0 ).toObject ());
84- RootedValue extra (cx, js::GetFunctionNativeReserved (&args.callee (), 1 ));
85- return fun (cx, self, extra, args);
86- }
87-
88- template <InternalMethod fun>
89- JSObject *create_internal_method (JSContext *cx, HandleObject receiver,
90- HandleValue extra = JS::UndefinedHandleValue,
91- unsigned int nargs = 0 , const char *name = " " ) {
92- JSFunction *method = js::NewFunctionWithReserved (cx, internal_method<fun>, 1 , 0 , name);
93- if (!method)
94- return nullptr ;
95- RootedObject method_obj (cx, JS_GetFunctionObject (method));
96- js::SetFunctionNativeReserved (method_obj, 0 , JS::ObjectValue (*receiver));
97- js::SetFunctionNativeReserved (method_obj, 1 , extra);
98- return method_obj;
99- }
100-
10180template <InternalMethod fun>
10281bool enqueue_internal_method (JSContext *cx, HandleObject receiver,
10382 HandleValue extra = JS::UndefinedHandleValue, unsigned int nargs = 0 ,
0 commit comments