Bug 798491: Add an option to stick all chrome JSMs/JS components in the same compartment. r=mrbkap,philikon
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "jsperf.h"
|
||||
#include "mozilla/ModuleUtils.h"
|
||||
#include "nsMemory.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
#define JSPERF_CONTRACTID \
|
||||
"@mozilla.org/jsperf;1"
|
||||
@@ -58,6 +59,10 @@ InitAndSealPerfMeasurementClass(JSContext* cx, JSObject* global)
|
||||
if (!JS::RegisterPerfMeasurement(cx, global))
|
||||
return false;
|
||||
|
||||
// Can't freeze our global if it's shared.
|
||||
if (Preferences::GetBool("jsloader.reuseGlobal"))
|
||||
return true;
|
||||
|
||||
// Seal up Object, Function, and Array and their prototypes. (This single
|
||||
// object instance is shared amongst everyone who imports the jsperf module.)
|
||||
if (!SealObjectAndPrototype(cx, global, "Object") ||
|
||||
|
||||
Reference in New Issue
Block a user