Make XBL constructors/destructors check whether JS is enabled before running

once again. Bug 276205, r+sr=jst
This commit is contained in:
bzbarsky%mit.edu 2005-01-05 01:02:13 +00:00
Родитель a692c65a75
Коммит 17c1cc47cf
1 изменённых файлов: 10 добавлений и 3 удалений

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

@ -48,6 +48,7 @@
#include "nsXBLProtoImplMethod.h"
#include "nsIScriptContext.h"
#include "nsContentUtils.h"
#include "nsIScriptSecurityManager.h"
MOZ_DECL_CTOR_COUNTER(nsXBLProtoImplMethod)
@ -288,9 +289,15 @@ nsXBLProtoImplAnonymousMethod::Execute(nsIContent* aBoundElement)
if (NS_FAILED(rv))
return rv;
jsval retval;
JSBool ok = ::JS_CallFunctionValue(cx, thisObject, OBJECT_TO_JSVAL(method),
0 /* argc */, nsnull /* argv */, &retval);
// Check whether it's OK to call the method.
rv = nsContentUtils::GetSecurityManager()->CheckFunctionAccess(cx, method, thisObject);
JSBool ok = JS_TRUE;
if (NS_SUCCEEDED(rv)) {
jsval retval;
ok = ::JS_CallFunctionValue(cx, thisObject, OBJECT_TO_JSVAL(method),
0 /* argc */, nsnull /* argv */, &retval);
}
cxstack->Pop(&cx);
if (!ok) {