From 4dbd777de289ee58a11b2c9919e9b2765b81941a Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 17 Dec 2012 13:36:18 +0100 Subject: [PATCH] jscript: Fixed deleting nonexistent identifiers. --- dlls/jscript/engine.c | 16 +++++++++++----- dlls/jscript/tests/lang.js | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index fbfa460014..489aef6774 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -1631,16 +1631,22 @@ static HRESULT interp_delete_ident(exec_ctx_t *ctx) if(FAILED(hres)) return hres; - if(exprval.type != EXPRVAL_IDREF) { + switch(exprval.type) { + case EXPRVAL_IDREF: + hres = disp_delete(exprval.u.idref.disp, exprval.u.idref.id, &ret); + IDispatch_Release(exprval.u.idref.disp); + if(FAILED(hres)) + return ret; + break; + case EXPRVAL_INVALID: + ret = TRUE; + break; + default: FIXME("Unsupported exprval\n"); exprval_release(&exprval); return E_NOTIMPL; } - hres = disp_delete(exprval.u.idref.disp, exprval.u.idref.id, &ret); - IDispatch_Release(exprval.u.idref.disp); - if(FAILED(hres)) - return ret; return stack_push(ctx, jsval_bool(ret)); } diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js index f9c05bd77d..bac2debd71 100644 --- a/dlls/jscript/tests/lang.js +++ b/dlls/jscript/tests/lang.js @@ -1123,6 +1123,7 @@ for(iter in tmp) ok(false, "tmp has prop " + iter); ok((delete tmp.test) === true, "deleting test didn't return true"); ok((delete tmp.nonexistent) === true, "deleting nonexistent didn't return true"); +ok((delete nonexistent) === true, "deleting nonexistent didn't return true"); tmp = new Object(); tmp.test = false; -- 2.32.0.93.g670b81a890