Bug 1176342, part 2 - De-COM the flags for InitClassesWithNewWrappedGlobal. r=mrbkap
MozReview-Commit-ID: 4QFtHPIzUd0
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -1714,17 +1714,17 @@ nsMessageManagerScriptExecutor::Unlink()
bool
nsMessageManagerScriptExecutor::InitChildGlobalInternal(
nsISupports* aScope,
const nsACString& aID)
{
AutoSafeJSContext cx;
nsContentUtils::GetSecurityManager()->GetSystemPrincipal(getter_AddRefs(mPrincipal));
- const uint32_t flags = nsIXPConnect::INIT_JS_STANDARD_CLASSES;
+ const uint32_t flags = xpc::INIT_JS_STANDARD_CLASSES;
JS::CompartmentOptions options;
options.creationOptions().setSystemZone();
options.behaviors().setVersion(JSVERSION_DEFAULT);
if (xpc::SharedMemoryEnabled()) {
options.creationOptions().setSharedMemoryAndAtomicsEnabled(true);
}
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -2948,18 +2948,18 @@ CreateNativeGlobalForInner(JSContext* aC
options.creationOptions().setSecureContext(aIsSecureContext);
xpc::InitGlobalObjectOptions(options, aPrincipal);
// Determine if we need the Components object.
bool needComponents = nsContentUtils::IsSystemPrincipal(aPrincipal) ||
TreatAsRemoteXUL(aPrincipal);
- uint32_t flags = needComponents ? 0 : nsIXPConnect::OMIT_COMPONENTS_OBJECT;
- flags |= nsIXPConnect::DONT_FIRE_ONNEWGLOBALHOOK;
+ uint32_t flags = needComponents ? 0 : xpc::OMIT_COMPONENTS_OBJECT;
+ flags |= xpc::DONT_FIRE_ONNEWGLOBALHOOK;
if (!WindowBinding::Wrap(aCx, aNewInner, aNewInner, options,
nsJSPrincipals::get(aPrincipal), false, aGlobal) ||
!xpc::InitGlobalObject(aCx, aGlobal, flags)) {
return NS_ERROR_FAILURE;
}
MOZ_ASSERT(aNewInner->GetWrapperPreserveColor() == aGlobal);
--- a/js/xpconnect/idl/nsIXPConnect.idl
+++ b/js/xpconnect/idl/nsIXPConnect.idl
@@ -274,20 +274,16 @@ interface nsIXPCFunctionThisTranslator :
[noscript, uuid(768507b5-b981-40c7-8276-f6a1da502a24)]
interface nsIXPConnect : nsISupports
{
%{ C++
NS_DEFINE_STATIC_CID_ACCESSOR(NS_XPCONNECT_CID)
%}
- const uint32_t INIT_JS_STANDARD_CLASSES = 1 << 0;
- const uint32_t DONT_FIRE_ONNEWGLOBALHOOK = 1 << 1;
- const uint32_t OMIT_COMPONENTS_OBJECT = 1 << 2;
-
/**
* wrapNative will create a new JSObject or return an existing one.
*
* This method now correctly deals with cases where the passed in xpcom
* object already has an associated JSObject for the cases:
* 1) The xpcom object has already been wrapped for use in the same scope
* as an nsIXPConnectWrappedNative.
* 2) The xpcom object is in fact a nsIXPConnectWrappedJS and thus already
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -512,17 +512,17 @@ mozJSComponentLoader::CreateLoaderGlobal
// Defer firing OnNewGlobalObject until after the __URI__ property has
// been defined so the JS debugger can tell what module the global is
// for
RootedObject global(aCx);
rv = xpc::InitClassesWithNewWrappedGlobal(aCx,
static_cast<nsIGlobalObject*>(backstagePass),
nsContentUtils::GetSystemPrincipal(),
- nsIXPConnect::DONT_FIRE_ONNEWGLOBALHOOK,
+ xpc::DONT_FIRE_ONNEWGLOBALHOOK,
options,
&global);
NS_ENSURE_SUCCESS_VOID(rv);
NS_ENSURE_TRUE_VOID(global);
backstagePass->SetGlobalObject(global);
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -541,25 +541,25 @@ InitGlobalObject(JSContext* aJSContext,
{
// Immediately enter the global's compartment so that everything we create
// ends up there.
JSAutoCompartment ac(aJSContext, aGlobal);
// Stuff coming through this path always ends up as a DOM global.
MOZ_ASSERT(js::GetObjectClass(aGlobal)->flags & JSCLASS_DOM_GLOBAL);
- if (!(aFlags & nsIXPConnect::OMIT_COMPONENTS_OBJECT)) {
+ if (!(aFlags & xpc::OMIT_COMPONENTS_OBJECT)) {
// XPCCallContext gives us an active request needed to save/restore.
if (!RealmPrivate::Get(aGlobal)->scope->AttachComponentsObject(aJSContext) ||
!XPCNativeWrapper::AttachNewConstructorObject(aJSContext, aGlobal)) {
return UnexpectedFailure(false);
}
}
- if (!(aFlags & nsIXPConnect::DONT_FIRE_ONNEWGLOBALHOOK))
+ if (!(aFlags & xpc::DONT_FIRE_ONNEWGLOBALHOOK))
JS_FireOnNewGlobalObject(aJSContext, aGlobal);
return true;
}
nsresult
InitClassesWithNewWrappedGlobal(JSContext* aJSContext,
nsISupports* aCOMObj,
@@ -579,17 +579,17 @@ InitClassesWithNewWrappedGlobal(JSContex
// Call into XPCWrappedNative to make a new global object, scope, and global
// prototype.
xpcObjectHelper helper(aCOMObj);
MOZ_ASSERT(helper.GetScriptableFlags() & XPC_SCRIPTABLE_IS_GLOBAL_OBJECT);
RefPtr<XPCWrappedNative> wrappedGlobal;
nsresult rv =
XPCWrappedNative::WrapNewGlobal(helper, aPrincipal,
- aFlags & nsIXPConnect::INIT_JS_STANDARD_CLASSES,
+ aFlags & xpc::INIT_JS_STANDARD_CLASSES,
aOptions, getter_AddRefs(wrappedGlobal));
NS_ENSURE_SUCCESS(rv, rv);
// Grab a copy of the global and enter its compartment.
RootedObject global(aJSContext, wrappedGlobal->GetFlatJSObject());
MOZ_ASSERT(JS_IsGlobalObject(global));
if (!InitGlobalObject(aJSContext, global, aFlags))
--- a/js/xpconnect/src/xpcpublic.h
+++ b/js/xpconnect/src/xpcpublic.h
@@ -193,16 +193,22 @@ TraceXPCGlobal(JSTracer* trc, JSObject*
nsresult
InitClassesWithNewWrappedGlobal(JSContext* aJSContext,
nsISupports* aCOMObj,
nsIPrincipal* aPrincipal,
uint32_t aFlags,
JS::CompartmentOptions& aOptions,
JS::MutableHandleObject aNewGlobal);
+enum InitClassesFlag {
+ INIT_JS_STANDARD_CLASSES = 1 << 0,
+ DONT_FIRE_ONNEWGLOBALHOOK = 1 << 1,
+ OMIT_COMPONENTS_OBJECT = 1 << 2,
+};
+
} /* namespace xpc */
namespace JS {
struct RuntimeStats;
} // namespace JS