1 // Copyright 2018 The PDFium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #include "fxjs/xfa/fxjse.h" 8 9 #include "fxjs/fxv8.h" 10 #include "fxjs/xfa/cfxjse_context.h" 11 #include "v8/include/v8-isolate.h" 12 #include "v8/include/v8-object.h" 13 #include "v8/include/v8-template.h" 14 15 namespace pdfium::fxjse { 16 17 const char kFuncTag[] = "function descriptor tag"; 18 const char kClassTag[] = "class descriptor tag"; 19 20 } // namespace pdfium::fxjse 21 22 // static FromV8(v8::Local<v8::Value> arg)23CFXJSE_HostObject* CFXJSE_HostObject::FromV8(v8::Local<v8::Value> arg) { 24 if (!fxv8::IsObject(arg)) 25 return nullptr; 26 27 return FXJSE_RetrieveObjectBinding(arg.As<v8::Object>()); 28 } 29 30 CFXJSE_HostObject::CFXJSE_HostObject() = default; 31 32 CFXJSE_HostObject::~CFXJSE_HostObject() = default; 33 AsFormCalcContext()34CFXJSE_FormCalcContext* CFXJSE_HostObject::AsFormCalcContext() { 35 return nullptr; 36 } 37 AsCJXObject()38CJX_Object* CFXJSE_HostObject::AsCJXObject() { 39 return nullptr; 40 } 41 NewBoundV8Object(v8::Isolate * pIsolate,v8::Local<v8::FunctionTemplate> tmpl)42v8::Local<v8::Object> CFXJSE_HostObject::NewBoundV8Object( 43 v8::Isolate* pIsolate, 44 v8::Local<v8::FunctionTemplate> tmpl) { 45 v8::Local<v8::Object> hObject = 46 tmpl->InstanceTemplate() 47 ->NewInstance(pIsolate->GetCurrentContext()) 48 .ToLocalChecked(); 49 FXJSE_UpdateObjectBinding(hObject, this); 50 return hObject; 51 } 52