From 884b4f942d510974e713361b84a717340eb928b9 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Mon, 6 Jun 2016 09:49:32 -0700 Subject: Remove unused context param from execute. The IJS_Context parameter is never used, removed. Review-Url: https://codereview.chromium.org/2035743002 --- fpdfsdk/jsapi/fxjs_v8.cpp | 5 ++--- fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp | 12 ++++++------ fpdfsdk/jsapi/include/fxjs_v8.h | 3 +-- 3 files changed, 9 insertions(+), 11 deletions(-) (limited to 'fpdfsdk/jsapi') diff --git a/fpdfsdk/jsapi/fxjs_v8.cpp b/fpdfsdk/jsapi/fxjs_v8.cpp index f8c2a3dd6d..73f6bbf4fb 100644 --- a/fpdfsdk/jsapi/fxjs_v8.cpp +++ b/fpdfsdk/jsapi/fxjs_v8.cpp @@ -414,12 +414,11 @@ void FXJS_SetRuntimeForV8Context(v8::Local v8Context, #endif // PDF_ENABLE_XFA int FXJS_Execute(v8::Isolate* pIsolate, - IJS_Context* pJSContext, - const wchar_t* script, + const CFX_WideString& script, FXJSErr* pError) { v8::Isolate::Scope isolate_scope(pIsolate); v8::TryCatch try_catch(pIsolate); - CFX_ByteString bsScript = CFX_WideString(script).UTF8Encode(); + CFX_ByteString bsScript = script.UTF8Encode(); v8::Local context = pIsolate->GetCurrentContext(); v8::Local compiled_script; if (!v8::Script::Compile(context, diff --git a/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp b/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp index a8358c4ee9..b33ddca32d 100644 --- a/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp +++ b/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp @@ -19,9 +19,9 @@ const wchar_t kScript2[] = L"fred = 8"; class FXJSV8EmbedderTest : public JSEmbedderTest { public: - void ExecuteInCurrentContext(const wchar_t* script) { + void ExecuteInCurrentContext(const CFX_WideString& script) { FXJSErr error; - int sts = FXJS_Execute(isolate(), nullptr, script, &error); + int sts = FXJS_Execute(isolate(), script, &error); EXPECT_EQ(0, sts); } void CheckAssignmentInCurrentContext(double expected) { @@ -39,7 +39,7 @@ TEST_F(FXJSV8EmbedderTest, Getters) { v8::HandleScope handle_scope(isolate()); v8::Context::Scope context_scope(GetV8Context()); - ExecuteInCurrentContext(kScript1); + ExecuteInCurrentContext(CFX_WideString(kScript1)); CheckAssignmentInCurrentContext(kExpected1); } @@ -58,14 +58,14 @@ TEST_F(FXJSV8EmbedderTest, MultipleRutimes) { &static_objects2); v8::Context::Scope context_scope(GetV8Context()); - ExecuteInCurrentContext(kScript0); + ExecuteInCurrentContext(CFX_WideString(kScript0)); CheckAssignmentInCurrentContext(kExpected0); { v8::Local context1 = v8::Local::New(isolate(), global_context1); v8::Context::Scope context_scope1(context1); - ExecuteInCurrentContext(kScript1); + ExecuteInCurrentContext(CFX_WideString(kScript1)); CheckAssignmentInCurrentContext(kExpected1); } FXJS_ReleaseRuntime(isolate(), &global_context1, &static_objects1); @@ -74,7 +74,7 @@ TEST_F(FXJSV8EmbedderTest, MultipleRutimes) { v8::Local context2 = v8::Local::New(isolate(), global_context2); v8::Context::Scope context_scope2(context2); - ExecuteInCurrentContext(kScript2); + ExecuteInCurrentContext(CFX_WideString(kScript2)); CheckAssignmentInCurrentContext(kExpected2); } FXJS_ReleaseRuntime(isolate(), &global_context2, &static_objects2); diff --git a/fpdfsdk/jsapi/include/fxjs_v8.h b/fpdfsdk/jsapi/include/fxjs_v8.h index 235f3bc902..6606df4d26 100644 --- a/fpdfsdk/jsapi/include/fxjs_v8.h +++ b/fpdfsdk/jsapi/include/fxjs_v8.h @@ -211,8 +211,7 @@ void FXJS_SetRuntimeForV8Context(v8::Local v8Context, // Called after FXJS_InitializeRuntime call made. int FXJS_Execute(v8::Isolate* pIsolate, - IJS_Context* pJSContext, - const wchar_t* script, + const CFX_WideString& script, FXJSErr* perror); v8::Local FXJS_NewFxDynamicObj(v8::Isolate* pIsolate, -- cgit v1.2.3