jscript: Added SCRIPTITEM_ISVISIBLE flag implementation.
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index ec503f6..ecf62ae 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -458,6 +458,16 @@
     }
 
     for(item = ctx->parser->script->named_items; item; item = item->next) {
+        if((item->flags & SCRIPTITEM_ISVISIBLE) && !strcmpW(item->name, identifier)) {
+            ret->type = EXPRVAL_VARIANT;
+            V_VT(&ret->u.var) = VT_DISPATCH;
+            V_DISPATCH(&ret->u.var) = item->disp;
+            IDispatch_AddRef(item->disp);
+            return S_OK;
+        }
+    }
+
+    for(item = ctx->parser->script->named_items; item; item = item->next) {
         hres = disp_get_id(item->disp, identifier, 0, &id);
         if(SUCCEEDED(hres))
             break;
diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c
index c4bd890..fb13d08 100644
--- a/dlls/jscript/jscript.c
+++ b/dlls/jscript/jscript.c
@@ -326,6 +326,7 @@
                 iter2 = iter->next;
 
                 IDispatch_Release(iter->disp);
+                heap_free(iter->name);
                 heap_free(iter);
                 iter = iter2;
             }
@@ -390,6 +391,13 @@
 
     item->disp = disp;
     item->flags = dwFlags;
+    item->name = heap_strdupW(pstrName);
+    if(!item->name) {
+        IDispatch_Release(disp);
+        heap_free(item);
+        return E_OUTOFMEMORY;
+    }
+
     item->next = This->ctx->named_items;
     This->ctx->named_items = item;
 
diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h
index b416f6e..6930ec6 100644
--- a/dlls/jscript/jscript.h
+++ b/dlls/jscript/jscript.h
@@ -154,6 +154,7 @@
 typedef struct named_item_t {
     IDispatch *disp;
     DWORD flags;
+    LPWSTR name;
 
     struct named_item_t *next;
 } named_item_t;
diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c
index 3904a36..20d710d 100644
--- a/dlls/jscript/tests/run.c
+++ b/dlls/jscript/tests/run.c
@@ -702,6 +702,8 @@
     parse_script_a("delete testObj.deleteTest;");
     CHECK_CALLED(testobj_delete);
 
+    parse_script_a("ok(typeof(test) === 'object', \"typeof(test) != 'object'\");");
+
     run_from_res("lang.js");
     run_from_res("api.js");
     run_from_res("regexp.js");