本文整理汇总了C++中JSGlobalObject::clearGlobalScopeExtension方法的典型用法代码示例。如果您正苦于以下问题:C++ JSGlobalObject::clearGlobalScopeExtension方法的具体用法?C++ JSGlobalObject::clearGlobalScopeExtension怎么用?C++ JSGlobalObject::clearGlobalScopeExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSGlobalObject
的用法示例。
在下文中一共展示了JSGlobalObject::clearGlobalScopeExtension方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: evaluateWithScopeExtension
// Evaluate some JavaScript code in the scope of this frame.
JSValue DebuggerCallFrame::evaluateWithScopeExtension(const String& script, JSObject* scopeExtensionObject, NakedPtr<Exception>& exception)
{
ASSERT(isValid());
CallFrame* callFrame = m_validMachineFrame;
if (!callFrame)
return jsUndefined();
VM& vm = callFrame->vm();
JSLockHolder lock(vm);
auto catchScope = DECLARE_CATCH_SCOPE(vm);
CodeBlock* codeBlock = nullptr;
if (isTailDeleted())
codeBlock = m_shadowChickenFrame.codeBlock;
else
codeBlock = callFrame->codeBlock();
if (!codeBlock)
return jsUndefined();
DebuggerEvalEnabler evalEnabler(callFrame);
EvalContextType evalContextType;
if (isFunctionParseMode(codeBlock->unlinkedCodeBlock()->parseMode()))
evalContextType = EvalContextType::FunctionEvalContext;
else if (codeBlock->unlinkedCodeBlock()->codeType() == EvalCode)
evalContextType = codeBlock->unlinkedCodeBlock()->evalContextType();
else
evalContextType = EvalContextType::None;
VariableEnvironment variablesUnderTDZ;
JSScope::collectClosureVariablesUnderTDZ(scope()->jsScope(), variablesUnderTDZ);
EvalExecutable* eval = DirectEvalExecutable::create(callFrame, makeSource(script), codeBlock->isStrictMode(), codeBlock->unlinkedCodeBlock()->derivedContextType(), codeBlock->unlinkedCodeBlock()->isArrowFunction(), evalContextType, &variablesUnderTDZ);
if (UNLIKELY(catchScope.exception())) {
exception = catchScope.exception();
catchScope.clearException();
return jsUndefined();
}
JSGlobalObject* globalObject = callFrame->vmEntryGlobalObject();
if (scopeExtensionObject) {
JSScope* ignoredPreviousScope = globalObject->globalScope();
globalObject->setGlobalScopeExtension(JSWithScope::create(vm, globalObject, scopeExtensionObject, ignoredPreviousScope));
}
JSValue thisValue = this->thisValue();
JSValue result = vm.interpreter->execute(eval, callFrame, thisValue, scope()->jsScope());
if (UNLIKELY(catchScope.exception())) {
exception = catchScope.exception();
catchScope.clearException();
}
if (scopeExtensionObject)
globalObject->clearGlobalScopeExtension();
ASSERT(result);
return result;
}
示例2: evaluateWithScopeExtension
JSValue evaluateWithScopeExtension(ExecState* exec, const SourceCode& source, JSObject* scopeExtensionObject, NakedPtr<Exception>& returnedException)
{
JSGlobalObject* globalObject = exec->vmEntryGlobalObject();
if (scopeExtensionObject) {
JSScope* ignoredPreviousScope = globalObject->globalScope();
globalObject->setGlobalScopeExtension(JSWithScope::create(exec->vm(), globalObject, scopeExtensionObject, ignoredPreviousScope));
}
JSValue returnValue = JSC::evaluate(globalObject->globalExec(), source, globalObject, returnedException);
if (scopeExtensionObject)
globalObject->clearGlobalScopeExtension();
return returnValue;
}