Пример #1
0
JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSGlobalObject* globalObject)
{
    CallFrame* globalCallFrame = globalObject->globalExec();

    RefPtr<EvalExecutable> eval = EvalExecutable::create(globalCallFrame, makeSource(script));
    JSObject* error = eval->compile(globalCallFrame, globalCallFrame->scopeChain());
    if (error)
        return error;

    return globalObject->globalData()->interpreter->execute(eval.get(), globalCallFrame, globalObject, globalCallFrame->scopeChain(), &exception);
}
Пример #2
0
JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSGlobalObject* globalObject)
{
    CallFrame* globalCallFrame = globalObject->globalExec();
    JSGlobalData& globalData = globalObject->globalData();

    EvalExecutable* eval = EvalExecutable::create(globalCallFrame, makeSource(script), false);
    if (!eval) {
        exception = globalData.exception;
        globalData.exception = JSValue();
        return exception;
    }

    JSValue result = globalData.interpreter->execute(eval, globalCallFrame, globalObject, globalCallFrame->scopeChain());
    if (globalData.exception) {
        exception = globalData.exception;
        globalData.exception = JSValue();
    }
    ASSERT(result);
    return result;
}