bug 580128 - Remove vestiges of old wrappers from nsDOMClassInfo. r=mrbkap

This commit is contained in:
Andreas Gal 2010-10-10 15:41:27 -07:00
parent fa5d3f82f5
commit 1219a88f7e
3 changed files with 2 additions and 49 deletions

View File

@ -43,6 +43,7 @@
#include "jscntxt.h"
#include "jsobj.h"
#include "jsdbgapi.h"
#include "WrapperFactory.h"
#include "nscore.h"
#include "nsDOMClassInfo.h"
@ -1621,8 +1622,6 @@ jsid nsDOMClassInfo::sOnafterscriptexecute_id = JSID_VOID;
jsid nsDOMClassInfo::sWrappedJSObject_id = JSID_VOID;
static const JSClass *sObjectClass = nsnull;
JSPropertyOp nsDOMClassInfo::sXPCNativeWrapperGetPropertyOp = nsnull;
JSPropertyOp nsDOMClassInfo::sXrayWrapperPropertyHolderGetPropertyOp = nsnull;
/**
* Set our JSClass pointer for the Object class
@ -1918,22 +1917,7 @@ nsDOMClassInfo::ThrowJSException(JSContext *cx, nsresult aResult)
PRBool
nsDOMClassInfo::ObjectIsNativeWrapper(JSContext* cx, JSObject* obj)
{
#ifdef DEBUG
{
nsIScriptContext *scx = GetScriptContextFromJSContext(cx);
NS_PRECONDITION(!scx || !scx->IsContextInitialized() ||
sXPCNativeWrapperGetPropertyOp,
"Must know what the XPCNativeWrapper class GetProperty op is!");
}
#endif
if (obj->isWrapper())
return PR_TRUE;
JSPropertyOp op = obj->getJSClass()->getProperty;
return !!op && (op == sXPCNativeWrapperGetPropertyOp ||
op == sXrayWrapperPropertyHolderGetPropertyOp);
return xpc::WrapperFactory::IsXrayWrapper(obj);
}
nsDOMClassInfo::nsDOMClassInfo(nsDOMClassInfoData* aData) : mData(aData)

View File

@ -177,24 +177,6 @@ public:
static nsresult ThrowJSException(JSContext *cx, nsresult aResult);
static JSPropertyOp GetXPCNativeWrapperGetPropertyOp() {
return sXPCNativeWrapperGetPropertyOp;
}
static void SetXPCNativeWrapperGetPropertyOp(JSPropertyOp getPropertyOp) {
NS_ASSERTION(!sXPCNativeWrapperGetPropertyOp,
"Double set of sXPCNativeWrapperGetPropertyOp");
sXPCNativeWrapperGetPropertyOp = getPropertyOp;
}
static JSPropertyOp GetXrayWrapperPropertyHolderGetPropertyOp() {
return sXrayWrapperPropertyHolderGetPropertyOp;
}
static void SetXrayWrapperPropertyHolderGetPropertyOp(JSPropertyOp getPropertyOp) {
sXrayWrapperPropertyHolderGetPropertyOp = getPropertyOp;
}
static PRBool ObjectIsNativeWrapper(JSContext* cx, JSObject* obj);
static nsISupports *GetNative(nsIXPConnectWrappedNative *wrapper, JSObject *obj);

View File

@ -2571,19 +2571,6 @@ nsJSContext::InitContext()
::JS_SetErrorReporter(mContext, NS_ScriptErrorReporter);
nsIXPConnect *xpc = nsContentUtils::XPConnect();
if (!nsDOMClassInfo::GetXPCNativeWrapperGetPropertyOp()) {
JSPropertyOp getProperty;
xpc->GetNativeWrapperGetPropertyOp(&getProperty);
nsDOMClassInfo::SetXPCNativeWrapperGetPropertyOp(getProperty);
}
if (!nsDOMClassInfo::GetXrayWrapperPropertyHolderGetPropertyOp()) {
JSPropertyOp getProperty;
xpc->GetXrayWrapperPropertyHolderGetPropertyOp(&getProperty);
nsDOMClassInfo::SetXrayWrapperPropertyHolderGetPropertyOp(getProperty);
}
return NS_OK;
}