summaryrefslogtreecommitdiff
path: root/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp')
-rw-r--r--Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index 4dd181b88..0fe290b3a 100644
--- a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -253,7 +253,7 @@ v8::Handle<v8::Value> V8InjectedScriptHost::getEventListenersCallback(const v8::
if (!listeners->Length())
continue;
AtomicString eventType = listenersArray[i].eventType;
- result->Set(v8::String::New(fromWebCoreString(eventType), eventType.length()), listeners);
+ result->Set(v8String(eventType), listeners);
}
return result;
@@ -299,6 +299,22 @@ v8::Handle<v8::Value> V8InjectedScriptHost::storageIdCallback(const v8::Argument
return v8::Undefined();
}
+v8::Handle<v8::Value> V8InjectedScriptHost::evaluateCallback(const v8::Arguments& args)
+{
+ INC_STATS("InjectedScriptHost.evaluate()");
+ if (args.Length() < 1)
+ return v8::ThrowException(v8::Exception::Error(v8::String::New("One argument expected.")));
+
+ v8::Handle<v8::String> expression = args[0]->ToString();
+ if (expression.IsEmpty())
+ return v8::ThrowException(v8::Exception::Error(v8::String::New("The argument must be a string.")));
+
+ v8::Handle<v8::Script> script = v8::Script::Compile(expression);
+ if (script.IsEmpty()) // Return immediately in case of exception to let the caller handle it.
+ return v8::Handle<v8::Value>();
+ return script->Run();
+}
+
} // namespace WebCore
#endif // ENABLE(INSPECTOR)