зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
ec6b483779
Коммит
5fd53e4401
|
@ -858,10 +858,41 @@ nsJSObjWrapper::NP_RemoveProperty(NPObject *npobj, NPIdentifier identifier)
|
||||||
|
|
||||||
ok = ::JS_DeleteUCProperty2(cx, npjsobj->mJSObj, ::JS_GetStringChars(str),
|
ok = ::JS_DeleteUCProperty2(cx, npjsobj->mJSObj, ::JS_GetStringChars(str),
|
||||||
::JS_GetStringLength(str), &deleted);
|
::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 {
|
} else {
|
||||||
NS_ASSERTION(JSVAL_IS_INT(id), "id must be either string or int!\n");
|
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);
|
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
|
// return ok == JS_TRUE to quiet down compiler warning, even if
|
||||||
|
|
Загрузка…
Ссылка в новой задаче