Bug 1063521. Remove the WANT_OUTER_OBJECT classinfo flag, since it's now unused. r=bholley

This commit is contained in:
Boris Zbarsky 2014-09-08 10:05:11 -04:00
parent bd61631828
commit dae60ad74d
5 changed files with 1 additions and 83 deletions

View File

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

View File

@ -31,7 +31,7 @@ interface nsIXPConnectWrappedNative;
* boolean to PR_TRUE before making the call. Implementations may skip writing
* to *_retval unless they want to return PR_FALSE.
*/
[uuid(9bae4ff5-5618-4ccd-b106-8e21e3fb64d3)]
[uuid(d945a647-a60e-462d-9635-c79d5fa694ce)]
interface nsIXPCScriptable : nsISupports
{
/* bitflags used for 'flags' (only 32 bits available!) */
@ -64,8 +64,6 @@ interface nsIXPCScriptable : nsISupports
const uint32_t ALLOW_PROP_MODS_TO_PROTOTYPE = 1 << 25;
const uint32_t IS_GLOBAL_OBJECT = 1 << 26;
const uint32_t DONT_REFLECT_INTERFACE_NAMES = 1 << 27;
// Unused bit here!
const uint32_t WANT_OUTER_OBJECT = 1 << 29;
// The high order bit is RESERVED for consumers of these flags.
// No implementor of this interface should ever return flags
@ -140,9 +138,6 @@ interface nsIXPCScriptable : nsISupports
in JSContextPtr cx, in JSObjectPtr obj,
in jsval val, out boolean bp);
JSObjectPtr outerObject(in nsIXPConnectWrappedNative wrapper,
in JSContextPtr cx, in JSObjectPtr obj);
void postCreatePrototype(in JSContextPtr cx, in JSObjectPtr proto);
};

View File

@ -76,9 +76,6 @@ XPC_MAP_CLASSNAME::GetScriptableFlags()
#ifdef XPC_MAP_WANT_HASINSTANCE
nsIXPCScriptable::WANT_HASINSTANCE |
#endif
#ifdef XPC_MAP_WANT_OUTER_OBJECT
nsIXPCScriptable::WANT_OUTER_OBJECT |
#endif
#ifdef XPC_MAP_FLAGS
XPC_MAP_FLAGS |
#endif
@ -166,11 +163,6 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::HasInstance(nsIXPConnectWrappedNative *wrapper,
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
#endif
#ifndef XPC_MAP_WANT_OUTER_OBJECT
NS_IMETHODIMP XPC_MAP_CLASSNAME::OuterObject(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;}
@ -241,10 +233,6 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::PostCreatePrototype(JSContext *cx, JSObject *pr
#undef XPC_MAP_WANT_HASINSTANCE
#endif
#ifdef XPC_MAP_WANT_OUTER_OBJECT
#undef XPC_MAP_WANT_OUTER_OBJECT
#endif
#ifdef XPC_MAP_WANT_POST_CREATE_PROTOTYPE
#undef XPC_MAP_WANT_POST_CREATE_PROTOTYPE
#endif

View File

@ -629,42 +629,6 @@ XPC_WN_NoHelper_Resolve(JSContext *cx, HandleObject obj, HandleId id)
JSPROP_PERMANENT, nullptr);
}
static JSObject *
XPC_WN_OuterObject(JSContext *cx, HandleObject objArg)
{
JSObject *obj = objArg;
XPCWrappedNative *wrapper = XPCWrappedNative::Get(obj);
if (!wrapper) {
Throw(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO, cx);
return nullptr;
}
if (!wrapper->IsValid()) {
Throw(NS_ERROR_XPC_HAS_BEEN_SHUTDOWN, cx);
return nullptr;
}
XPCNativeScriptableInfo* si = wrapper->GetScriptableInfo();
if (si && si->GetFlags().WantOuterObject()) {
RootedObject newThis(cx);
nsresult rv =
si->GetCallback()->OuterObject(wrapper, cx, obj, newThis.address());
if (NS_FAILED(rv)) {
Throw(rv, cx);
return nullptr;
}
obj = newThis;
}
return obj;
}
const XPCWrappedNativeJSClass XPC_WN_NoHelper_JSClass = {
{ // base
"XPCWrappedNative_NoHelper", // name;
@ -1172,24 +1136,8 @@ XPCNativeScriptableShared::PopulateJSClass()
// We have to figure out resolve strategy at call time
mJSClass.base.resolve = (JSResolveOp) XPC_WN_Helper_NewResolve;
// We need to respect content-defined toString() hooks on Window objects.
// In particular, js::DefaultValue checks for a convert stub, and the one
// we would install below ignores anything implemented in JS.
//
// We've always had this behavior for most XPCWrappedNative-implemented
// objects. However, Window was special, because the outer-window proxy
// had a null convert hook, which means that we'd end up with the default
// JS-engine behavior (which respects toString() overrides). We've fixed
// the convert hook on the outer-window proxy to invoke the defaultValue
// hook on the proxy, which in this case invokes js::DefaultValue on the
// target. So now we need to special-case this for Window to maintain
// consistent behavior. This can go away once Window is on WebIDL bindings.
//
// Note that WantOuterObject() is true if and only if this is a Window object.
if (mFlags.WantConvert())
mJSClass.base.convert = XPC_WN_Helper_Convert;
else if (mFlags.WantOuterObject())
mJSClass.base.convert = JS_ConvertStub;
else
mJSClass.base.convert = XPC_WN_Shared_Convert;
@ -1216,9 +1164,6 @@ XPCNativeScriptableShared::PopulateJSClass()
else
mJSClass.base.trace = XPCWrappedNative::Trace;
if (mFlags.WantOuterObject())
mJSClass.base.ext.outerObject = XPC_WN_OuterObject;
mJSClass.base.ext.isWrappedNative = true;
}

View File

@ -1623,7 +1623,6 @@ public:
bool WantCall() GET_IT(WANT_CALL)
bool WantConstruct() GET_IT(WANT_CONSTRUCT)
bool WantHasInstance() GET_IT(WANT_HASINSTANCE)
bool WantOuterObject() GET_IT(WANT_OUTER_OBJECT)
bool UseJSStubForAddProperty() GET_IT(USE_JSSTUB_FOR_ADDPROPERTY)
bool UseJSStubForDelProperty() GET_IT(USE_JSSTUB_FOR_DELPROPERTY)
bool UseJSStubForSetProperty() GET_IT(USE_JSSTUB_FOR_SETPROPERTY)