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
parent a692c65a75
commit 17c1cc47cf

View File

@ -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) {