Fixing bug 424019. Fix problem with NPN_RemoveProperty() claiming it removed a property when it in fact didn't. r+sr=brendan@mozilla.org

This commit is contained in:
jst@mozilla.org 2008-03-28 15:29:14 -07:00
parent 7598733582
commit f5ff3db7a8

View File

@ -858,10 +858,41 @@ nsJSObjWrapper::NP_RemoveProperty(NPObject *npobj, NPIdentifier identifier)
ok = ::JS_DeleteUCProperty2(cx, npjsobj->mJSObj, ::JS_GetStringChars(str),
::JS_GetStringLength(str), &deleted);
if (ok && deleted) {
// FIXME: See bug 425823, we shouldn't need to do this, and once
// that bug is fixed we can remove this code.
JSBool hasProp;
ok = ::JS_HasUCProperty(cx, npjsobj->mJSObj, ::JS_GetStringChars(str),
::JS_GetStringLength(str), &hasProp);
if (ok && hasProp) {
// The property might have been deleted, but it got
// re-resolved, so no, it's not really deleted.
deleted = JSVAL_FALSE;
}
}
} else {
NS_ASSERTION(JSVAL_IS_INT(id), "id must be either string or int!\n");
ok = ::JS_DeleteElement2(cx, npjsobj->mJSObj, JSVAL_TO_INT(id), &deleted);
if (ok && deleted) {
// FIXME: See bug 425823, we shouldn't need to do this, and once
// that bug is fixed we can remove this code.
JSBool hasProp;
ok = ::JS_HasElement(cx, npjsobj->mJSObj, JSVAL_TO_INT(id), &hasProp);
if (ok && hasProp) {
// The property might have been deleted, but it got
// re-resolved, so no, it's not really deleted.
deleted = JSVAL_FALSE;
}
}
}
// return ok == JS_TRUE to quiet down compiler warning, even if