Use proper namespace instead of CFX_V8 static functions.
Closer to what our style guide would suggest. In the end, CFX_V8
should go away as it doesn't buy us anything, esp. given that
callbacks will have an isolate but no means of reaching the
CFX_V8 wrapping it.
Change-Id: If2188767ad829cbeccba007d246ce0f65b0ccf22
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/67491
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fxjs/BUILD.gn b/fxjs/BUILD.gn
index f4fbe5f..8f6225f 100644
--- a/fxjs/BUILD.gn
+++ b/fxjs/BUILD.gn
@@ -89,6 +89,8 @@
"cjs_zoomtype.h",
"fx_date_helpers.cpp",
"fx_date_helpers.h",
+ "fxv8.cpp",
+ "fxv8.h",
"global_timer.cpp",
"global_timer.h",
"js_define.cpp",
diff --git a/fxjs/cfx_v8.cpp b/fxjs/cfx_v8.cpp
index 972f4f7..8972158 100644
--- a/fxjs/cfx_v8.cpp
+++ b/fxjs/cfx_v8.cpp
@@ -7,6 +7,7 @@
#include "fxjs/cfx_v8.h"
#include "core/fxcrt/fx_memory.h"
+#include "fxjs/fxv8.h"
#include "third_party/base/allocator/partition_allocator/partition_alloc.h"
CFX_V8::CFX_V8(v8::Isolate* isolate) : m_pIsolate(isolate) {}
@@ -110,7 +111,7 @@
v8::Local<v8::String> CFX_V8::NewString(ByteStringView str) {
v8::Isolate* pIsolate = m_pIsolate ? GetIsolate() : v8::Isolate::GetCurrent();
- return NewStringHelper(pIsolate, str);
+ return fxv8::NewStringHelper(pIsolate, str);
}
v8::Local<v8::String> CFX_V8::NewString(WideStringView str) {
@@ -135,23 +136,23 @@
}
int CFX_V8::ToInt32(v8::Local<v8::Value> pValue) {
- return ReentrantToInt32Helper(m_pIsolate.Get(), pValue);
+ return fxv8::ReentrantToInt32Helper(m_pIsolate.Get(), pValue);
}
bool CFX_V8::ToBoolean(v8::Local<v8::Value> pValue) {
- return ReentrantToBooleanHelper(m_pIsolate.Get(), pValue);
+ return fxv8::ReentrantToBooleanHelper(m_pIsolate.Get(), pValue);
}
double CFX_V8::ToDouble(v8::Local<v8::Value> pValue) {
- return ReentrantToDoubleHelper(m_pIsolate.Get(), pValue);
+ return fxv8::ReentrantToDoubleHelper(m_pIsolate.Get(), pValue);
}
WideString CFX_V8::ToWideString(v8::Local<v8::Value> pValue) {
- return ReentrantToWideStringHelper(m_pIsolate.Get(), pValue);
+ return fxv8::ReentrantToWideStringHelper(m_pIsolate.Get(), pValue);
}
ByteString CFX_V8::ToByteString(v8::Local<v8::Value> pValue) {
- return ReentrantToByteStringHelper(m_pIsolate.Get(), pValue);
+ return fxv8::ReentrantToByteStringHelper(m_pIsolate.Get(), pValue);
}
v8::Local<v8::Object> CFX_V8::ToObject(v8::Local<v8::Value> pValue) {
@@ -168,70 +169,6 @@
return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked());
}
-// static
-v8::Local<v8::String> CFX_V8::NewStringHelper(v8::Isolate* pIsolate,
- ByteStringView str) {
- return v8::String::NewFromUtf8(pIsolate, str.unterminated_c_str(),
- v8::NewStringType::kNormal, str.GetLength())
- .ToLocalChecked();
-}
-
-// static
-v8::Local<v8::String> CFX_V8::NewStringHelper(v8::Isolate* pIsolate,
- WideStringView str) {
- return NewStringHelper(pIsolate, FX_UTF8Encode(str).AsStringView());
-}
-
-// static
-int CFX_V8::ReentrantToInt32Helper(v8::Isolate* pIsolate,
- v8::Local<v8::Value> pValue) {
- if (pValue.IsEmpty())
- return 0;
- return pValue->Int32Value(pIsolate->GetCurrentContext()).FromMaybe(0);
-}
-
-// static
-bool CFX_V8::ReentrantToBooleanHelper(v8::Isolate* pIsolate,
- v8::Local<v8::Value> pValue) {
- if (pValue.IsEmpty())
- return false;
- return pValue->BooleanValue(pIsolate);
-}
-
-// static
-double CFX_V8::ReentrantToDoubleHelper(v8::Isolate* pIsolate,
- v8::Local<v8::Value> pValue) {
- if (pValue.IsEmpty())
- return 0.0;
- return pValue->NumberValue(pIsolate->GetCurrentContext()).FromMaybe(0.0);
-}
-
-// static
-WideString CFX_V8::ReentrantToWideStringHelper(v8::Isolate* pIsolate,
- v8::Local<v8::Value> pValue) {
- if (pValue.IsEmpty())
- return WideString();
- v8::MaybeLocal<v8::String> maybe_string =
- pValue->ToString(pIsolate->GetCurrentContext());
- if (maybe_string.IsEmpty())
- return WideString();
- v8::String::Utf8Value s(pIsolate, maybe_string.ToLocalChecked());
- return WideString::FromUTF8(ByteStringView(*s, s.length()));
-}
-
-// static
-ByteString CFX_V8::ReentrantToByteStringHelper(v8::Isolate* pIsolate,
- v8::Local<v8::Value> pValue) {
- if (pValue.IsEmpty())
- return ByteString();
- v8::MaybeLocal<v8::String> maybe_string =
- pValue->ToString(pIsolate->GetCurrentContext());
- if (maybe_string.IsEmpty())
- return ByteString();
- v8::String::Utf8Value s(pIsolate, maybe_string.ToLocalChecked());
- return ByteString(*s);
-}
-
void* CFX_V8ArrayBufferAllocator::Allocate(size_t length) {
if (length > kMaxAllowedBytes)
return nullptr;
diff --git a/fxjs/cfx_v8.h b/fxjs/cfx_v8.h
index 2f01d4e..cb152ac 100644
--- a/fxjs/cfx_v8.h
+++ b/fxjs/cfx_v8.h
@@ -15,22 +15,6 @@
class CFX_V8 {
public:
- static v8::Local<v8::String> NewStringHelper(v8::Isolate* pIsolate,
- ByteStringView str);
- static v8::Local<v8::String> NewStringHelper(v8::Isolate* pIsolate,
- WideStringView str);
-
- static int ReentrantToInt32Helper(v8::Isolate* pIsolate,
- v8::Local<v8::Value> pValue);
- static bool ReentrantToBooleanHelper(v8::Isolate* pIsolate,
- v8::Local<v8::Value> pValue);
- static double ReentrantToDoubleHelper(v8::Isolate* pIsolate,
- v8::Local<v8::Value> pValue);
- static WideString ReentrantToWideStringHelper(v8::Isolate* pIsolate,
- v8::Local<v8::Value> pValue);
- static ByteString ReentrantToByteStringHelper(v8::Isolate* pIsolate,
- v8::Local<v8::Value> pValue);
-
explicit CFX_V8(v8::Isolate* pIsolate);
virtual ~CFX_V8();
diff --git a/fxjs/cfxjs_engine.cpp b/fxjs/cfxjs_engine.cpp
index c74f57c..2c05992 100644
--- a/fxjs/cfxjs_engine.cpp
+++ b/fxjs/cfxjs_engine.cpp
@@ -12,6 +12,7 @@
#include "core/fxcrt/unowned_ptr.h"
#include "fxjs/cjs_object.h"
+#include "fxjs/fxv8.h"
#include "fxjs/xfa/cfxjse_runtimedata.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
@@ -147,7 +148,7 @@
fn->SetCallHandler(CallHandler, v8::Number::New(isolate, eObjType));
if (eObjType == FXJSOBJTYPE_GLOBAL) {
fn->InstanceTemplate()->Set(v8::Symbol::GetToStringTag(isolate),
- CFX_V8::NewStringHelper(isolate, "global"));
+ fxv8::NewStringHelper(isolate, "global"));
}
m_FunctionTemplate.Reset(isolate, fn);
m_Signature.Reset(isolate, v8::Signature::New(isolate, fn));
@@ -157,12 +158,12 @@
v8::Isolate* isolate = info.GetIsolate();
if (!info.IsConstructCall()) {
isolate->ThrowException(
- CFX_V8::NewStringHelper(isolate, "illegal constructor"));
+ fxv8::NewStringHelper(isolate, "illegal constructor"));
return;
}
if (info.Data().As<v8::Int32>()->Value() != FXJSOBJTYPE_DYNAMIC) {
isolate->ThrowException(
- CFX_V8::NewStringHelper(isolate, "not a dynamic object"));
+ fxv8::NewStringHelper(isolate, "not a dynamic object"));
return;
}
v8::Local<v8::Object> holder = info.Holder();
@@ -234,7 +235,7 @@
v8::Local<v8::ObjectTemplate> hGlobalTemplate =
v8::ObjectTemplate::New(pIsolate);
hGlobalTemplate->Set(v8::Symbol::GetToStringTag(pIsolate),
- CFX_V8::NewStringHelper(pIsolate, "global"));
+ fxv8::NewStringHelper(pIsolate, "global"));
g_DefaultGlobalObjectTemplate =
new v8::Global<v8::ObjectTemplate>(pIsolate, hGlobalTemplate);
}
diff --git a/fxjs/cjs_globalconsts.cpp b/fxjs/cjs_globalconsts.cpp
index bea5d54..c10a6f5 100644
--- a/fxjs/cjs_globalconsts.cpp
+++ b/fxjs/cjs_globalconsts.cpp
@@ -6,12 +6,13 @@
#include "fxjs/cjs_globalconsts.h"
+#include "fxjs/fxv8.h"
+
#define GLOBAL_STRING(rt, name, value) \
(rt)->DefineGlobalConst( \
(name), [](const v8::FunctionCallbackInfo<v8::Value>& info) { \
- const char* pStr = (value); \
info.GetReturnValue().Set( \
- CFX_V8::NewStringHelper(info.GetIsolate(), pStr)); \
+ fxv8::NewStringHelper(info.GetIsolate(), (value))); \
})
// static
diff --git a/fxjs/cjs_runtime.cpp b/fxjs/cjs_runtime.cpp
index efa2ba6..dba7e32 100644
--- a/fxjs/cjs_runtime.cpp
+++ b/fxjs/cjs_runtime.cpp
@@ -36,6 +36,7 @@
#include "fxjs/cjs_timerobj.h"
#include "fxjs/cjs_util.h"
#include "fxjs/cjs_zoomtype.h"
+#include "fxjs/fxv8.h"
#include "fxjs/js_define.h"
#include "third_party/base/ptr_util.h"
@@ -181,7 +182,7 @@
v8::Isolate::Scope isolate_scope(GetIsolate());
v8::Local<v8::Context> context = GetV8Context();
v8::Context::Scope context_scope(context);
- v8::Local<v8::String> str = CFX_V8::NewStringHelper(GetIsolate(), utf8Name);
+ v8::Local<v8::String> str = fxv8::NewStringHelper(GetIsolate(), utf8Name);
v8::MaybeLocal<v8::Value> maybe_propvalue =
context->Global()->Get(context, str);
if (maybe_propvalue.IsEmpty())
@@ -200,7 +201,7 @@
v8::Isolate::Scope isolate_scope(pIsolate);
v8::Local<v8::Context> context = GetV8Context();
v8::Context::Scope context_scope(context);
- v8::Local<v8::String> str = CFX_V8::NewStringHelper(pIsolate, utf8Name);
+ v8::Local<v8::String> str = fxv8::NewStringHelper(pIsolate, utf8Name);
v8::Maybe<bool> result = context->Global()->Set(context, str, pValue);
return result.IsJust() && result.FromJust();
}
diff --git a/fxjs/fxv8.cpp b/fxjs/fxv8.cpp
new file mode 100644
index 0000000..c30461b
--- /dev/null
+++ b/fxjs/fxv8.cpp
@@ -0,0 +1,67 @@
+// Copyright 2020 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fxjs/fxv8.h"
+
+namespace fxv8 {
+
+v8::Local<v8::String> NewStringHelper(v8::Isolate* pIsolate,
+ ByteStringView str) {
+ return v8::String::NewFromUtf8(pIsolate, str.unterminated_c_str(),
+ v8::NewStringType::kNormal, str.GetLength())
+ .ToLocalChecked();
+}
+
+v8::Local<v8::String> NewStringHelper(v8::Isolate* pIsolate,
+ WideStringView str) {
+ return NewStringHelper(pIsolate, FX_UTF8Encode(str).AsStringView());
+}
+
+int ReentrantToInt32Helper(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue) {
+ if (pValue.IsEmpty())
+ return 0;
+ return pValue->Int32Value(pIsolate->GetCurrentContext()).FromMaybe(0);
+}
+
+bool ReentrantToBooleanHelper(v8::Isolate* pIsolate,
+ v8::Local<v8::Value> pValue) {
+ if (pValue.IsEmpty())
+ return false;
+ return pValue->BooleanValue(pIsolate);
+}
+
+double ReentrantToDoubleHelper(v8::Isolate* pIsolate,
+ v8::Local<v8::Value> pValue) {
+ if (pValue.IsEmpty())
+ return 0.0;
+ return pValue->NumberValue(pIsolate->GetCurrentContext()).FromMaybe(0.0);
+}
+
+WideString ReentrantToWideStringHelper(v8::Isolate* pIsolate,
+ v8::Local<v8::Value> pValue) {
+ if (pValue.IsEmpty())
+ return WideString();
+ v8::MaybeLocal<v8::String> maybe_string =
+ pValue->ToString(pIsolate->GetCurrentContext());
+ if (maybe_string.IsEmpty())
+ return WideString();
+ v8::String::Utf8Value s(pIsolate, maybe_string.ToLocalChecked());
+ return WideString::FromUTF8(ByteStringView(*s, s.length()));
+}
+
+ByteString ReentrantToByteStringHelper(v8::Isolate* pIsolate,
+ v8::Local<v8::Value> pValue) {
+ if (pValue.IsEmpty())
+ return ByteString();
+ v8::MaybeLocal<v8::String> maybe_string =
+ pValue->ToString(pIsolate->GetCurrentContext());
+ if (maybe_string.IsEmpty())
+ return ByteString();
+ v8::String::Utf8Value s(pIsolate, maybe_string.ToLocalChecked());
+ return ByteString(*s);
+}
+
+} // namespace fxv8
diff --git a/fxjs/fxv8.h b/fxjs/fxv8.h
new file mode 100644
index 0000000..690beb3
--- /dev/null
+++ b/fxjs/fxv8.h
@@ -0,0 +1,32 @@
+// Copyright 2020 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXJS_FXV8_H_
+#define FXJS_FXV8_H_
+
+#include "core/fxcrt/fx_string.h"
+#include "v8/include/v8.h"
+
+namespace fxv8 {
+
+v8::Local<v8::String> NewStringHelper(v8::Isolate* pIsolate,
+ ByteStringView str);
+v8::Local<v8::String> NewStringHelper(v8::Isolate* pIsolate,
+ WideStringView str);
+
+int ReentrantToInt32Helper(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue);
+bool ReentrantToBooleanHelper(v8::Isolate* pIsolate,
+ v8::Local<v8::Value> pValue);
+double ReentrantToDoubleHelper(v8::Isolate* pIsolate,
+ v8::Local<v8::Value> pValue);
+WideString ReentrantToWideStringHelper(v8::Isolate* pIsolate,
+ v8::Local<v8::Value> pValue);
+ByteString ReentrantToByteStringHelper(v8::Isolate* pIsolate,
+ v8::Local<v8::Value> pValue);
+
+} // namespace fxv8
+
+#endif // FXJS_FXV8_H_
diff --git a/fxjs/js_define.cpp b/fxjs/js_define.cpp
index fbb1e84..352370f 100644
--- a/fxjs/js_define.cpp
+++ b/fxjs/js_define.cpp
@@ -15,6 +15,7 @@
#include "fxjs/cjs_document.h"
#include "fxjs/cjs_object.h"
#include "fxjs/fx_date_helpers.h"
+#include "fxjs/fxv8.h"
void JSDestructor(v8::Local<v8::Object> obj) {
CFXJS_Engine::SetObjectPrivate(obj, nullptr);
@@ -30,17 +31,17 @@
// Use the built-in object method.
v8::Local<v8::Value> v =
context->Global()
- ->Get(context, CFX_V8::NewStringHelper(pIsolate, "Date"))
+ ->Get(context, fxv8::NewStringHelper(pIsolate, "Date"))
.ToLocalChecked();
if (v->IsObject()) {
v8::Local<v8::Object> o = v->ToObject(context).ToLocalChecked();
- v = o->Get(context, CFX_V8::NewStringHelper(pIsolate, "parse"))
+ v = o->Get(context, fxv8::NewStringHelper(pIsolate, "parse"))
.ToLocalChecked();
if (v->IsFunction()) {
v8::Local<v8::Function> funC = v8::Local<v8::Function>::Cast(v);
const int argc = 1;
v8::Local<v8::String> timeStr =
- CFX_V8::NewStringHelper(pIsolate, str.AsStringView());
+ fxv8::NewStringHelper(pIsolate, str.AsStringView());
v8::Local<v8::Value> argv[argc] = {timeStr};
v = funC->Call(context, context->Global(), argc, argv).ToLocalChecked();
if (v->IsNumber()) {
diff --git a/fxjs/xfa/cfxjse_class.cpp b/fxjs/xfa/cfxjse_class.cpp
index e4d83b6..75d4081 100644
--- a/fxjs/xfa/cfxjse_class.cpp
+++ b/fxjs/xfa/cfxjse_class.cpp
@@ -11,6 +11,7 @@
#include "fxjs/cfx_v8.h"
#include "fxjs/cjs_result.h"
+#include "fxjs/fxv8.h"
#include "fxjs/js_resources.h"
#include "fxjs/xfa/cfxjse_context.h"
#include "fxjs/xfa/cfxjse_isolatetracker.h"
@@ -67,7 +68,7 @@
if (info.This() == info.Holder() && lpClass->name) {
ByteString szStringVal = ByteString::Format("[object %s]", lpClass->name);
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), szStringVal.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), szStringVal.AsStringView()));
return;
}
v8::Local<v8::String> local_str =
@@ -105,7 +106,7 @@
WideString err = JSFormatErrorString(pClassDescriptor->name, *szPropName,
result.Error());
v8::Local<v8::String> str =
- CFX_V8::NewStringHelper(info.GetIsolate(), err.AsStringView());
+ fxv8::NewStringHelper(info.GetIsolate(), err.AsStringView());
info.GetIsolate()->ThrowException(str);
return;
}
@@ -140,7 +141,7 @@
hCallBackInfo->SetAlignedPointerInInternalField(
0, const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClass));
hCallBackInfo->SetInternalField(
- 1, CFX_V8::NewStringHelper(pIsolate, szPropName));
+ 1, fxv8::NewStringHelper(pIsolate, szPropName));
pValue->ForceSetValue(
v8::Function::New(pIsolate->GetCurrentContext(),
DynPropGetterAdapter_MethodCallback, hCallBackInfo,
@@ -283,7 +284,7 @@
v8::External::New(
pIsolate, const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)));
hFunctionTemplate->SetClassName(
- CFX_V8::NewStringHelper(pIsolate, lpClassDefinition->name));
+ fxv8::NewStringHelper(pIsolate, lpClassDefinition->name));
hFunctionTemplate->InstanceTemplate()->SetInternalFieldCount(2);
v8::Local<v8::ObjectTemplate> hObjectTemplate =
hFunctionTemplate->InstanceTemplate();
@@ -297,7 +298,7 @@
lpClassDefinition->methods + i)));
fun->RemovePrototype();
hObjectTemplate->Set(
- CFX_V8::NewStringHelper(pIsolate, lpClassDefinition->methods[i].name),
+ fxv8::NewStringHelper(pIsolate, lpClassDefinition->methods[i].name),
fun,
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));
}
@@ -309,7 +310,7 @@
v8::External::New(
pIsolate, const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)));
fn->RemovePrototype();
- hObjectTemplate->Set(CFX_V8::NewStringHelper(pIsolate, "toString"), fn);
+ hObjectTemplate->Set(fxv8::NewStringHelper(pIsolate, "toString"), fn);
}
pClass->m_hTemplate.Reset(lpContext->GetIsolate(), hFunctionTemplate);
CFXJSE_Class* pResult = pClass.get();
diff --git a/fxjs/xfa/cfxjse_context.cpp b/fxjs/xfa/cfxjse_context.cpp
index c5eafbe..a250755 100644
--- a/fxjs/xfa/cfxjse_context.cpp
+++ b/fxjs/xfa/cfxjse_context.cpp
@@ -9,6 +9,7 @@
#include <utility>
#include "fxjs/cfxjs_engine.h"
+#include "fxjs/fxv8.h"
#include "fxjs/xfa/cfxjse_class.h"
#include "fxjs/xfa/cfxjse_isolatetracker.h"
#include "fxjs/xfa/cfxjse_runtimedata.h"
@@ -68,18 +69,18 @@
v8::Local<v8::Context> context = pIsolate->GetCurrentContext();
v8::Local<v8::Value> hException = trycatch->Exception();
if (hException->IsObject()) {
- v8::Local<v8::String> hNameStr = CFX_V8::NewStringHelper(pIsolate, "name");
+ v8::Local<v8::String> hNameStr = fxv8::NewStringHelper(pIsolate, "name");
v8::Local<v8::Value> hValue =
hException.As<v8::Object>()->Get(context, hNameStr).ToLocalChecked();
if (hValue->IsString() || hValue->IsStringObject()) {
hReturnValue->Set(context, 0, hValue).FromJust();
} else {
v8::Local<v8::String> hErrorStr =
- CFX_V8::NewStringHelper(pIsolate, "Error");
+ fxv8::NewStringHelper(pIsolate, "Error");
hReturnValue->Set(context, 0, hErrorStr).FromJust();
}
v8::Local<v8::String> hMessageStr =
- CFX_V8::NewStringHelper(pIsolate, "message");
+ fxv8::NewStringHelper(pIsolate, "message");
hValue =
hException.As<v8::Object>()->Get(context, hMessageStr).ToLocalChecked();
if (hValue->IsString() || hValue->IsStringObject())
@@ -87,8 +88,7 @@
else
hReturnValue->Set(context, 1, hMessage->Get()).FromJust();
} else {
- v8::Local<v8::String> hErrorStr =
- CFX_V8::NewStringHelper(pIsolate, "Error");
+ v8::Local<v8::String> hErrorStr = fxv8::NewStringHelper(pIsolate, "Error");
hReturnValue->Set(context, 0, hErrorStr).FromJust();
hReturnValue->Set(context, 1, hMessage->Get()).FromJust();
}
@@ -191,7 +191,7 @@
hObjectTemplate->SetInternalFieldCount(2);
}
hObjectTemplate->Set(v8::Symbol::GetToStringTag(pIsolate),
- CFX_V8::NewStringHelper(pIsolate, "global"));
+ fxv8::NewStringHelper(pIsolate, "global"));
v8::Local<v8::Context> hNewContext =
v8::Context::New(pIsolate, nullptr, hObjectTemplate);
@@ -252,7 +252,7 @@
v8::Local<v8::Context> hContext = GetIsolate()->GetCurrentContext();
v8::TryCatch trycatch(GetIsolate());
v8::Local<v8::String> hScriptString =
- CFX_V8::NewStringHelper(GetIsolate(), szScript);
+ fxv8::NewStringHelper(GetIsolate(), szScript);
if (!lpNewThisObject) {
v8::Local<v8::Script> hScript;
if (v8::Script::Compile(hContext, hScriptString).ToLocal(&hScript)) {
@@ -273,7 +273,7 @@
v8::Local<v8::Value> hNewThis = v8::Local<v8::Value>::New(
GetIsolate(), lpNewThisObject->DirectGetValue());
ASSERT(!hNewThis.IsEmpty());
- v8::Local<v8::String> hEval = CFX_V8::NewStringHelper(
+ v8::Local<v8::String> hEval = fxv8::NewStringHelper(
GetIsolate(), "(function () { return eval(arguments[0]); })");
v8::Local<v8::Script> hWrapper =
v8::Script::Compile(hContext, hEval).ToLocalChecked();
diff --git a/fxjs/xfa/cfxjse_formcalc_context.cpp b/fxjs/xfa/cfxjse_formcalc_context.cpp
index 9d702b6..cad930c 100644
--- a/fxjs/xfa/cfxjse_formcalc_context.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context.cpp
@@ -14,6 +14,7 @@
#include "core/fxcrt/cfx_widetextbuf.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_random.h"
+#include "fxjs/fxv8.h"
#include "fxjs/xfa/cfxjse_class.h"
#include "fxjs/xfa/cfxjse_context.h"
#include "fxjs/xfa/cfxjse_engine.h"
@@ -1941,7 +1942,7 @@
ByteString bsFormat =
GetStandardDateFormat(pThis, iStyle, bsLocale.AsStringView());
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), bsFormat.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), bsFormat.AsStringView()));
}
// static
@@ -2050,7 +2051,7 @@
ByteString bsFormat =
GetLocalDateFormat(pThis, iStyle, bsLocale.AsStringView(), false);
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), bsFormat.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), bsFormat.AsStringView()));
}
// static
@@ -2088,7 +2089,7 @@
ByteString bsFormat =
GetLocalTimeFormat(pThis, iStyle, bsLocale.AsStringView(), false);
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), bsFormat.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), bsFormat.AsStringView()));
}
// static
@@ -2229,7 +2230,7 @@
ByteString::Format("%d%02d%02d", iYear + i, iMonth, iDay).AsStringView(),
bsFormat.AsStringView(), bsLocale.AsStringView());
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), bsLocalDate.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), bsLocalDate.AsStringView()));
}
// static
@@ -2276,7 +2277,7 @@
ByteString bsGMTTime = Num2AllTime(pThis, iTime, bsFormat.AsStringView(),
bsLocale.AsStringView(), true);
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), bsGMTTime.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), bsGMTTime.AsStringView()));
}
// static
@@ -2324,7 +2325,7 @@
Num2AllTime(pThis, static_cast<int32_t>(fTime), bsFormat.AsStringView(),
bsLocale.AsStringView(), false);
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), bsLocalTime.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), bsLocalTime.AsStringView()));
}
// static
@@ -2462,7 +2463,7 @@
ByteString bsFormat =
GetStandardTimeFormat(pThis, iStyle, bsLocale.AsStringView());
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), bsFormat.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), bsFormat.AsStringView()));
}
// static
@@ -3071,16 +3072,16 @@
propertyValue->ToString().AsStringView(), newPropertyValue.get());
}
ByteString bsChosen = ValueToUTF8String(newPropertyValue.get());
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
- info.GetIsolate(), bsChosen.AsStringView()));
+ info.GetReturnValue().Set(
+ fxv8::NewStringHelper(info.GetIsolate(), bsChosen.AsStringView()));
bFound = true;
}
} else {
iValueIndex++;
if (iValueIndex == iIndex) {
ByteString bsChosen = ValueToUTF8String(argIndexValue.get());
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
- info.GetIsolate(), bsChosen.AsStringView()));
+ info.GetReturnValue().Set(
+ fxv8::NewStringHelper(info.GetIsolate(), bsChosen.AsStringView()));
bFound = true;
}
}
@@ -3381,24 +3382,19 @@
}
switch (eParserStatus) {
case VALUETYPE_ISCM:
- info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), "cm"));
+ info.GetReturnValue().Set(fxv8::NewStringHelper(info.GetIsolate(), "cm"));
break;
case VALUETYPE_ISMM:
- info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), "mm"));
+ info.GetReturnValue().Set(fxv8::NewStringHelper(info.GetIsolate(), "mm"));
break;
case VALUETYPE_ISPT:
- info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), "pt"));
+ info.GetReturnValue().Set(fxv8::NewStringHelper(info.GetIsolate(), "pt"));
break;
case VALUETYPE_ISMP:
- info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), "mp"));
+ info.GetReturnValue().Set(fxv8::NewStringHelper(info.GetIsolate(), "mp"));
break;
default:
- info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), "in"));
+ info.GetReturnValue().Set(fxv8::NewStringHelper(info.GetIsolate(), "in"));
break;
}
}
@@ -3596,7 +3592,7 @@
return;
}
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), bsResult.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), bsResult.AsStringView()));
}
// static
@@ -3620,7 +3616,7 @@
WideString::FromUTF8(ValueToUTF8String(argOne.get()).AsStringView()));
auto result = FX_UTF8Encode(decoded.AsStringView());
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
return;
}
@@ -3646,7 +3642,7 @@
auto result = FX_UTF8Encode(decoded.AsStringView());
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
}
// static
@@ -3668,7 +3664,7 @@
WideString encoded = EncodeURL(ValueToUTF8String(argOne.get()));
auto result = FX_UTF8Encode(encoded.AsStringView());
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
return;
}
@@ -3691,7 +3687,7 @@
auto result = FX_UTF8Encode(encoded.AsStringView());
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
}
// static
@@ -3770,8 +3766,8 @@
info.GetReturnValue().SetEmptyString();
return;
}
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
- info.GetIsolate(), wsRet.ToUTF8().AsStringView()));
+ info.GetReturnValue().Set(
+ fxv8::NewStringHelper(info.GetIsolate(), wsRet.ToUTF8().AsStringView()));
}
// static
@@ -3793,7 +3789,7 @@
ByteString bsSource = ValueToUTF8String(argOne.get());
int32_t count = std::max(0, ValueToInteger(pThis, argTwo.get()));
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetReturnValue().Set(fxv8::NewStringHelper(
info.GetIsolate(), bsSource.First(count).AsStringView()));
}
@@ -3846,7 +3842,7 @@
auto result = FX_UTF8Encode(szLowBuf.AsStringView());
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
}
// static
@@ -3867,7 +3863,7 @@
ByteString bsSource = ValueToUTF8String(argOne.get());
bsSource.TrimLeft();
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), bsSource.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), bsSource.AsStringView()));
}
// static
@@ -3908,7 +3904,7 @@
}
auto result = localeValue.GetValue().ToUTF8();
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
return;
}
@@ -3933,7 +3929,7 @@
}
auto result = localeValue.GetValue().ToUTF8();
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
return;
}
case XFA_VT_DATE: {
@@ -3946,7 +3942,7 @@
}
auto result = localeValue.GetValue().ToUTF8();
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
return;
}
case XFA_VT_TIME: {
@@ -3959,7 +3955,7 @@
}
auto result = localeValue.GetValue().ToUTF8();
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
return;
}
case XFA_VT_TEXT: {
@@ -3972,7 +3968,7 @@
}
auto result = localeValue.GetValue().ToUTF8();
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
return;
}
case XFA_VT_FLOAT: {
@@ -4003,8 +3999,8 @@
pLocale, pMgr);
if (localeValue.IsValid()) {
auto result = localeValue.GetValue().ToUTF8();
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
- info.GetIsolate(), result.AsStringView()));
+ info.GetReturnValue().Set(
+ fxv8::NewStringHelper(info.GetIsolate(), result.AsStringView()));
return;
}
}
@@ -4070,7 +4066,7 @@
}
}
szResult << '\0';
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetReturnValue().Set(fxv8::NewStringHelper(
info.GetIsolate(), ByteStringView(szResult.str().c_str())));
}
@@ -4093,7 +4089,7 @@
ByteString bsSource = ValueToUTF8String(argOne.get());
int32_t count = std::max(0, ValueToInteger(pThis, argTwo.get()));
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetReturnValue().Set(fxv8::NewStringHelper(
info.GetIsolate(), bsSource.Last(count).AsStringView()));
}
@@ -4115,7 +4111,7 @@
ByteString bsSource = ValueToUTF8String(argOne.get());
bsSource.TrimRight();
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), bsSource.AsStringView()));
+ fxv8::NewStringHelper(info.GetIsolate(), bsSource.AsStringView()));
}
// static
@@ -4141,7 +4137,7 @@
index++;
}
spaceString << '\0';
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetReturnValue().Set(fxv8::NewStringHelper(
info.GetIsolate(), ByteStringView(spaceString.str().c_str())));
}
@@ -4202,7 +4198,7 @@
++i;
}
resultBuf << '\0';
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetReturnValue().Set(fxv8::NewStringHelper(
info.GetIsolate(), ByteStringView(resultBuf.str().c_str())));
return;
}
@@ -4222,7 +4218,7 @@
}
resultBuf << pData;
}
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetReturnValue().Set(fxv8::NewStringHelper(
info.GetIsolate(), ByteStringView(resultBuf.str().c_str())));
return;
}
@@ -4259,7 +4255,7 @@
++i;
}
resultBuf << '\0';
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetReturnValue().Set(fxv8::NewStringHelper(
info.GetIsolate(), ByteStringView(resultBuf.str().c_str())));
}
@@ -4311,7 +4307,7 @@
++i;
}
szResult << '\0';
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetReturnValue().Set(fxv8::NewStringHelper(
info.GetIsolate(), ByteStringView(szResult.str().c_str())));
;
}
@@ -4353,7 +4349,7 @@
// Negative values are treated as 0. Can't clamp() due to sign mismatches.
size_t iCount = std::max(ValueToInteger(pThis, end_value.get()), 0);
iCount = std::min(iCount, iLength - iStart);
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetReturnValue().Set(fxv8::NewStringHelper(
info.GetIsolate(), bsSource.Substr(iStart, iCount).AsStringView()));
}
@@ -4372,7 +4368,7 @@
std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, info, 0);
iNum = static_cast<int32_t>(ValueToFloat(pThis, argOne.get()));
}
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetReturnValue().Set(fxv8::NewStringHelper(
info.GetIsolate(), GUIDString(!!iNum).AsStringView()));
}
@@ -4409,7 +4405,7 @@
}
upperStringBuf.AppendChar(0);
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetReturnValue().Set(fxv8::NewStringHelper(
info.GetIsolate(),
FX_UTF8Encode(upperStringBuf.AsStringView()).AsStringView()));
}
@@ -4455,11 +4451,11 @@
if (std::isnan(fNumber) || fNumber < 0.0f ||
fNumber > 922337203685477550.0f) {
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(info.GetIsolate(), "*"));
+ info.GetReturnValue().Set(fxv8::NewStringHelper(info.GetIsolate(), "*"));
return;
}
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetReturnValue().Set(fxv8::NewStringHelper(
info.GetIsolate(),
WordUS(ByteString::Format("%.2f", fNumber), iIdentifier).AsStringView()));
}
@@ -4493,7 +4489,7 @@
std::vector<uint8_t> dataBuf(size);
pFile->ReadBlock(dataBuf.data(), size);
info.GetReturnValue().Set(
- CFX_V8::NewStringHelper(info.GetIsolate(), ByteStringView(dataBuf)));
+ fxv8::NewStringHelper(info.GetIsolate(), ByteStringView(dataBuf)));
}
// static
@@ -4549,7 +4545,7 @@
pContext->ThrowServerDeniedException();
return;
}
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetReturnValue().Set(fxv8::NewStringHelper(
info.GetIsolate(), decodedResponse.ToUTF8().AsStringView()));
}
@@ -5068,7 +5064,7 @@
pContext->ThrowCompilerErrorException();
return;
}
- info.GetReturnValue().Set(CFX_V8::NewStringHelper(
+ info.GetReturnValue().Set(fxv8::NewStringHelper(
info.GetIsolate(),
FX_UTF8Encode(wsJavaScriptBuf.AsStringView()).AsStringView()));
}
@@ -5762,11 +5758,11 @@
}
const ByteString bsName =
- CFX_V8::ReentrantToByteStringHelper(info.GetIsolate(), info[2]);
+ fxv8::ReentrantToByteStringHelper(info.GetIsolate(), info[2]);
const bool bHasNoResolveName = bDotAccessor && bsName.IsEmpty();
ByteString bsSomExp = GenerateSomExpression(
bsName.AsStringView(),
- CFX_V8::ReentrantToInt32Helper(info.GetIsolate(), info[3]), iIndexValue,
+ fxv8::ReentrantToInt32Helper(info.GetIsolate(), info[3]), iIndexValue,
bIsStar);
auto argAccessor =
@@ -5826,7 +5822,7 @@
XFA_RESOLVENODE_RS resolveNodeRS;
bool bRet = false;
ByteString bsAccessorName =
- CFX_V8::ReentrantToByteStringHelper(info.GetIsolate(), info[1]);
+ fxv8::ReentrantToByteStringHelper(info.GetIsolate(), info[1]);
if (argAccessor->IsObject() ||
(argAccessor->IsNull() && bsAccessorName.IsEmpty())) {
bRet = ResolveObjects(pThis, argAccessor.get(), bsSomExp.AsStringView(),
diff --git a/fxjs/xfa/cfxjse_runtimedata.cpp b/fxjs/xfa/cfxjse_runtimedata.cpp
index 2a7acbf..87ff7eb 100644
--- a/fxjs/xfa/cfxjse_runtimedata.cpp
+++ b/fxjs/xfa/cfxjse_runtimedata.cpp
@@ -9,6 +9,7 @@
#include <utility>
#include "fxjs/cfxjs_engine.h"
+#include "fxjs/fxv8.h"
#include "fxjs/xfa/cfxjse_isolatetracker.h"
CFXJSE_RuntimeData::CFXJSE_RuntimeData() = default;
@@ -25,7 +26,7 @@
v8::Local<v8::ObjectTemplate> hGlobalTemplate =
hFuncTemplate->InstanceTemplate();
hGlobalTemplate->Set(v8::Symbol::GetToStringTag(pIsolate),
- CFX_V8::NewStringHelper(pIsolate, "global"));
+ fxv8::NewStringHelper(pIsolate, "global"));
v8::Local<v8::Context> hContext =
v8::Context::New(pIsolate, 0, hGlobalTemplate);
diff --git a/fxjs/xfa/cfxjse_value.cpp b/fxjs/xfa/cfxjse_value.cpp
index 40b3d79..97551e5 100644
--- a/fxjs/xfa/cfxjse_value.cpp
+++ b/fxjs/xfa/cfxjse_value.cpp
@@ -9,6 +9,7 @@
#include <math.h>
#include "fxjs/cfx_v8.h"
+#include "fxjs/fxv8.h"
#include "fxjs/xfa/cfxjse_class.h"
#include "fxjs/xfa/cfxjse_context.h"
#include "fxjs/xfa/cfxjse_isolatetracker.h"
@@ -59,8 +60,7 @@
ASSERT(pIsolate);
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate);
- v8::Local<v8::String> hMessage =
- CFX_V8::NewStringHelper(pIsolate, utf8Message);
+ v8::Local<v8::String> hMessage = fxv8::NewStringHelper(pIsolate, utf8Message);
v8::Local<v8::Value> hError = v8::Exception::Error(hMessage);
pIsolate->ThrowException(hError);
}
@@ -138,7 +138,7 @@
return false;
v8::Local<v8::String> hPropName =
- CFX_V8::NewStringHelper(GetIsolate(), szPropName);
+ fxv8::NewStringHelper(GetIsolate(), szPropName);
v8::Local<v8::Value> hPropValue =
v8::Local<v8::Value>::New(GetIsolate(), lpPropValue->DirectGetValue());
v8::Maybe<bool> result = hObject.As<v8::Object>()->Set(
@@ -156,7 +156,7 @@
return false;
v8::Local<v8::String> hPropName =
- CFX_V8::NewStringHelper(GetIsolate(), szPropName);
+ fxv8::NewStringHelper(GetIsolate(), szPropName);
v8::Local<v8::Value> hPropValue =
hObject.As<v8::Object>()
->Get(GetIsolate()->GetCurrentContext(), hPropName)
@@ -188,7 +188,7 @@
return hObject->IsObject() &&
hObject.As<v8::Object>()
->Delete(GetIsolate()->GetCurrentContext(),
- CFX_V8::NewStringHelper(GetIsolate(), szPropName))
+ fxv8::NewStringHelper(GetIsolate(), szPropName))
.FromJust();
}
@@ -200,8 +200,7 @@
if (!hObject->IsObject())
return false;
- v8::Local<v8::String> hKey =
- CFX_V8::NewStringHelper(GetIsolate(), szPropName);
+ v8::Local<v8::String> hKey = fxv8::NewStringHelper(GetIsolate(), szPropName);
return hObject.As<v8::Object>()
->HasRealNamedProperty(GetIsolate()->GetCurrentContext(), hKey)
.FromJust() ||
@@ -221,7 +220,7 @@
return false;
v8::Local<v8::String> hPropName =
- CFX_V8::NewStringHelper(GetIsolate(), szPropName);
+ fxv8::NewStringHelper(GetIsolate(), szPropName);
v8::Local<v8::Value> pValue =
v8::Local<v8::Value>::New(GetIsolate(), lpPropValue->m_hValue);
return hObject.As<v8::Object>()
@@ -249,9 +248,9 @@
rgArgs[1] = hNewThis;
v8::Local<v8::String> hBinderFuncSource =
- CFX_V8::NewStringHelper(GetIsolate(),
- "(function (oldfunction, newthis) { return "
- "oldfunction.bind(newthis); })");
+ fxv8::NewStringHelper(GetIsolate(),
+ "(function (oldfunction, newthis) { return "
+ "oldfunction.bind(newthis); })");
v8::Local<v8::Context> hContext = GetIsolate()->GetCurrentContext();
v8::Local<v8::Function> hBinderFunc =
v8::Script::Compile(hContext, hBinderFuncSource)
@@ -366,7 +365,7 @@
bool CFXJSE_Value::ToBoolean() const {
ASSERT(!IsEmpty());
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(GetIsolate());
- return CFX_V8::ReentrantToBooleanHelper(
+ return fxv8::ReentrantToBooleanHelper(
GetIsolate(), v8::Local<v8::Value>::New(GetIsolate(), m_hValue));
}
@@ -377,21 +376,21 @@
double CFXJSE_Value::ToDouble() const {
ASSERT(!IsEmpty());
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(GetIsolate());
- return CFX_V8::ReentrantToDoubleHelper(
+ return fxv8::ReentrantToDoubleHelper(
GetIsolate(), v8::Local<v8::Value>::New(GetIsolate(), m_hValue));
}
int32_t CFXJSE_Value::ToInteger() const {
ASSERT(!IsEmpty());
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(GetIsolate());
- return CFX_V8::ReentrantToInt32Helper(
+ return fxv8::ReentrantToInt32Helper(
GetIsolate(), v8::Local<v8::Value>::New(GetIsolate(), m_hValue));
}
ByteString CFXJSE_Value::ToString() const {
ASSERT(!IsEmpty());
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(GetIsolate());
- return CFX_V8::ReentrantToByteStringHelper(
+ return fxv8::ReentrantToByteStringHelper(
GetIsolate(), v8::Local<v8::Value>::New(GetIsolate(), m_hValue));
}
@@ -427,6 +426,6 @@
void CFXJSE_Value::SetString(ByteStringView szString) {
CFXJSE_ScopeUtil_IsolateHandle scope(GetIsolate());
- v8::Local<v8::Value> hValue = CFX_V8::NewStringHelper(GetIsolate(), szString);
+ v8::Local<v8::Value> hValue = fxv8::NewStringHelper(GetIsolate(), szString);
m_hValue.Reset(GetIsolate(), hValue);
}