Index: fpdfsdk/jsapi/fxjs_v8.cpp |
diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/jsapi/fxjs_v8.cpp |
similarity index 93% |
rename from fpdfsdk/src/jsapi/fxjs_v8.cpp |
rename to fpdfsdk/jsapi/fxjs_v8.cpp |
index 86f6ced198df2dffc6bebd10c6d5585176419858..156f1c9a3ca04c68306e5de39c026890acce3df7 100644 |
--- a/fpdfsdk/src/jsapi/fxjs_v8.cpp |
+++ b/fpdfsdk/jsapi/fxjs_v8.cpp |
@@ -227,7 +227,8 @@ void FXJS_DefineObjMethod(v8::Isolate* pIsolate, |
CFXJS_ObjDefinition::ForID(pIsolate, nObjDefnID); |
pObjDef->GetInstanceTemplate()->Set( |
v8::String::NewFromUtf8(pIsolate, bsMethodName.c_str(), |
- v8::NewStringType::kNormal).ToLocalChecked(), |
+ v8::NewStringType::kNormal) |
+ .ToLocalChecked(), |
v8::FunctionTemplate::New(pIsolate, pMethodCall, v8::Local<v8::Value>(), |
pObjDef->GetSignature()), |
v8::ReadOnly); |
@@ -245,7 +246,8 @@ void FXJS_DefineObjProperty(v8::Isolate* pIsolate, |
CFXJS_ObjDefinition::ForID(pIsolate, nObjDefnID); |
pObjDef->GetInstanceTemplate()->SetAccessor( |
v8::String::NewFromUtf8(pIsolate, bsPropertyName.c_str(), |
- v8::NewStringType::kNormal).ToLocalChecked(), |
+ v8::NewStringType::kNormal) |
+ .ToLocalChecked(), |
pPropGet, pPropPut); |
} |
@@ -281,10 +283,11 @@ void FXJS_DefineGlobalMethod(v8::Isolate* pIsolate, |
v8::Isolate::Scope isolate_scope(pIsolate); |
v8::HandleScope handle_scope(pIsolate); |
CFX_ByteString bsMethodName = CFX_WideString(sMethodName).UTF8Encode(); |
- GetGlobalObjectTemplate(pIsolate)->Set( |
- v8::String::NewFromUtf8(pIsolate, bsMethodName.c_str(), |
- v8::NewStringType::kNormal).ToLocalChecked(), |
- v8::FunctionTemplate::New(pIsolate, pMethodCall), v8::ReadOnly); |
+ GetGlobalObjectTemplate(pIsolate) |
+ ->Set(v8::String::NewFromUtf8(pIsolate, bsMethodName.c_str(), |
+ v8::NewStringType::kNormal) |
+ .ToLocalChecked(), |
+ v8::FunctionTemplate::New(pIsolate, pMethodCall), v8::ReadOnly); |
} |
void FXJS_DefineGlobalConst(v8::Isolate* pIsolate, |
@@ -344,8 +347,8 @@ void FXJS_InitializeRuntime( |
CFX_ByteString bs = CFX_WideString(pObjDef->m_ObjName).UTF8Encode(); |
v8::Local<v8::String> m_ObjName = |
v8::String::NewFromUtf8(pIsolate, bs.c_str(), |
- v8::NewStringType::kNormal, |
- bs.GetLength()).ToLocalChecked(); |
+ v8::NewStringType::kNormal, bs.GetLength()) |
+ .ToLocalChecked(); |
v8::Local<v8::Object> obj = |
FXJS_NewFxDynamicObj(pIsolate, pIRuntime, i, true); |
@@ -425,10 +428,11 @@ int FXJS_Execute(v8::Isolate* pIsolate, |
CFX_ByteString bsScript = CFX_WideString(script).UTF8Encode(); |
v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); |
v8::Local<v8::Script> compiled_script; |
- if (!v8::Script::Compile( |
- context, v8::String::NewFromUtf8( |
- pIsolate, bsScript.c_str(), v8::NewStringType::kNormal, |
- bsScript.GetLength()).ToLocalChecked()) |
+ if (!v8::Script::Compile(context, |
+ v8::String::NewFromUtf8(pIsolate, bsScript.c_str(), |
+ v8::NewStringType::kNormal, |
+ bsScript.GetLength()) |
+ .ToLocalChecked()) |
.ToLocal(&compiled_script)) { |
v8::String::Utf8Value error(try_catch.Exception()); |
// TODO(tsepez): return error via pError->message. |
@@ -508,9 +512,10 @@ void FXJS_Error(v8::Isolate* pIsolate, const CFX_WideString& message) { |
// wide-strings isn't handled by v8, so use UTF8 as a common |
// intermediate format. |
CFX_ByteString utf8_message = message.UTF8Encode(); |
- pIsolate->ThrowException( |
- v8::String::NewFromUtf8(pIsolate, utf8_message.c_str(), |
- v8::NewStringType::kNormal).ToLocalChecked()); |
+ pIsolate->ThrowException(v8::String::NewFromUtf8(pIsolate, |
+ utf8_message.c_str(), |
+ v8::NewStringType::kNormal) |
+ .ToLocalChecked()); |
} |
const wchar_t* FXJS_GetTypeof(v8::Local<v8::Value> pObj) { |
@@ -585,7 +590,8 @@ v8::Local<v8::String> FXJS_WSToJSString(v8::Isolate* pIsolate, |
if (!pIsolate) |
pIsolate = v8::Isolate::GetCurrent(); |
return v8::String::NewFromUtf8(pIsolate, bs.c_str(), |
- v8::NewStringType::kNormal).ToLocalChecked(); |
+ v8::NewStringType::kNormal) |
+ .ToLocalChecked(); |
} |
v8::Local<v8::Value> FXJS_GetObjectElement(v8::Isolate* pIsolate, |
@@ -595,7 +601,8 @@ v8::Local<v8::Value> FXJS_GetObjectElement(v8::Isolate* pIsolate, |
return v8::Local<v8::Value>(); |
v8::Local<v8::Value> val; |
if (!pObj->Get(pIsolate->GetCurrentContext(), |
- FXJS_WSToJSString(pIsolate, PropertyName)).ToLocal(&val)) |
+ FXJS_WSToJSString(pIsolate, PropertyName)) |
+ .ToLocal(&val)) |
return v8::Local<v8::Value>(); |
return val; |
} |
@@ -618,7 +625,8 @@ void FXJS_PutObjectString(v8::Isolate* pIsolate, |
return; |
pObj->Set(pIsolate->GetCurrentContext(), |
FXJS_WSToJSString(pIsolate, PropertyName), |
- FXJS_WSToJSString(pIsolate, sValue)).FromJust(); |
+ FXJS_WSToJSString(pIsolate, sValue)) |
+ .FromJust(); |
} |
void FXJS_PutObjectNumber(v8::Isolate* pIsolate, |
@@ -629,7 +637,8 @@ void FXJS_PutObjectNumber(v8::Isolate* pIsolate, |
return; |
pObj->Set(pIsolate->GetCurrentContext(), |
FXJS_WSToJSString(pIsolate, PropertyName), |
- v8::Int32::New(pIsolate, nValue)).FromJust(); |
+ v8::Int32::New(pIsolate, nValue)) |
+ .FromJust(); |
} |
void FXJS_PutObjectNumber(v8::Isolate* pIsolate, |
@@ -640,7 +649,8 @@ void FXJS_PutObjectNumber(v8::Isolate* pIsolate, |
return; |
pObj->Set(pIsolate->GetCurrentContext(), |
FXJS_WSToJSString(pIsolate, PropertyName), |
- v8::Number::New(pIsolate, (double)fValue)).FromJust(); |
+ v8::Number::New(pIsolate, (double)fValue)) |
+ .FromJust(); |
} |
void FXJS_PutObjectNumber(v8::Isolate* pIsolate, |
@@ -651,7 +661,8 @@ void FXJS_PutObjectNumber(v8::Isolate* pIsolate, |
return; |
pObj->Set(pIsolate->GetCurrentContext(), |
FXJS_WSToJSString(pIsolate, PropertyName), |
- v8::Number::New(pIsolate, (double)dValue)).FromJust(); |
+ v8::Number::New(pIsolate, (double)dValue)) |
+ .FromJust(); |
} |
void FXJS_PutObjectBoolean(v8::Isolate* pIsolate, |
@@ -662,7 +673,8 @@ void FXJS_PutObjectBoolean(v8::Isolate* pIsolate, |
return; |
pObj->Set(pIsolate->GetCurrentContext(), |
FXJS_WSToJSString(pIsolate, PropertyName), |
- v8::Boolean::New(pIsolate, bValue)).FromJust(); |
+ v8::Boolean::New(pIsolate, bValue)) |
+ .FromJust(); |
} |
void FXJS_PutObjectObject(v8::Isolate* pIsolate, |
@@ -672,7 +684,8 @@ void FXJS_PutObjectObject(v8::Isolate* pIsolate, |
if (pObj.IsEmpty()) |
return; |
pObj->Set(pIsolate->GetCurrentContext(), |
- FXJS_WSToJSString(pIsolate, PropertyName), pPut).FromJust(); |
+ FXJS_WSToJSString(pIsolate, PropertyName), pPut) |
+ .FromJust(); |
} |
void FXJS_PutObjectNull(v8::Isolate* pIsolate, |
@@ -681,8 +694,8 @@ void FXJS_PutObjectNull(v8::Isolate* pIsolate, |
if (pObj.IsEmpty()) |
return; |
pObj->Set(pIsolate->GetCurrentContext(), |
- FXJS_WSToJSString(pIsolate, PropertyName), |
- v8::Local<v8::Object>()).FromJust(); |
+ FXJS_WSToJSString(pIsolate, PropertyName), v8::Local<v8::Object>()) |
+ .FromJust(); |
} |
v8::Local<v8::Array> FXJS_NewArray(v8::Isolate* pIsolate) { |
@@ -808,5 +821,3 @@ v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, |
void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { |
pTo = pFrom; |
} |
- |
- |