Bug 797821 - Stop passing wantXrays directly to CreateGlobalObject. r=mrbkap

This can happen after the fact where it needs to.
This commit is contained in:
Bobby Holley 2012-10-25 17:01:07 +02:00
parent 961bc14d2b
commit 826ce1e16b
8 changed files with 11 additions and 14 deletions

View File

@ -281,8 +281,7 @@ nsXBLDocGlobalObject::EnsureScriptEnvironment()
// why - see bug 339647)
JS_SetErrorReporter(cx, XBL_ProtoErrorReporter);
mJSObject = xpc::CreateGlobalObject(cx, &gSharedGlobalClass,
GetPrincipal(), false);
mJSObject = xpc::CreateGlobalObject(cx, &gSharedGlobalClass, GetPrincipal());
if (!mJSObject)
return NS_OK;

View File

@ -753,7 +753,7 @@ nsXULPDGlobalObject::EnsureScriptEnvironment()
JSAutoRequest ar(cx);
JSObject *newGlob = xpc::CreateGlobalObject(cx, &gSharedGlobalClass,
GetPrincipal(), false);
GetPrincipal());
if (!newGlob)
return NS_OK;;

View File

@ -3258,10 +3258,11 @@ xpc_CreateSandboxObject(JSContext *cx, jsval *vp, nsISupports *prinOrSop, Sandbo
JSObject *sandbox;
sandbox = xpc::CreateGlobalObject(cx, &SandboxClass, principal, options.wantXrays);
sandbox = xpc::CreateGlobalObject(cx, &SandboxClass, principal);
if (!sandbox)
return NS_ERROR_FAILURE;
NS_ENSURE_SUCCESS(rv, rv);
xpc::GetCompartmentPrivate(sandbox)->wantXrays = options.wantXrays;
JS::AutoObjectRooter tvr(cx, sandbox);

View File

@ -181,8 +181,7 @@ XPCJSContextStack::GetSafeJSContext()
JS_SetErrorReporter(mSafeJSContext, mozJSLoaderErrorReporter);
glob = xpc::CreateGlobalObject(mSafeJSContext, &global_class,
principal, false);
glob = xpc::CreateGlobalObject(mSafeJSContext, &global_class, principal);
if (glob) {
// Make sure the context is associated with a proper compartment

View File

@ -312,7 +312,7 @@ XPCWrappedNative::WrapNewGlobal(XPCCallContext &ccx, xpcObjectHelper &nativeHelp
MOZ_ASSERT(clasp->flags & JSCLASS_IS_GLOBAL);
// Create the global.
JSObject *global = xpc::CreateGlobalObject(ccx, clasp, principal, false);
JSObject *global = xpc::CreateGlobalObject(ccx, clasp, principal);
if (!global)
return NS_ERROR_FAILURE;

View File

@ -1076,8 +1076,7 @@ CheckTypeInference(JSContext *cx, JSClass *clasp, nsIPrincipal *principal)
namespace xpc {
JSObject*
CreateGlobalObject(JSContext *cx, JSClass *clasp, nsIPrincipal *principal,
bool wantXrays)
CreateGlobalObject(JSContext *cx, JSClass *clasp, nsIPrincipal *principal)
{
// Make sure that Type Inference is enabled for everything non-chrome.
// Sandboxes and compilation scopes are exceptions. See bug 744034.
@ -1089,7 +1088,7 @@ CreateGlobalObject(JSContext *cx, JSClass *clasp, nsIPrincipal *principal,
if (!global)
return nullptr;
JSCompartment *compartment = js::GetObjectCompartment(global);
JS_SetCompartmentPrivate(compartment, new xpc::CompartmentPrivate(wantXrays));
JS_SetCompartmentPrivate(compartment, new xpc::CompartmentPrivate());
XPCCompartmentSet& set = nsXPConnect::GetRuntimeInstance()->GetCompartmentSet();
if (!set.put(compartment))

View File

@ -4322,8 +4322,8 @@ class CompartmentPrivate
public:
typedef nsTHashtable<nsPtrHashKey<JSObject> > DOMExpandoMap;
CompartmentPrivate(bool wantXrays)
: wantXrays(wantXrays)
CompartmentPrivate()
: wantXrays(false)
, universalXPConnectEnabled(false)
{
MOZ_COUNT_CTOR(xpc::CompartmentPrivate);

View File

@ -42,8 +42,7 @@ TransplantObjectWithWrapper(JSContext *cx,
JSObject *targetobj, JSObject *targetwrapper);
JSObject *
CreateGlobalObject(JSContext *cx, JSClass *clasp, nsIPrincipal *principal,
bool wantXrays);
CreateGlobalObject(JSContext *cx, JSClass *clasp, nsIPrincipal *principal);
} /* namespace xpc */
#define XPCONNECT_GLOBAL_FLAGS \