<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Hi Gabriel,</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">First of all, this patch breaks mshtml
      script tests. It's likely that it's mshtml's fault, but we need to
      get it working.<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">On 19.02.2020 17:38, Gabriel Ivăncescu
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:140314ef41b6265075d94374005c6251ba2cf293.1582130054.git.gabrielopcode@gmail.com">
      <div class="moz-text-plain" wrap="true" graphical-quote="true"
        style="font-family: -moz-fixed; font-size: 12px;"
        lang="x-unicode">
        <pre class="moz-quote-pre" wrap="">-void enter_script(script_ctx_t *ctx, jsexcept_t *ei)
+HRESULT enter_script(script_ctx_t *ctx, named_item_t *item, jsexcept_t *ei)
 {
+    HRESULT hres;
+
     memset(ei, 0, sizeof(*ei));
+    if(item) {
+        if(!item->script_obj) {
+            hres = create_named_item_script_obj(ctx, item);
+            if(FAILED(hres)) return hres;
+        }</pre>
      </div>
    </blockquote>
    <p><br>
    </p>
    <p>Can we have it in exec_source instead? If nothing else, it would
      simplify enter_script error handling.<br>
    </p>
    <p><br>
    </p>
    <blockquote type="cite"
cite="mid:140314ef41b6265075d94374005c6251ba2cf293.1582130054.git.gabrielopcode@gmail.com">
      <div class="moz-text-plain" wrap="true" graphical-quote="true"
        style="font-family: -moz-fixed; font-size: 12px;"
        lang="x-unicode">
        <pre class="moz-quote-pre" wrap="">diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h
index 8297838..9492f3f 100644
--- a/dlls/jscript/jscript.h
+++ b/dlls/jscript/jscript.h
@@ -205,7 +205,9 @@ typedef HRESULT (<b class="moz-txt-star"><span class="moz-txt-tag">*</span>builtin_setter_t)(script_ctx_t<span class="moz-txt-tag">*</span></b>,jsdisp_t*,jsval_t);
 HRESULT builtin_set_const(script_ctx_t*,jsdisp_t*,jsval_t) DECLSPEC_HIDDEN;
 
 typedef struct named_item_t {
+    jsdisp_t *script_obj;
     IDispatch *disp;
+    unsigned ref;</pre>
      </div>
    </blockquote>
    <p><br>
    </p>
    <p>Maybe ref counting would make sense in a separated patch?<br>
    </p>
    <p><br>
    </p>
    <blockquote type="cite"
cite="mid:140314ef41b6265075d94374005c6251ba2cf293.1582130054.git.gabrielopcode@gmail.com">
      <div class="moz-text-plain" wrap="true" graphical-quote="true"
        style="font-family: -moz-fixed; font-size: 12px;"
        lang="x-unicode">
        <pre class="moz-quote-pre" wrap="">
     DWORD flags;
     LPWSTR name;
 
@@ -213,6 +215,7 @@ typedef struct named_item_t {
 } named_item_t;
 
 named_item_t <b class="moz-txt-star"><span class="moz-txt-tag">*</span>lookup_named_item(script_ctx_t<span class="moz-txt-tag">*</span></b>,const WCHAR*,unsigned) DECLSPEC_HIDDEN;
+void release_named_item(named_item_t*) DECLSPEC_HIDDEN;
 
 typedef struct {
     const WCHAR *name;
@@ -243,6 +246,7 @@ struct jsdisp_t {
     DWORD prop_cnt;
     dispex_prop_t *props;
     script_ctx_t *ctx;
+    named_item_t *named_item;</pre>
      </div>
    </blockquote>
    <p><br>
    </p>
    <p>I'd rather avoid having it here. I think that we should almost
      always be getting it from bytecode. In some corner cases, jsexcept
      should be enough to fill the gap.<br>
    </p>
    <p><br>
    </p>
    <p> </p>
    <blockquote type="cite"
cite="mid:140314ef41b6265075d94374005c6251ba2cf293.1582130054.git.gabrielopcode@gmail.com">
      <div class="moz-text-plain" wrap="true" graphical-quote="true"
        style="font-family: -moz-fixed; font-size: 12px;"
        lang="x-unicode">
        <pre class="moz-quote-pre" wrap="">     jsdisp_t *prototype;
 
@@ -433,6 +437,7 @@ struct _script_ctx_t {
     DWORD last_match_length;
 
     jsdisp_t *global;
+    jsdisp_t *item_context;</pre>
      </div>
    </blockquote>
    <p><br>
    </p>
    <p>Same here, do we really need it?<br>
    </p>
    <p><br>
    </p>
    <p>Thanks,</p>
    <p>Jacek<br>
    </p>
    <p><br>
    </p>
  </body>
</html>