Bug 798491: Add an option to stick all chrome JSMs/JS components in the same compartment. r=mrbkap,philikon

This commit is contained in:
Kyle Huey
2012-10-31 09:13:28 -07:00
parent 147af6d937
commit 76a2832eea
477 changed files with 2291 additions and 2059 deletions

View File

@@ -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") ||