From 17c1cc47cffb144fea27201e7bcc2cdf68be249b Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Wed, 5 Jan 2005 01:02:13 +0000 Subject: [PATCH] Make XBL constructors/destructors check whether JS is enabled before running once again. Bug 276205, r+sr=jst --- content/xbl/src/nsXBLProtoImplMethod.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/content/xbl/src/nsXBLProtoImplMethod.cpp b/content/xbl/src/nsXBLProtoImplMethod.cpp index 748e0be7e928..cefb3b370822 100644 --- a/content/xbl/src/nsXBLProtoImplMethod.cpp +++ b/content/xbl/src/nsXBLProtoImplMethod.cpp @@ -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) {