Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Unified Diff: Source/bindings/v8/PrivateScriptRunner.cpp

Issue 360703003: Implement Blink-in-JS for DOM methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/v8/PrivateScriptRunner.cpp
diff --git a/Source/bindings/v8/PrivateScriptRunner.cpp b/Source/bindings/v8/PrivateScriptRunner.cpp
index c1315b8cbddd442cb4ee86049b14e1c191fcda6f..700f6f65d717b2299cf77814bfbc7a1b7f88c1b6 100644
--- a/Source/bindings/v8/PrivateScriptRunner.cpp
+++ b/Source/bindings/v8/PrivateScriptRunner.cpp
@@ -26,7 +26,7 @@ static v8::Handle<v8::Value> compilePrivateScript(v8::Isolate* isolate, String c
return V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, source), isolate);
}
-v8::Handle<v8::Value> PrivateScriptRunner::run(ScriptState* scriptState, String className, String functionName, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> argv[])
+static v8::Handle<v8::Value> propertyValue(ScriptState* scriptState, String className, String propertyName)
{
ASSERT(scriptState->perContextData());
ASSERT(scriptState->executionContext());
@@ -47,12 +47,15 @@ v8::Handle<v8::Value> PrivateScriptRunner::run(ScriptState* scriptState, String
RELEASE_ASSERT(compiledClass->IsObject());
scriptState->perContextData()->setCompiledPrivateScript(className, compiledClass);
}
+ return v8::Handle<v8::Object>::Cast(compiledClass)->Get(v8String(isolate, propertyName));
+}
- v8::Handle<v8::Value> function = v8::Handle<v8::Object>::Cast(compiledClass)->Get(v8String(isolate, functionName));
- RELEASE_ASSERT(!function.IsEmpty());
- RELEASE_ASSERT(function->IsFunction());
-
- return V8ScriptRunner::callFunction(v8::Handle<v8::Function>::Cast(function), scriptState->executionContext(), receiver, argc, argv, isolate);
+v8::Handle<v8::Value> PrivateScriptRunner::runDOMMethod(ScriptState* scriptState, String className, String operationName, v8::Handle<v8::Value> holder, int argc, v8::Handle<v8::Value> argv[])
+{
+ v8::Handle<v8::Value> operation = propertyValue(scriptState, className, operationName);
+ RELEASE_ASSERT(!operation.IsEmpty());
+ RELEASE_ASSERT(operation->IsFunction());
+ return V8ScriptRunner::callFunction(v8::Handle<v8::Function>::Cast(operation), scriptState->executionContext(), holder, argc, argv, scriptState->isolate());
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698