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

This commit is contained in:
jst%mozilla.org 2008-01-10 21:44:06 +00:00
Родитель e0d9f29103
Коммит 35d2ced02d
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -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