mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Implement GlobalObjectProxyObject for support external project
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
2ed90b206b
commit
5fe34d5b04
16 changed files with 340 additions and 14 deletions
|
|
@ -324,12 +324,20 @@ static ValueRef* builtin262EvalScript(ExecutionStateRef* state, ValueRef* thisVa
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
PersistentRefHolder<ContextRef> createEscargotContext(VMInstanceRef* instance)
|
||||
{
|
||||
PersistentRefHolder<ContextRef> context = ContextRef::create(instance);
|
||||
|
||||
Evaluator::execute(context, [](ExecutionStateRef* state) -> ValueRef* {
|
||||
ContextRef* context = state->context();
|
||||
|
||||
GlobalObjectProxyObjectRef* proxy = GlobalObjectProxyObjectRef::create(state, state->context()->globalObject(), [](ExecutionStateRef* state, GlobalObjectProxyObjectRef* proxy, GlobalObjectRef* targetGlobalObject, GlobalObjectProxyObjectRef::AccessOperationType operationType, OptionalRef<AtomicStringRef> nonIndexedStringPropertyNameIfExists) {
|
||||
// TODO check security
|
||||
});
|
||||
context->setGlobalObjectProxy(proxy);
|
||||
|
||||
|
||||
{
|
||||
FunctionObjectRef::NativeFunctionInfo nativeFunctionInfo(AtomicStringRef::create(context, "print"), builtinPrint, 1, true, false);
|
||||
FunctionObjectRef* buildFunctionObjectRef = FunctionObjectRef::create(state, nativeFunctionInfo);
|
||||
|
|
@ -418,7 +426,7 @@ PersistentRefHolder<ContextRef> createEscargotContext(VMInstanceRef* instance)
|
|||
}
|
||||
|
||||
{
|
||||
dollor262Object->defineDataProperty(state, StringRef::createFromASCII("global"), context->globalObject(), true, true, true);
|
||||
dollor262Object->defineDataProperty(state, StringRef::createFromASCII("global"), context->globalObjectProxy(), true, true, true);
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue