зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
e0d9f29103
Коммит
35d2ced02d
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче