Source/WebCore/bindings/v8/ScriptController.cpp
ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
{
    String sourceURL = sourceCode.url();
    const String* savedSourceURL = m_sourceURL;
    m_sourceURL = &sourceURL;

    v8::HandleScope handleScope;
    v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(m_proxy->frame());
    if (v8Context.IsEmpty())
        return ScriptValue();

    v8::Context::Scope scope(v8Context);

    RefPtr<Frame> protect(m_frame);

    v8::Local<v8::Value> object = m_proxy->evaluate(sourceCode, 0);

    // Evaluating the JavaScript could cause the frame to be deallocated
    // so we start the keep alive timer here.
    m_frame->keepAlive();

    m_sourceURL = savedSourceURL;

    if (object.IsEmpty())
        return ScriptValue();

    return ScriptValue(object);
}
// Evaluate a script file in the environment of this proxy.
Evaluate a script file in the environment of this proxy.
Evaluate a script file in the environment of this proxy .
ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
{
    String sourceURL = sourceCode.url();
    const String* savedSourceURL = m_sourceURL;
    m_sourceURL = &sourceURL;
    v8::HandleScope handleScope;
    v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(m_proxy->frame());
    if (v8Context.IsEmpty())
        return ScriptValue();
    v8::Context::Scope scope(v8Context);
    RefPtr<Frame> protect(m_frame);
    v8::Local<v8::Value> object = m_proxy->evaluate(sourceCode, 0);
    m_frame->keepAlive();
    m_sourceURL = savedSourceURL;
    if (object.IsEmpty())
        return ScriptValue();
    return ScriptValue(object);
}
ScriptValue ScriptController :: evaluate ( const ScriptSourceCode & sourceCode ) { String sourceURL = sourceCode . url ( ) ; const String * savedSourceURL = m_sourceURL ; m_sourceURL = & sourceURL ; v8 :: HandleScope handleScope ; v8 :: Handle < v8 :: Context > v8Context = V8Proxy :: mainWorldContext ( m_proxy -> frame ( ) ) ; if ( v8Context . IsEmpty ( ) ) return ScriptValue ( ) ; v8 :: Context :: Scope scope ( v8Context ) ; RefPtr < Frame > protect ( m_frame ) ; v8 :: Local < v8 :: Value > object = m_proxy -> evaluate ( sourceCode , 0 ) ; m_frame -> keepAlive ( ) ; m_sourceURL = savedSourceURL ; if ( object . IsEmpty ( ) ) return ScriptValue ( ) ; return ScriptValue ( object ) ; }
Evaluate a script file in the environment of this proxy.
Evaluate a script file in the environment of this proxy .
// Evaluating the JavaScript could cause the frame to be deallocated // so we start the keep alive timer here.