mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 720580 - Introduce a flag for global natives and assert that we have it. r=mrbkap
This commit is contained in:
parent
c03737bfa1
commit
f43e9eb936
@ -548,6 +548,7 @@ static const char kDOMStringBundleURL[] =
|
||||
nsIXPCScriptable::WANT_ENUMERATE | \
|
||||
nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE | \
|
||||
nsIXPCScriptable::USE_STUB_EQUALITY_HOOK | \
|
||||
nsIXPCScriptable::IS_GLOBAL_OBJECT | \
|
||||
nsIXPCScriptable::WANT_OUTER_OBJECT)
|
||||
|
||||
#define NODE_SCRIPTABLE_FLAGS \
|
||||
@ -1549,7 +1550,7 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
NS_DEFINE_CLASSINFO_DATA(AnimationEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(ContentFrameMessageManager, nsEventTargetSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS | nsIXPCScriptable::IS_GLOBAL_OBJECT)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(FormData, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
@ -102,7 +102,7 @@ interface nsIXPCScriptable : nsISupports
|
||||
const PRUint32 CLASSINFO_INTERFACES_ONLY = 1 << 23;
|
||||
const PRUint32 ALLOW_PROP_MODS_DURING_RESOLVE = 1 << 24;
|
||||
const PRUint32 ALLOW_PROP_MODS_TO_PROTOTYPE = 1 << 25;
|
||||
// Unused bit here!
|
||||
const PRUint32 IS_GLOBAL_OBJECT = 1 << 26;
|
||||
const PRUint32 DONT_REFLECT_INTERFACE_NAMES = 1 << 27;
|
||||
const PRUint32 WANT_EQUALITY = 1 << 28;
|
||||
const PRUint32 WANT_OUTER_OBJECT = 1 << 29;
|
||||
|
@ -63,6 +63,7 @@ NS_IMPL_THREADSAFE_RELEASE(BackstagePass)
|
||||
nsIXPCScriptable::USE_JSSTUB_FOR_SETPROPERTY | \
|
||||
nsIXPCScriptable::DONT_ENUM_STATIC_PROPS | \
|
||||
nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE | \
|
||||
nsIXPCScriptable::IS_GLOBAL_OBJECT | \
|
||||
nsIXPCScriptable::DONT_REFLECT_INTERFACE_NAMES
|
||||
#include "xpc_map_end.h" /* This will #undef the above */
|
||||
|
||||
|
@ -1266,6 +1266,7 @@ nsXPConnect::InitClassesWithNewWrappedGlobal(JSContext * aJSContext,
|
||||
|
||||
nsresult rv;
|
||||
xpcObjectHelper helper(aCOMObj);
|
||||
MOZ_ASSERT(helper.GetScriptableFlags() & nsIXPCScriptable::IS_GLOBAL_OBJECT);
|
||||
if (!XPCConvert::NativeInterface2JSObject(ccx, &v,
|
||||
getter_AddRefs(holder),
|
||||
helper, &aIID, nsnull,
|
||||
|
@ -48,6 +48,7 @@
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -2021,6 +2022,7 @@ public:
|
||||
JSBool ClassInfoInterfacesOnly() GET_IT(CLASSINFO_INTERFACES_ONLY)
|
||||
JSBool AllowPropModsDuringResolve() GET_IT(ALLOW_PROP_MODS_DURING_RESOLVE)
|
||||
JSBool AllowPropModsToPrototype() GET_IT(ALLOW_PROP_MODS_TO_PROTOTYPE)
|
||||
JSBool IsGlobalObject() GET_IT(IS_GLOBAL_OBJECT)
|
||||
JSBool DontReflectInterfaceNames() GET_IT(DONT_REFLECT_INTERFACE_NAMES)
|
||||
JSBool UseStubEqualityHook() GET_IT(USE_STUB_EQUALITY_HOOK)
|
||||
|
||||
@ -3179,6 +3181,27 @@ public:
|
||||
return mXPCClassInfo.forget();
|
||||
}
|
||||
|
||||
// We assert that we can reach an nsIXPCScriptable somehow.
|
||||
PRUint32 GetScriptableFlags()
|
||||
{
|
||||
// Try getting an nsXPCClassInfo - this handles DOM scriptable helpers.
|
||||
nsCOMPtr<nsIXPCScriptable> sinfo = GetXPCClassInfo();
|
||||
|
||||
// If that didn't work, try just QI-ing. This handles BackstagePass.
|
||||
if (!sinfo)
|
||||
sinfo = do_QueryInterface(GetCanonical());
|
||||
|
||||
// We should have something by now.
|
||||
MOZ_ASSERT(sinfo);
|
||||
|
||||
// Grab the flags. This should not fail.
|
||||
PRUint32 flags;
|
||||
mozilla::DebugOnly<nsresult> rv = sinfo->GetScriptableFlags(&flags);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
nsWrapperCache *GetWrapperCache()
|
||||
{
|
||||
return mCache;
|
||||
|
Loading…
Reference in New Issue
Block a user