[PATCH 11/11] jscript: Return JS_E_OBJECT_NOT_COLLECTION when object has no DISPID_NEWENUM.

Gabriel Ivăncescu gabrielopcode at gmail.com
Mon Sep 20 09:46:17 CDT 2021


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/jscript/enumerator.c         | 4 ++--
 dlls/jscript/error.c              | 1 +
 dlls/jscript/jscript.h            | 1 +
 dlls/jscript/jscript.rc           | 1 +
 dlls/jscript/resource.h           | 1 +
 dlls/mshtml/tests/documentmode.js | 1 -
 6 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/jscript/enumerator.c b/dlls/jscript/enumerator.c
index bdbebf7..5255448 100644
--- a/dlls/jscript/enumerator.c
+++ b/dlls/jscript/enumerator.c
@@ -248,7 +248,7 @@ static HRESULT create_enumerator(script_ctx_t *ctx, jsval_t *argv, jsdisp_t **re
         if (FAILED(hres))
         {
             WARN("Enumerator: no DISPID_NEWENUM.\n");
-            return E_INVALIDARG;
+            return JS_E_OBJECT_NOT_COLLECTION;
         }
 
         if ((V_VT(&varresult) == VT_DISPATCH) || (V_VT(&varresult) == VT_UNKNOWN))
@@ -259,7 +259,7 @@ static HRESULT create_enumerator(script_ctx_t *ctx, jsval_t *argv, jsdisp_t **re
         else
         {
             FIXME("Enumerator: NewEnum unexpected type of varresult (%d).\n", V_VT(&varresult));
-            hres = E_INVALIDARG;
+            hres = JS_E_OBJECT_NOT_COLLECTION;
         }
         VariantClear(&varresult);
         if (FAILED(hres))
diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c
index bb9e5a2..63c957f 100644
--- a/dlls/jscript/error.c
+++ b/dlls/jscript/error.c
@@ -461,6 +461,7 @@ jsdisp_t *create_builtin_error(script_ctx_t *ctx)
         case JS_E_INVALID_PROPERTY:
         case JS_E_INVALID_ACTION:
         case JS_E_MISSING_ARG:
+        case JS_E_OBJECT_NOT_COLLECTION:
         case JS_E_FUNCTION_EXPECTED:
         case JS_E_DATE_EXPECTED:
         case JS_E_NUMBER_EXPECTED:
diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h
index 1d14271..58433d0 100644
--- a/dlls/jscript/jscript.h
+++ b/dlls/jscript/jscript.h
@@ -573,6 +573,7 @@ static inline DWORD make_grfdex(script_ctx_t *ctx, DWORD flags)
 #define JS_E_INVALID_PROPERTY        MAKE_JSERROR(IDS_NO_PROPERTY)
 #define JS_E_INVALID_ACTION          MAKE_JSERROR(IDS_UNSUPPORTED_ACTION)
 #define JS_E_MISSING_ARG             MAKE_JSERROR(IDS_ARG_NOT_OPT)
+#define JS_E_OBJECT_NOT_COLLECTION   MAKE_JSERROR(IDS_OBJECT_NOT_COLLECTION)
 #define JS_E_SYNTAX                  MAKE_JSERROR(IDS_SYNTAX_ERROR)
 #define JS_E_MISSING_SEMICOLON       MAKE_JSERROR(IDS_SEMICOLON)
 #define JS_E_MISSING_LBRACKET        MAKE_JSERROR(IDS_LBRACKET)
diff --git a/dlls/jscript/jscript.rc b/dlls/jscript/jscript.rc
index 50e2c30..45e1e27 100644
--- a/dlls/jscript/jscript.rc
+++ b/dlls/jscript/jscript.rc
@@ -33,6 +33,7 @@ STRINGTABLE
     IDS_NO_PROPERTY         "Object doesn't support this property or method"
     IDS_UNSUPPORTED_ACTION  "Object doesn't support this action"
     IDS_ARG_NOT_OPT         "Argument not optional"
+    IDS_OBJECT_NOT_COLLECTION "Object not a collection"
     IDS_SYNTAX_ERROR        "Syntax error"
     IDS_SEMICOLON           "Expected ';'"
     IDS_LBRACKET            "Expected '('"
diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h
index b17f9fb..68e88db 100644
--- a/dlls/jscript/resource.h
+++ b/dlls/jscript/resource.h
@@ -31,6 +31,7 @@
 #define IDS_NO_PROPERTY                     0x01B6
 #define IDS_UNSUPPORTED_ACTION              0x01BD
 #define IDS_ARG_NOT_OPT                     0x01c1
+#define IDS_OBJECT_NOT_COLLECTION           0x01c3
 #define IDS_SYNTAX_ERROR                    0x03EA
 #define IDS_SEMICOLON                       0x03EC
 #define IDS_LBRACKET                        0x03ED
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js
index 1fb0721..5e4292c 100644
--- a/dlls/mshtml/tests/documentmode.js
+++ b/dlls/mshtml/tests/documentmode.js
@@ -922,7 +922,6 @@ sync_test("builtin_obj", function() {
         }catch(ex) {
             e = ex.number;
         }
-        todo_wine.
         ok(e === 0xa01c3 - 0x80000000, "[style Enumerator] e = " + e);
 
         f.apply = 0;
-- 
2.31.1




More information about the wine-devel mailing list