Fixing bug 411040. Make NPN_RemoveProperty() return false if the property wasn't deleted (due to silent failure per ecma). r+sr+a=brendan@mozilla.org

git-svn-id: svn://10.0.0.236/trunk@242855 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jst%mozilla.org
2008-01-10 21:44:06 +00:00
parent 7ff2e90f7d
commit de63e533a4

View File

@@ -835,22 +835,22 @@ nsJSObjWrapper::NP_RemoveProperty(NPObject *npobj, NPIdentifier identifier)
AutoCXPusher pusher(cx);
JSAutoRequest ar(cx);
AutoJSExceptionReporter reporter(cx);
jsval deleted = JSVAL_FALSE;
if (JSVAL_IS_STRING(id)) {
JSString *str = JSVAL_TO_STRING(id);
jsval unused;
ok = ::JS_DeleteUCProperty2(cx, npjsobj->mJSObj, ::JS_GetStringChars(str),
::JS_GetStringLength(str), &unused);
::JS_GetStringLength(str), &deleted);
} else {
NS_ASSERTION(JSVAL_IS_INT(id), "id must be either string or int!\n");
ok = ::JS_DeleteElement(cx, npjsobj->mJSObj, JSVAL_TO_INT(id));
ok = ::JS_DeleteElement2(cx, npjsobj->mJSObj, JSVAL_TO_INT(id), &deleted);
}
// return ok == JS_TRUE to quiet down compiler warning, even if
// return ok is what we really want.
return ok == JS_TRUE;
return ok == JS_TRUE && deleted == JSVAL_TRUE;
}
//static