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

Unified Diff: fpdfsdk/src/javascript/JS_Context.cpp

Issue 1394993006: Merge to XFA: Pass IJS_Runtime, not IJS_Context, to native object constructors. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 2 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
« no previous file with comments | « fpdfsdk/src/javascript/JS_Context.h ('k') | fpdfsdk/src/javascript/JS_Define.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/JS_Context.cpp
diff --git a/fpdfsdk/src/javascript/JS_Context.cpp b/fpdfsdk/src/javascript/JS_Context.cpp
index 4769dac4f794f041a8990a46a38cdc7129fa6fd5..a53e745786a51a052116956a7ad55450be64884f 100644
--- a/fpdfsdk/src/javascript/JS_Context.cpp
+++ b/fpdfsdk/src/javascript/JS_Context.cpp
@@ -33,7 +33,7 @@ CPDFDoc_Environment* CJS_Context::GetReaderApp() {
}
FX_BOOL CJS_Context::RunScript(const CFX_WideString& script,
- CFX_WideString& info) {
+ CFX_WideString* info) {
v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate());
v8::Locker locker(m_pRuntime->GetIsolate());
v8::HandleScope handle_scope(m_pRuntime->GetIsolate());
@@ -41,7 +41,7 @@ FX_BOOL CJS_Context::RunScript(const CFX_WideString& script,
v8::Context::Scope context_scope(context);
if (m_bBusy) {
- info = JSGetStringFromID(this, IDS_STRING_JSBUSY);
+ *info = JSGetStringFromID(this, IDS_STRING_JSBUSY);
return FALSE;
}
m_bBusy = TRUE;
@@ -50,24 +50,20 @@ FX_BOOL CJS_Context::RunScript(const CFX_WideString& script,
CJS_Runtime::FieldEvent event(m_pEventHandler->TargetName(),
m_pEventHandler->EventType());
if (!m_pRuntime->AddEventToSet(event)) {
- info = JSGetStringFromID(this, IDS_STRING_JSEVENT);
+ *info = JSGetStringFromID(this, IDS_STRING_JSEVENT);
return FALSE;
}
- FXJSErr error = {NULL, NULL, 0};
+ CFX_WideString sErrorMessage;
int nRet = 0;
if (script.GetLength() > 0) {
- nRet = FXJS_Execute(m_pRuntime->GetIsolate(), this, script.c_str(),
- script.GetLength(), &error);
+ nRet = m_pRuntime->Execute(this, script.c_str(), &sErrorMessage);
}
if (nRet < 0) {
- CFX_WideString sLine;
- sLine.Format(L"[ Line: %05d { %s } ] : %s", error.linnum - 1, error.srcline,
- error.message);
- info += sLine;
+ *info += sErrorMessage;
} else {
- info = JSGetStringFromID(this, IDS_STRING_RUN);
+ *info = JSGetStringFromID(this, IDS_STRING_RUN);
}
m_pRuntime->RemoveEventFromSet(event);
« no previous file with comments | « fpdfsdk/src/javascript/JS_Context.h ('k') | fpdfsdk/src/javascript/JS_Define.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698