jscript: Fixed deleting nonexistent identifiers.

This commit is contained in:
Jacek Caban 2012-12-17 13:36:18 +01:00 committed by Alexandre Julliard
parent 7f07bb9a7a
commit 4dbd777de2
2 changed files with 12 additions and 5 deletions

View File

@ -1631,16 +1631,22 @@ static HRESULT interp_delete_ident(exec_ctx_t *ctx)
if(FAILED(hres)) if(FAILED(hres))
return 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"); FIXME("Unsupported exprval\n");
exprval_release(&exprval); exprval_release(&exprval);
return E_NOTIMPL; 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)); return stack_push(ctx, jsval_bool(ret));
} }

View File

@ -1123,6 +1123,7 @@ for(iter in tmp)
ok(false, "tmp has prop " + iter); ok(false, "tmp has prop " + iter);
ok((delete tmp.test) === true, "deleting test didn't return true"); ok((delete tmp.test) === true, "deleting test didn't return true");
ok((delete tmp.nonexistent) === true, "deleting nonexistent 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 = new Object();
tmp.test = false; tmp.test = false;