зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1153922 - Add a SandboxOptions option for creating the sandbox in a fresh JS::Zone. r=mrbkap
--HG-- extra : rebase_source : d30aa79c3036db9f38cfe54327bfa9f55eb6c528
This commit is contained in:
Родитель
c88780414c
Коммит
91b061ba84
|
@ -885,6 +885,8 @@ xpc::CreateSandboxObject(JSContext* cx, MutableHandleValue vp, nsISupports* prin
|
|||
JS::CompartmentOptions compartmentOptions;
|
||||
if (options.sameZoneAs)
|
||||
compartmentOptions.setSameZoneAs(js::UncheckedUnwrap(options.sameZoneAs));
|
||||
else if (options.freshZone)
|
||||
compartmentOptions.setZone(JS::FreshZone);
|
||||
else
|
||||
compartmentOptions.setZone(JS::SystemZone);
|
||||
|
||||
|
@ -1360,18 +1362,28 @@ SandboxOptions::ParseGlobalProperties()
|
|||
bool
|
||||
SandboxOptions::Parse()
|
||||
{
|
||||
return ParseObject("sandboxPrototype", &proto) &&
|
||||
ParseBoolean("wantXrays", &wantXrays) &&
|
||||
ParseBoolean("wantComponents", &wantComponents) &&
|
||||
ParseBoolean("wantExportHelpers", &wantExportHelpers) &&
|
||||
ParseString("sandboxName", sandboxName) &&
|
||||
ParseObject("sameZoneAs", &sameZoneAs) &&
|
||||
ParseBoolean("invisibleToDebugger", &invisibleToDebugger) &&
|
||||
ParseBoolean("discardSource", &discardSource) &&
|
||||
ParseJSString("addonId", &addonId) &&
|
||||
ParseBoolean("writeToGlobalPrototype", &writeToGlobalPrototype) &&
|
||||
ParseGlobalProperties() &&
|
||||
ParseValue("metadata", &metadata);
|
||||
bool ok = ParseObject("sandboxPrototype", &proto) &&
|
||||
ParseBoolean("wantXrays", &wantXrays) &&
|
||||
ParseBoolean("wantComponents", &wantComponents) &&
|
||||
ParseBoolean("wantExportHelpers", &wantExportHelpers) &&
|
||||
ParseString("sandboxName", sandboxName) &&
|
||||
ParseObject("sameZoneAs", &sameZoneAs) &&
|
||||
ParseBoolean("freshZone", &freshZone) &&
|
||||
ParseBoolean("invisibleToDebugger", &invisibleToDebugger) &&
|
||||
ParseBoolean("discardSource", &discardSource) &&
|
||||
ParseJSString("addonId", &addonId) &&
|
||||
ParseBoolean("writeToGlobalPrototype", &writeToGlobalPrototype) &&
|
||||
ParseGlobalProperties() &&
|
||||
ParseValue("metadata", &metadata);
|
||||
if (!ok)
|
||||
return false;
|
||||
|
||||
if (freshZone && sameZoneAs) {
|
||||
JS_ReportError(mCx, "Cannot use both sameZoneAs and freshZone");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
|
|
|
@ -3438,6 +3438,7 @@ public:
|
|||
, addonId(cx)
|
||||
, writeToGlobalPrototype(false)
|
||||
, sameZoneAs(cx)
|
||||
, freshZone(false)
|
||||
, invisibleToDebugger(false)
|
||||
, discardSource(false)
|
||||
, metadata(cx)
|
||||
|
@ -3453,6 +3454,7 @@ public:
|
|||
JS::RootedString addonId;
|
||||
bool writeToGlobalPrototype;
|
||||
JS::RootedObject sameZoneAs;
|
||||
bool freshZone;
|
||||
bool invisibleToDebugger;
|
||||
bool discardSource;
|
||||
GlobalProperties globalProperties;
|
||||
|
|
Загрузка…
Ссылка в новой задаче