return NJS_ERROR;
}
- engine->u.qjs.ctx = qjs_new_context(engine->u.qjs.rt, NULL, 1);
+ engine->u.qjs.ctx = qjs_new_context(engine->u.qjs.rt, NULL);
if (engine->u.qjs.ctx == NULL) {
njs_stderror("JS_NewContext() failed\n");
return NJS_ERROR;
JSContext *
-qjs_new_context(JSRuntime *rt, qjs_module_t **addons, _Bool eval)
+qjs_new_context(JSRuntime *rt, qjs_module_t **addons)
{
+ int ret;
+ JSAtom prop;
JSValue global_obj;
JSContext *ctx;
qjs_module_t **module;
JS_AddIntrinsicTypedArrays(ctx);
JS_AddIntrinsicPromise(ctx);
JS_AddIntrinsicBigInt(ctx);
-
- if (eval) {
- JS_AddIntrinsicEval(ctx);
- }
+ JS_AddIntrinsicEval(ctx);
for (module = qjs_modules; *module != NULL; module++) {
if ((*module)->init(ctx, (*module)->name) == NULL) {
JS_SetPropertyFunctionList(ctx, global_obj, qjs_global_proto,
njs_nitems(qjs_global_proto));
+ prop = JS_NewAtom(ctx, "eval");
+ if (prop == JS_ATOM_NULL) {
+ return NULL;
+ }
+
+ ret = JS_DeleteProperty(ctx, global_obj, prop, 0);
+ JS_FreeAtom(ctx, prop);
+ if (ret < 0) {
+ return NULL;
+ }
+
+ prop = JS_NewAtom(ctx, "Function");
+ if (prop == JS_ATOM_NULL) {
+ return NULL;
+ }
+
+ ret = JS_DeleteProperty(ctx, global_obj, prop, 0);
+ JS_FreeAtom(ctx, prop);
+ if (ret < 0) {
+ return NULL;
+ }
+
JS_FreeValue(ctx, global_obj);
return ctx;
} qjs_module_t;
-JSContext *qjs_new_context(JSRuntime *rt, qjs_module_t **addons, _Bool eval);
+JSContext *qjs_new_context(JSRuntime *rt, qjs_module_t **addons);
JSValue qjs_buffer_alloc(JSContext *ctx, size_t size);