Backed out changeset 1c265164a571 due to orange. a=backout

This commit is contained in:
Johnny Stenback 2010-10-31 12:20:04 -07:00
Родитель 5f201bb544
Коммит 207fd76ace
5 изменённых файлов: 69 добавлений и 4 удалений

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

@ -4582,6 +4582,15 @@ nsDOMClassInfo::OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
return NS_ERROR_UNEXPECTED;
}
NS_IMETHODIMP
nsDOMClassInfo::InnerObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
JSObject * obj, JSObject * *_retval)
{
NS_WARNING("nsDOMClassInfo::InnerObject Don't call me!");
return NS_ERROR_UNEXPECTED;
}
static nsresult
GetExternalClassInfo(nsScriptNameSpaceManager *aNameSpaceManager,
const nsString &aName,

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

@ -80,7 +80,7 @@
* to *_retval unless they want to return PR_FALSE.
*/
[uuid(a40ce52e-2d8c-400f-9af2-f8784a656070)]
[uuid(5d309b93-e9b4-4374-bcd5-44245c83408f)]
interface nsIXPCScriptable : nsISupports
{
/* bitflags used for 'flags' (only 32 bits available!) */
@ -115,6 +115,7 @@ interface nsIXPCScriptable : nsISupports
const PRUint32 DONT_REFLECT_INTERFACE_NAMES = 1 << 27;
const PRUint32 WANT_EQUALITY = 1 << 28;
const PRUint32 WANT_OUTER_OBJECT = 1 << 29;
const PRUint32 WANT_INNER_OBJECT = 1 << 30;
// The high order bit is RESERVED for consumers of these flags.
// No implementor of this interface should ever return flags
@ -196,6 +197,9 @@ interface nsIXPCScriptable : nsISupports
JSObjectPtr outerObject(in nsIXPConnectWrappedNative wrapper,
in JSContextPtr cx, in JSObjectPtr obj);
JSObjectPtr innerObject(in nsIXPConnectWrappedNative wrapper,
in JSContextPtr cx, in JSObjectPtr obj);
void postCreatePrototype(in JSContextPtr cx, in JSObjectPtr proto);
};

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

@ -118,6 +118,10 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::GetScriptableFlags(PRUint32 *aFlags)
#ifdef XPC_MAP_WANT_OUTER_OBJECT
nsIXPCScriptable::WANT_OUTER_OBJECT |
#endif
#ifdef XPC_MAP_WANT_INNER_OBJECT
nsIXPCScriptable::WANT_INNER_OBJECT |
#endif
#ifdef XPC_MAP_FLAGS
XPC_MAP_FLAGS |
#endif
@ -223,6 +227,11 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::OuterObject(nsIXPConnectWrappedNative *wrapper,
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
#endif
#ifndef XPC_MAP_WANT_INNER_OBJECT
NS_IMETHODIMP XPC_MAP_CLASSNAME::InnerObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, JSObject * *_retval)
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
#endif
#ifndef XPC_MAP_WANT_POST_CREATE_PROTOTYPE
NS_IMETHODIMP XPC_MAP_CLASSNAME::PostCreatePrototype(JSContext *cx, JSObject *proto)
{return NS_OK;}

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

@ -2004,6 +2004,7 @@ public:
JSBool WantTrace() GET_IT(WANT_TRACE)
JSBool WantEquality() GET_IT(WANT_EQUALITY)
JSBool WantOuterObject() GET_IT(WANT_OUTER_OBJECT)
JSBool WantInnerObject() GET_IT(WANT_INNER_OBJECT)
JSBool UseJSStubForAddProperty() GET_IT(USE_JSSTUB_FOR_ADDPROPERTY)
JSBool UseJSStubForDelProperty() GET_IT(USE_JSSTUB_FOR_DELPROPERTY)
JSBool UseJSStubForSetProperty() GET_IT(USE_JSSTUB_FOR_SETPROPERTY)

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

@ -857,6 +857,45 @@ XPC_WN_OuterObject(JSContext *cx, JSObject *obj)
return obj;
}
static JSObject *
XPC_WN_InnerObject(JSContext *cx, JSObject *obj)
{
XPCWrappedNative *wrapper =
static_cast<XPCWrappedNative *>(obj->getPrivate());
if(!wrapper)
{
Throw(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO, cx);
return nsnull;
}
if(!wrapper->IsValid())
{
Throw(NS_ERROR_XPC_HAS_BEEN_SHUTDOWN, cx);
return nsnull;
}
XPCNativeScriptableInfo* si = wrapper->GetScriptableInfo();
if(si && si->GetFlags().WantInnerObject())
{
JSObject *newThis;
nsresult rv =
si->GetCallback()->InnerObject(wrapper, cx, obj, &newThis);
if(NS_FAILED(rv))
{
Throw(rv, cx);
return nsnull;
}
obj = newThis;
}
return obj;
}
js::Class XPC_WN_NoHelper_JSClass = {
"XPCWrappedNative_NoHelper", // name;
WRAPPER_SLOTS |
@ -886,8 +925,8 @@ js::Class XPC_WN_NoHelper_JSClass = {
// ClassExtension
{
JS_VALUEIFY(js::EqualityOp, XPC_WN_Equality),
nsnull, // outerObject
nsnull, // innerObject
XPC_WN_OuterObject,
XPC_WN_InnerObject,
nsnull, // iteratorObject
nsnull, // wrappedObject
},
@ -1550,8 +1589,11 @@ XPCNativeScriptableShared::PopulateJSClass(JSBool isGlobal)
if(mFlags.WantOuterObject())
mJSClass.base.ext.outerObject = XPC_WN_OuterObject;
if(mFlags.WantInnerObject())
mJSClass.base.ext.innerObject = XPC_WN_InnerObject;
if(!(mFlags & nsIXPCScriptable::WANT_OUTER_OBJECT))
if(!(mFlags & (nsIXPCScriptable::WANT_OUTER_OBJECT |
nsIXPCScriptable::WANT_INNER_OBJECT)))
mCanBeSlim = JS_TRUE;
}