зеркало из https://github.com/mozilla/gecko-dev.git
Bug 677294 - part 2: need a way to create new JS scopes and run scripts against them (same compartment); r=mrbkap
This commit is contained in:
Родитель
d0bb7ac21e
Коммит
9577034415
|
@ -57,6 +57,7 @@
|
|||
#include "mozJSComponentLoader.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "jsgc.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
using namespace js;
|
||||
/***************************************************************************/
|
||||
|
@ -3223,12 +3224,17 @@ nsXPCComponents_utils_Sandbox::CallOrConstruct(nsIXPConnectWrappedNative *wrappe
|
|||
|
||||
if (found) {
|
||||
if (!JS_GetProperty(cx, optionsObject, "sameGroupAs", &option) ||
|
||||
JSVAL_IS_PRIMITIVE(option)) {
|
||||
return ThrowAndFail(NS_ERROR_INVALID_ARG, cx, _retval);
|
||||
}
|
||||
JSVAL_IS_PRIMITIVE(option))
|
||||
return ThrowAndFail(NS_ERROR_INVALID_ARG, cx, _retval);
|
||||
|
||||
JSObject* unwrapped = UnwrapObject(JSVAL_TO_OBJECT(option));
|
||||
JSObject* global = GetGlobalForObjectCrossCompartment(unwrapped);
|
||||
if (GetObjectJSClass(unwrapped) != &SandboxClass &&
|
||||
GetObjectJSClass(global) != &SandboxClass)
|
||||
return ThrowAndFail(NS_ERROR_INVALID_ARG, cx, _retval);
|
||||
|
||||
void* privateValue =
|
||||
JS_GetCompartmentPrivate(cx,GetObjectCompartment(JSVAL_TO_OBJECT(option)));
|
||||
JS_GetCompartmentPrivate(cx, GetObjectCompartment(unwrapped));
|
||||
xpc::CompartmentPrivate *compartmentPrivate =
|
||||
static_cast<xpc::CompartmentPrivate*>(privateValue);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче