Part of fix for bug 219848 (Cannot programmatically (JavaScript) set value of HTMLInputElement) - don't do security checks when defining DOM classes. r=caillon, sr=jst.

This commit is contained in:
peter%propagandism.org 2003-11-12 14:25:03 +00:00
Родитель 855dfc21b0
Коммит 6ebcad9b9f
1 изменённых файлов: 14 добавлений и 3 удалений

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

@ -1315,6 +1315,7 @@ nsDOMClassInfo::Init()
nsCOMPtr<nsIComponentRegistrar> cr;
NS_GetComponentRegistrar(getter_AddRefs(cr));
const nsIID* xpathEvaluatorIID = nsnull;
if (cr) {
PRBool haveXPathDOM;
@ -3703,8 +3704,13 @@ nsWindowSH::GlobalResolve(nsISupports *native, JSContext *cx, JSObject *obj,
// We're resolving a name of a DOM interface for which there is no
// direct DOM class, create a constructor object...
sDoSecurityCheckInAddProperty = PR_FALSE;
JSObject* class_obj = ::JS_DefineObject(cx, obj, ::JS_GetStringBytes(str),
&sDOMJSClass, 0, 0);
sDoSecurityCheckInAddProperty = PR_TRUE;
if (!class_obj) {
return NS_ERROR_UNEXPECTED;
}
@ -3750,8 +3756,13 @@ nsWindowSH::GlobalResolve(nsISupports *native, JSContext *cx, JSObject *obj,
}
}
sDoSecurityCheckInAddProperty = PR_FALSE;
JSObject* class_obj = ::JS_DefineObject(cx, obj, ::JS_GetStringBytes(str),
&sDOMJSClass, 0, 0);
sDoSecurityCheckInAddProperty = PR_TRUE;
if (!class_obj) {
return NS_ERROR_UNEXPECTED;
}
@ -4795,7 +4806,7 @@ nsArraySH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSObject *obj, jsval id, jsval *vp, PRBool *_retval)
{
PRBool is_number = PR_FALSE;
int32 n = GetArrayIndexFromId(cx, id, &is_number);
PRInt32 n = GetArrayIndexFromId(cx, id, &is_number);
if (is_number) {
if (n < 0) {
@ -5699,7 +5710,7 @@ nsHTMLSelectElementSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
JSContext *cx, JSObject *obj, jsval id,
jsval *vp, PRBool *_retval)
{
int32 n = GetArrayIndexFromId(cx, id);
PRInt32 n = GetArrayIndexFromId(cx, id);
if (n >= 0) {
nsCOMPtr<nsISupports> native;
@ -6157,7 +6168,7 @@ nsHTMLOptionsCollectionSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
JSContext *cx, JSObject *obj, jsval id,
jsval *vp, PRBool *_retval)
{
int32 n = GetArrayIndexFromId(cx, id);
PRInt32 n = GetArrayIndexFromId(cx, id);
if (n < 0) {
return NS_OK;