Commit eb43d59e authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

jscript: Store the object prototype in the script context.

parent d1c51350
......@@ -1055,7 +1055,7 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
HRESULT init_global(script_ctx_t *ctx)
{
unsigned const_flags = ctx->version >= SCRIPTLANGUAGEVERSION_ES5 ? 0 : PROPF_WRITABLE;
jsdisp_t *math, *object_prototype, *constr;
jsdisp_t *math, *constr;
HRESULT hres;
if(ctx->global)
......@@ -1065,12 +1065,11 @@ HRESULT init_global(script_ctx_t *ctx)
if(FAILED(hres))
return hres;
hres = create_object_prototype(ctx, &object_prototype);
hres = create_object_prototype(ctx, &ctx->object_prototype);
if(FAILED(hres))
return hres;
hres = init_constructors(ctx, object_prototype);
jsdisp_release(object_prototype);
hres = init_constructors(ctx, ctx->object_prototype);
if(FAILED(hres))
return hres;
......
......@@ -483,6 +483,11 @@ static void decrease_state(JScript *This, SCRIPTSTATE state)
This->ctx->site = NULL;
}
if(This->ctx->object_prototype) {
jsdisp_release(This->ctx->object_prototype);
This->ctx->object_prototype = NULL;
}
if(This->ctx->global) {
jsdisp_release(This->ctx->global);
This->ctx->global = NULL;
......
......@@ -451,6 +451,7 @@ struct _script_ctx_t {
jsdisp_t *uri_error_constr;
jsdisp_t *number_constr;
jsdisp_t *object_constr;
jsdisp_t *object_prototype;
jsdisp_t *regexp_constr;
jsdisp_t *string_constr;
jsdisp_t *vbarray_constr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment