Skip to content

Commit 130e608

Browse files
winesyncMishaProductions
authored andcommitted
[WINESYNC] jscript: Throw proper stack overflow exception.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 3e9d32ca43b71be2a8e64984b81742316d21527b by Jacek Caban <jacek@codeweavers.com>
1 parent 3882c20 commit 130e608

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

dll/win32/jscript/engine.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static const size_t stack_size = 0x4000;
7171
static HRESULT stack_push(script_ctx_t *ctx, jsval_t v)
7272
{
7373
if(ctx->stack_top == stack_size)
74-
return E_OUTOFMEMORY;
74+
return JS_E_STACK_OVERFLOW;
7575

7676
ctx->stack[ctx->stack_top++] = v;
7777
return S_OK;

dll/win32/jscript/jscript.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ static inline DWORD make_grfdex(script_ctx_t *ctx, DWORD flags)
527527
#define JS_E_TO_PRIMITIVE MAKE_JSERROR(IDS_TO_PRIMITIVE)
528528
#define JS_E_INVALIDARG MAKE_JSERROR(IDS_INVALID_CALL_ARG)
529529
#define JS_E_SUBSCRIPT_OUT_OF_RANGE MAKE_JSERROR(IDS_SUBSCRIPT_OUT_OF_RANGE)
530+
#define JS_E_STACK_OVERFLOW MAKE_JSERROR(IDS_STACK_OVERFLOW)
530531
#define JS_E_OBJECT_REQUIRED MAKE_JSERROR(IDS_OBJECT_REQUIRED)
531532
#define JS_E_CANNOT_CREATE_OBJ MAKE_JSERROR(IDS_CREATE_OBJ_ERROR)
532533
#define JS_E_INVALID_PROPERTY MAKE_JSERROR(IDS_NO_PROPERTY)

dll/win32/jscript/resource.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#define IDS_TO_PRIMITIVE 0x0001
2828
#define IDS_INVALID_CALL_ARG 0x0005
2929
#define IDS_SUBSCRIPT_OUT_OF_RANGE 0x0009
30+
#define IDS_STACK_OVERFLOW 0x001C
3031
#define IDS_OBJECT_REQUIRED 0x01A8
3132
#define IDS_CREATE_OBJ_ERROR 0x01AD
3233
#define IDS_NO_PROPERTY 0x01B6

modules/rostests/winetests/jscript/api.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2507,7 +2507,9 @@ var exception_array = {
25072507
E_REGEXP_SYNTAX_ERROR: { type: "RegExpError", number: -2146823271 },
25082508

25092509
E_URI_INVALID_CHAR: { type: "URIError", number: -2146823264 },
2510-
E_URI_INVALID_CODING: { type: "URIError", number: -2146823263 }
2510+
E_URI_INVALID_CODING: { type: "URIError", number: -2146823263 },
2511+
2512+
E_STACK_OVERFLOW: { type: "Error", number: -2146828260 }
25112513
};
25122514

25132515
function testException(func, id) {
@@ -2519,10 +2521,12 @@ function testException(func, id) {
25192521
} catch(e) {
25202522
ret = e.name;
25212523
num = e.number;
2524+
trace(e.message);
25222525
}
25232526

25242527
ok(ret === ex.type, "Exception test, ret = " + ret + ", expected " + ex.type +". Executed function: " + func.toString());
2525-
ok(num === ex.number, "Exception test, num = " + num + ", expected " + ex.number + ". Executed function: " + func.toString());
2528+
ok(num === ex.number, "Exception test, num = " + num + " (" + (num + 0x80000000).toString(16) + "), expected " + ex.number
2529+
+ ". Executed function: " + func.toString());
25262530
}
25272531

25282532
// RangeError tests
@@ -2565,6 +2569,8 @@ testException(function() {undefined.toString();}, "E_OBJECT_EXPECTED");
25652569
testException(function() {null.toString();}, "E_OBJECT_EXPECTED");
25662570
testException(function() {RegExp.prototype.toString.call(new Object());}, "E_REGEXP_EXPECTED");
25672571

2572+
testException(function() { return arguments.callee(); }, "E_STACK_OVERFLOW");
2573+
25682574
obj = new Object();
25692575
obj.prop = 1;
25702576
tmp = false;

sdk/tools/winesync/jscript.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ directories:
33
dlls/jscript/tests: modules/rostests/winetests/jscript
44
files: null
55
tags:
6-
wine: 2c21d0344cae7ee0c3205393b518a75ab882d535
6+
wine: 3e9d32ca43b71be2a8e64984b81742316d21527b

0 commit comments

Comments
 (0)