Avoid non-const reference parameters in CFXJSE_Context.
v8::Local can be passed by value here.
Change-Id: I41106507ccb0eb9628ce5880270ba65c08a93874
Reviewed-on: https://pdfium-review.googlesource.com/c/46855
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/cfxjse_context.cpp b/fxjs/cfxjse_context.cpp
index 04c3f49..e80d0c9 100644
--- a/fxjs/cfxjse_context.cpp
+++ b/fxjs/cfxjse_context.cpp
@@ -56,14 +56,14 @@
char g_FXJSEProxyObjectTag[] = "FXJSE Proxy Object";
v8::Local<v8::Object> CreateReturnValue(v8::Isolate* pIsolate,
- v8::TryCatch& trycatch) {
+ v8::TryCatch* trycatch) {
v8::Local<v8::Object> hReturnValue = v8::Object::New(pIsolate);
- if (!trycatch.HasCaught())
+ if (!trycatch->HasCaught())
return hReturnValue;
v8::Local<v8::Context> context = pIsolate->GetCurrentContext();
- v8::Local<v8::Value> hException = trycatch.Exception();
- v8::Local<v8::Message> hMessage = trycatch.Message();
+ v8::Local<v8::Value> hException = trycatch->Exception();
+ v8::Local<v8::Message> hMessage = trycatch->Message();
if (hException->IsObject()) {
v8::Local<v8::String> hNameStr =
v8::String::NewFromUtf8(pIsolate, "name", v8::NewStringType::kNormal)
@@ -124,7 +124,7 @@
v8::Context::Scope m_cscope;
};
-void FXJSE_UpdateProxyBinding(v8::Local<v8::Object>& hObject) {
+void FXJSE_UpdateProxyBinding(v8::Local<v8::Object> hObject) {
ASSERT(!hObject.IsEmpty());
ASSERT(hObject->InternalFieldCount() == 2);
hObject->SetAlignedPointerInInternalField(0, g_FXJSEProxyObjectTag);
@@ -133,7 +133,7 @@
} // namespace
-void FXJSE_UpdateObjectBinding(v8::Local<v8::Object>& hObject,
+void FXJSE_UpdateObjectBinding(v8::Local<v8::Object> hObject,
CFXJSE_HostObject* lpNewBinding) {
ASSERT(!hObject.IsEmpty());
ASSERT(hObject->InternalFieldCount() == 2);
@@ -269,7 +269,7 @@
}
if (lpRetValue) {
lpRetValue->m_hValue.Reset(GetIsolate(),
- CreateReturnValue(GetIsolate(), trycatch));
+ CreateReturnValue(GetIsolate(), &trycatch));
}
return false;
}
@@ -316,7 +316,7 @@
if (lpRetValue) {
lpRetValue->m_hValue.Reset(GetIsolate(),
- CreateReturnValue(GetIsolate(), trycatch));
+ CreateReturnValue(GetIsolate(), &trycatch));
}
return false;
}
diff --git a/fxjs/cfxjse_context.h b/fxjs/cfxjse_context.h
index 306cefd..4f65b04 100644
--- a/fxjs/cfxjse_context.h
+++ b/fxjs/cfxjse_context.h
@@ -49,7 +49,7 @@
std::vector<std::unique_ptr<CFXJSE_Class>> m_rgClasses;
};
-void FXJSE_UpdateObjectBinding(v8::Local<v8::Object>& hObject,
+void FXJSE_UpdateObjectBinding(v8::Local<v8::Object> hObject,
CFXJSE_HostObject* lpNewBinding);
CFXJSE_HostObject* FXJSE_RetrieveObjectBinding(v8::Local<v8::Object> hJSObject);