Bug 1240453 - enable shared memory in xpconnect. r=bz
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -989,16 +989,19 @@ xpc::CreateSandboxObject(JSContext* cx,
}
}
MOZ_ASSERT(principal);
JS::CompartmentOptions compartmentOptions;
auto& creationOptions = compartmentOptions.creationOptions();
+ if (xpc::SharedMemoryEnabled())
+ creationOptions.setSharedMemoryAndAtomicsEnabled(true);
+
if (options.sameZoneAs)
creationOptions.setSameZoneAs(js::UncheckedUnwrap(options.sameZoneAs));
else if (options.freshZone)
creationOptions.setZone(JS::FreshZone);
else
creationOptions.setZone(JS::SystemZone);
creationOptions.setInvisibleToDebugger(options.invisibleToDebugger)
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -178,16 +178,18 @@ XPCWrappedNative::WrapNewGlobal(xpcObjec
MOZ_ASSERT(si.get());
// Finally, we get to the JSClass.
const JSClass* clasp = si->GetJSClass();
MOZ_ASSERT(clasp->flags & JSCLASS_IS_GLOBAL);
// Create the global.
aOptions.creationOptions().setTrace(XPCWrappedNative::Trace);
+ if (xpc::SharedMemoryEnabled())
+ aOptions.creationOptions().setSharedMemoryAndAtomicsEnabled(true);
RootedObject global(cx, xpc::CreateGlobalObject(cx, clasp, principal, aOptions));
if (!global)
return NS_ERROR_FAILURE;
XPCWrappedNativeScope* scope = CompartmentPrivate::Get(global)->scope;
// Immediately enter the global's compartment, so that everything else we
// create ends up there.
JSAutoCompartment ac(cx, global);