From 435546810a7c48f09889c00600ad344850b71f95 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 29 Sep 2016 17:29:48 -0700 Subject: Move fxjs/include to fxjs BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2380713005 --- BUILD.gn | 12 +- fpdfsdk/javascript/DEPS | 2 +- fpdfsdk/javascript/JS_Define.h | 2 +- fpdfsdk/javascript/JS_Object.h | 2 +- fpdfsdk/javascript/JS_Value.h | 2 +- fpdfsdk/javascript/cjs_runtime.cpp | 2 +- fpdfsdk/javascript/cjs_runtime.h | 2 +- fpdfsdk/javascript/ijs_runtime.h | 2 +- fxjs/cfxjse_arguments.cpp | 6 +- fxjs/cfxjse_arguments.h | 38 ++++ fxjs/cfxjse_class.cpp | 6 +- fxjs/cfxjse_class.h | 45 ++++ fxjs/cfxjse_context.cpp | 6 +- fxjs/cfxjse_context.h | 65 ++++++ fxjs/cfxjse_runtimedata.cpp | 2 +- fxjs/cfxjse_value.cpp | 6 +- fxjs/cfxjse_value.h | 101 +++++++++ fxjs/fxjs_v8.cpp | 2 +- fxjs/fxjs_v8.h | 262 +++++++++++++++++++++++ fxjs/fxjse.h | 74 +++++++ fxjs/include/cfxjse_arguments.h | 38 ---- fxjs/include/cfxjse_class.h | 45 ---- fxjs/include/cfxjse_context.h | 65 ------ fxjs/include/cfxjse_value.h | 102 --------- fxjs/include/fxjs_v8.h | 262 ----------------------- fxjs/include/fxjse.h | 74 ------- testing/DEPS | 6 +- testing/js_embedder_test.h | 2 +- xfa/fxfa/DEPS | 2 +- xfa/fxfa/app/xfa_ffnotify.cpp | 2 +- xfa/fxfa/app/xfa_ffwidgetacc.cpp | 2 +- xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 6 +- xfa/fxfa/fm2js/xfa_fm2jscontext.h | 4 +- xfa/fxfa/include/fxfa_basic.h | 4 +- xfa/fxfa/parser/cscript_datawindow.cpp | 2 +- xfa/fxfa/parser/cscript_datawindow.h | 2 +- xfa/fxfa/parser/cscript_eventpseudomodel.cpp | 2 +- xfa/fxfa/parser/cscript_eventpseudomodel.h | 2 +- xfa/fxfa/parser/cscript_hostpseudomodel.cpp | 2 +- xfa/fxfa/parser/cscript_hostpseudomodel.h | 2 +- xfa/fxfa/parser/cscript_layoutpseudomodel.cpp | 2 +- xfa/fxfa/parser/cscript_layoutpseudomodel.h | 2 +- xfa/fxfa/parser/cscript_logpseudomodel.cpp | 2 +- xfa/fxfa/parser/cscript_logpseudomodel.h | 2 +- xfa/fxfa/parser/cscript_signaturepseudomodel.cpp | 2 +- xfa/fxfa/parser/cscript_signaturepseudomodel.h | 2 +- xfa/fxfa/parser/cxfa_node.cpp | 2 +- xfa/fxfa/parser/cxfa_object.cpp | 2 +- xfa/fxfa/parser/cxfa_scriptcontext.cpp | 6 +- xfa/fxfa/parser/cxfa_scriptcontext.h | 2 +- xfa/fxfa/parser/cxfa_valuearray.h | 2 +- xfa/fxfa/parser/xfa_object.h | 2 +- xfa/fxfa/parser/xfa_resolvenode_rs.h | 2 +- 53 files changed, 647 insertions(+), 648 deletions(-) create mode 100644 fxjs/cfxjse_arguments.h create mode 100644 fxjs/cfxjse_class.h create mode 100644 fxjs/cfxjse_context.h create mode 100644 fxjs/cfxjse_value.h create mode 100644 fxjs/fxjs_v8.h create mode 100644 fxjs/fxjse.h delete mode 100644 fxjs/include/cfxjse_arguments.h delete mode 100644 fxjs/include/cfxjse_class.h delete mode 100644 fxjs/include/cfxjse_context.h delete mode 100644 fxjs/include/cfxjse_value.h delete mode 100644 fxjs/include/fxjs_v8.h delete mode 100644 fxjs/include/fxjse.h diff --git a/BUILD.gn b/BUILD.gn index 3b872fe7c5..f2015c3d11 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1010,7 +1010,7 @@ if (pdf_enable_v8) { static_library("fxjs") { sources = [ "fxjs/fxjs_v8.cpp", - "fxjs/include/fxjs_v8.h", + "fxjs/fxjs_v8.h", ] configs += [ ":pdfium_core_config" ] deps = [ @@ -1029,18 +1029,18 @@ if (pdf_enable_v8) { if (pdf_enable_xfa) { sources += [ "fxjs/cfxjse_arguments.cpp", + "fxjs/cfxjse_arguments.h", "fxjs/cfxjse_class.cpp", + "fxjs/cfxjse_class.h", "fxjs/cfxjse_context.cpp", + "fxjs/cfxjse_context.h", "fxjs/cfxjse_isolatetracker.cpp", "fxjs/cfxjse_isolatetracker.h", "fxjs/cfxjse_runtimedata.cpp", "fxjs/cfxjse_runtimedata.h", "fxjs/cfxjse_value.cpp", - "fxjs/include/cfxjse_arguments.h", - "fxjs/include/cfxjse_class.h", - "fxjs/include/cfxjse_context.h", - "fxjs/include/cfxjse_value.h", - "fxjs/include/fxjse.h", + "fxjs/cfxjse_value.h", + "fxjs/fxjse.h", ] } } diff --git a/fpdfsdk/javascript/DEPS b/fpdfsdk/javascript/DEPS index 2598fba87a..819aa99900 100644 --- a/fpdfsdk/javascript/DEPS +++ b/fpdfsdk/javascript/DEPS @@ -1,5 +1,5 @@ include_rules = [ '+core/fdrm/crypto', '+core/fpdfapi/fpdf_font', - '+fxjs/include' + '+fxjs' ] diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h index 770f9f5459..1c688d2c11 100644 --- a/fpdfsdk/javascript/JS_Define.h +++ b/fpdfsdk/javascript/JS_Define.h @@ -12,7 +12,7 @@ #include "fpdfsdk/javascript/JS_Object.h" #include "fpdfsdk/javascript/JS_Value.h" #include "fpdfsdk/javascript/resource.h" -#include "fxjs/include/fxjs_v8.h" +#include "fxjs/fxjs_v8.h" struct JSConstSpec { const wchar_t* pName; diff --git a/fpdfsdk/javascript/JS_Object.h b/fpdfsdk/javascript/JS_Object.h index 7653115ec3..1f619181f3 100644 --- a/fpdfsdk/javascript/JS_Object.h +++ b/fpdfsdk/javascript/JS_Object.h @@ -12,7 +12,7 @@ #include "fpdfsdk/fsdk_define.h" #include "fpdfsdk/javascript/cjs_runtime.h" -#include "fxjs/include/fxjs_v8.h" +#include "fxjs/fxjs_v8.h" class CJS_Context; class CJS_Object; diff --git a/fpdfsdk/javascript/JS_Value.h b/fpdfsdk/javascript/JS_Value.h index ef79d7b91b..ff2c620980 100644 --- a/fpdfsdk/javascript/JS_Value.h +++ b/fpdfsdk/javascript/JS_Value.h @@ -10,7 +10,7 @@ #include #include "core/fxcrt/fx_basic.h" -#include "fxjs/include/fxjs_v8.h" +#include "fxjs/fxjs_v8.h" class CJS_Array; class CJS_Date; diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp index e078564ff9..bae7ca0136 100644 --- a/fpdfsdk/javascript/cjs_runtime.cpp +++ b/fpdfsdk/javascript/cjs_runtime.cpp @@ -33,7 +33,7 @@ #ifdef PDF_ENABLE_XFA #include "fpdfsdk/fpdfxfa/fpdfxfa_app.h" -#include "fxjs/include/cfxjse_value.h" +#include "fxjs/cfxjse_value.h" #endif // PDF_ENABLE_XFA // static diff --git a/fpdfsdk/javascript/cjs_runtime.h b/fpdfsdk/javascript/cjs_runtime.h index d438e46a6d..3ad2e0fed5 100644 --- a/fpdfsdk/javascript/cjs_runtime.h +++ b/fpdfsdk/javascript/cjs_runtime.h @@ -17,7 +17,7 @@ #include "core/fxcrt/fx_basic.h" #include "fpdfsdk/javascript/JS_EventHandler.h" #include "fpdfsdk/javascript/ijs_runtime.h" -#include "fxjs/include/fxjs_v8.h" +#include "fxjs/fxjs_v8.h" class CJS_Context; diff --git a/fpdfsdk/javascript/ijs_runtime.h b/fpdfsdk/javascript/ijs_runtime.h index be0cd042d2..0c2bd042c6 100644 --- a/fpdfsdk/javascript/ijs_runtime.h +++ b/fpdfsdk/javascript/ijs_runtime.h @@ -11,7 +11,7 @@ #include "core/fxcrt/fx_system.h" #ifdef PDF_ENABLE_XFA -#include "fxjs/include/fxjse.h" +#include "fxjs/fxjse.h" #endif // PDF_ENABLE_XFA class CPDFSDK_Environment; diff --git a/fxjs/cfxjse_arguments.cpp b/fxjs/cfxjse_arguments.cpp index 1ff425d8b1..f1dcd2c153 100644 --- a/fxjs/cfxjse_arguments.cpp +++ b/fxjs/cfxjse_arguments.cpp @@ -4,10 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fxjs/include/cfxjse_arguments.h" +#include "fxjs/cfxjse_arguments.h" -#include "fxjs/include/cfxjse_context.h" -#include "fxjs/include/cfxjse_value.h" +#include "fxjs/cfxjse_context.h" +#include "fxjs/cfxjse_value.h" v8::Isolate* CFXJSE_Arguments::GetRuntime() const { return m_pRetValue->GetIsolate(); diff --git a/fxjs/cfxjse_arguments.h b/fxjs/cfxjse_arguments.h new file mode 100644 index 0000000000..c38c2925ab --- /dev/null +++ b/fxjs/cfxjse_arguments.h @@ -0,0 +1,38 @@ +// Copyright 2016 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_CFXJSE_ARGUMENTS_H_ +#define FXJS_CFXJSE_ARGUMENTS_H_ + +#include + +#include "fxjs/fxjse.h" + +class CFXJSE_Class; + +class CFXJSE_Arguments { + public: + CFXJSE_Arguments(const v8::FunctionCallbackInfo* pInfo, + CFXJSE_Value* pRetValue) + : m_pInfo(pInfo), m_pRetValue(pRetValue) {} + + v8::Isolate* GetRuntime() const; + int32_t GetLength() const; + std::unique_ptr GetValue(int32_t index) const; + FX_BOOL GetBoolean(int32_t index) const; + int32_t GetInt32(int32_t index) const; + FX_FLOAT GetFloat(int32_t index) const; + CFX_ByteString GetUTF8String(int32_t index) const; + CFXJSE_HostObject* GetObject(int32_t index, + CFXJSE_Class* pClass = nullptr) const; + CFXJSE_Value* GetReturnValue(); + + private: + const v8::FunctionCallbackInfo* m_pInfo; + CFXJSE_Value* m_pRetValue; +}; + +#endif // FXJS_CFXJSE_ARGUMENTS_H_ diff --git a/fxjs/cfxjse_class.cpp b/fxjs/cfxjse_class.cpp index 6ccc0e2e24..c2c8e5fec2 100644 --- a/fxjs/cfxjse_class.cpp +++ b/fxjs/cfxjse_class.cpp @@ -4,10 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fxjs/include/cfxjse_class.h" +#include "fxjs/cfxjse_class.h" -#include "fxjs/include/cfxjse_context.h" -#include "fxjs/include/cfxjse_value.h" +#include "fxjs/cfxjse_context.h" +#include "fxjs/cfxjse_value.h" namespace { diff --git a/fxjs/cfxjse_class.h b/fxjs/cfxjse_class.h new file mode 100644 index 0000000000..ac02b0d6e7 --- /dev/null +++ b/fxjs/cfxjse_class.h @@ -0,0 +1,45 @@ +// Copyright 2014 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_CFXJSE_CLASS_H_ +#define FXJS_CFXJSE_CLASS_H_ + +#include "fxjs/cfxjse_arguments.h" +#include "fxjs/fxjse.h" +#include "v8/include/v8.h" + +class CFXJSE_Context; +class CFXJSE_Value; + +class CFXJSE_Class { + public: + static CFXJSE_Class* Create(CFXJSE_Context* pContext, + const FXJSE_CLASS_DESCRIPTOR* lpClassDefintion, + FX_BOOL bIsJSGlobal = FALSE); + static CFXJSE_Class* GetClassFromContext(CFXJSE_Context* pContext, + const CFX_ByteStringC& szName); + static void SetUpNamedPropHandler( + v8::Isolate* pIsolate, + v8::Local& hObjectTemplate, + const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition); + + ~CFXJSE_Class(); + + CFXJSE_Context* GetContext() { return m_pContext; } + v8::Global& GetTemplate() { return m_hTemplate; } + + protected: + explicit CFXJSE_Class(CFXJSE_Context* lpContext); + + CFX_ByteString m_szClassName; + const FXJSE_CLASS_DESCRIPTOR* m_lpClassDefinition; + CFXJSE_Context* m_pContext; + v8::Global m_hTemplate; + friend class CFXJSE_Context; + friend class CFXJSE_Value; +}; + +#endif // FXJS_CFXJSE_CLASS_H_ diff --git a/fxjs/cfxjse_context.cpp b/fxjs/cfxjse_context.cpp index 4b0d0f67f7..93efc4f12c 100644 --- a/fxjs/cfxjse_context.cpp +++ b/fxjs/cfxjse_context.cpp @@ -4,10 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fxjs/include/cfxjse_context.h" +#include "fxjs/cfxjse_context.h" -#include "fxjs/include/cfxjse_class.h" -#include "fxjs/include/cfxjse_value.h" +#include "fxjs/cfxjse_class.h" +#include "fxjs/cfxjse_value.h" namespace { diff --git a/fxjs/cfxjse_context.h b/fxjs/cfxjse_context.h new file mode 100644 index 0000000000..73f62647cc --- /dev/null +++ b/fxjs/cfxjse_context.h @@ -0,0 +1,65 @@ +// Copyright 2016 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_CFXJSE_CONTEXT_H_ +#define FXJS_CFXJSE_CONTEXT_H_ + +#include +#include + +#include "core/fxcrt/fx_basic.h" +#include "fxjs/fxjse.h" +#include "v8/include/v8.h" + +class CFXJSE_Class; +class CFXJSE_Value; +struct FXJSE_CLASS_DESCRIPTOR; + +class CFXJSE_Context { + public: + static CFXJSE_Context* Create( + v8::Isolate* pIsolate, + const FXJSE_CLASS_DESCRIPTOR* lpGlobalClass = nullptr, + CFXJSE_HostObject* lpGlobalObject = nullptr); + + ~CFXJSE_Context(); + + v8::Isolate* GetRuntime() { return m_pIsolate; } + std::unique_ptr GetGlobalObject(); + void EnableCompatibleMode(); + FX_BOOL ExecuteScript(const FX_CHAR* szScript, + CFXJSE_Value* lpRetValue, + CFXJSE_Value* lpNewThisObject = nullptr); + + protected: + friend class CFXJSE_Class; + friend class CFXJSE_ScopeUtil_IsolateHandleContext; + + CFXJSE_Context(); + CFXJSE_Context(const CFXJSE_Context&); + explicit CFXJSE_Context(v8::Isolate* pIsolate); + + CFXJSE_Context& operator=(const CFXJSE_Context&); + + v8::Global m_hContext; + v8::Isolate* m_pIsolate; + std::vector> m_rgClasses; +}; + +v8::Local FXJSE_CreateReturnValue(v8::Isolate* pIsolate, + v8::TryCatch& trycatch); + +v8::Local FXJSE_GetGlobalObjectFromContext( + const v8::Local& hContext); + +void FXJSE_UpdateObjectBinding(v8::Local& hObject, + CFXJSE_HostObject* lpNewBinding = nullptr); + +CFXJSE_HostObject* FXJSE_RetrieveObjectBinding( + const v8::Local& hJSObject, + CFXJSE_Class* lpClass = nullptr); + +#endif // FXJS_CFXJSE_CONTEXT_H_ diff --git a/fxjs/cfxjse_runtimedata.cpp b/fxjs/cfxjse_runtimedata.cpp index 021fb1dbe4..017916a248 100644 --- a/fxjs/cfxjse_runtimedata.cpp +++ b/fxjs/cfxjse_runtimedata.cpp @@ -7,7 +7,7 @@ #include "fxjs/cfxjse_runtimedata.h" #include "fxjs/cfxjse_isolatetracker.h" -#include "fxjs/include/fxjs_v8.h" +#include "fxjs/fxjs_v8.h" namespace { diff --git a/fxjs/cfxjse_value.cpp b/fxjs/cfxjse_value.cpp index b1fc0784e8..d0a428c9c3 100644 --- a/fxjs/cfxjse_value.cpp +++ b/fxjs/cfxjse_value.cpp @@ -4,12 +4,12 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fxjs/include/cfxjse_value.h" +#include "fxjs/cfxjse_value.h" #include -#include "fxjs/include/cfxjse_class.h" -#include "fxjs/include/cfxjse_context.h" +#include "fxjs/cfxjse_class.h" +#include "fxjs/cfxjse_context.h" namespace { diff --git a/fxjs/cfxjse_value.h b/fxjs/cfxjse_value.h new file mode 100644 index 0000000000..91819d81e4 --- /dev/null +++ b/fxjs/cfxjse_value.h @@ -0,0 +1,101 @@ +// Copyright 2014 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_CFXJSE_VALUE_H_ +#define FXJS_CFXJSE_VALUE_H_ + +#include "core/fxcrt/fx_string.h" +#include "core/fxcrt/fx_system.h" +#include "fxjs/cfxjse_isolatetracker.h" +#include "fxjs/cfxjse_runtimedata.h" +#include "v8/include/v8.h" + +class CFXJSE_Class; +class CFXJSE_HostObject; + +class CFXJSE_Value { + public: + explicit CFXJSE_Value(v8::Isolate* pIsolate); + ~CFXJSE_Value(); + + FX_BOOL IsUndefined() const; + FX_BOOL IsNull() const; + FX_BOOL IsBoolean() const; + FX_BOOL IsString() const; + FX_BOOL IsNumber() const; + FX_BOOL IsInteger() const; + FX_BOOL IsObject() const; + FX_BOOL IsArray() const; + FX_BOOL IsFunction() const; + FX_BOOL IsDate() const; + FX_BOOL ToBoolean() const; + FX_FLOAT ToFloat() const; + double ToDouble() const; + int32_t ToInteger() const; + CFX_ByteString ToString() const; + CFX_WideString ToWideString() const { + return CFX_WideString::FromUTF8(ToString().AsStringC()); + } + CFXJSE_HostObject* ToHostObject(CFXJSE_Class* lpClass) const; + + void SetUndefined(); + void SetNull(); + void SetBoolean(FX_BOOL bBoolean); + void SetInteger(int32_t nInteger); + void SetDouble(double dDouble); + void SetString(const CFX_ByteStringC& szString); + void SetFloat(FX_FLOAT fFloat); + void SetJSObject(); + + void SetObject(CFXJSE_HostObject* lpObject, CFXJSE_Class* pClass); + void SetHostObject(CFXJSE_HostObject* lpObject, CFXJSE_Class* lpClass); + void SetArray(uint32_t uValueCount, CFXJSE_Value** rgValues); + void SetDate(double dDouble); + + FX_BOOL GetObjectProperty(const CFX_ByteStringC& szPropName, + CFXJSE_Value* lpPropValue); + FX_BOOL SetObjectProperty(const CFX_ByteStringC& szPropName, + CFXJSE_Value* lpPropValue); + FX_BOOL GetObjectPropertyByIdx(uint32_t uPropIdx, CFXJSE_Value* lpPropValue); + FX_BOOL SetObjectProperty(uint32_t uPropIdx, CFXJSE_Value* lpPropValue); + FX_BOOL DeleteObjectProperty(const CFX_ByteStringC& szPropName); + FX_BOOL HasObjectOwnProperty(const CFX_ByteStringC& szPropName, + FX_BOOL bUseTypeGetter); + FX_BOOL SetObjectOwnProperty(const CFX_ByteStringC& szPropName, + CFXJSE_Value* lpPropValue); + FX_BOOL SetFunctionBind(CFXJSE_Value* lpOldFunction, CFXJSE_Value* lpNewThis); + FX_BOOL Call(CFXJSE_Value* lpReceiver, + CFXJSE_Value* lpRetValue, + uint32_t nArgCount, + CFXJSE_Value** lpArgs); + + v8::Isolate* GetIsolate() const { return m_pIsolate; } + const v8::Global& DirectGetValue() const { return m_hValue; } + void ForceSetValue(v8::Local hValue) { + m_hValue.Reset(m_pIsolate, hValue); + } + void Assign(const CFXJSE_Value* lpValue) { + ASSERT(lpValue); + if (lpValue) { + m_hValue.Reset(m_pIsolate, lpValue->m_hValue); + } else { + m_hValue.Reset(); + } + } + + private: + friend class CFXJSE_Class; + friend class CFXJSE_Context; + + CFXJSE_Value(); + CFXJSE_Value(const CFXJSE_Value&); + CFXJSE_Value& operator=(const CFXJSE_Value&); + + v8::Isolate* m_pIsolate; + v8::Global m_hValue; +}; + +#endif // FXJS_CFXJSE_VALUE_H_ diff --git a/fxjs/fxjs_v8.cpp b/fxjs/fxjs_v8.cpp index e967feef75..d74d355dc9 100644 --- a/fxjs/fxjs_v8.cpp +++ b/fxjs/fxjs_v8.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fxjs/include/fxjs_v8.h" +#include "fxjs/fxjs_v8.h" #include diff --git a/fxjs/fxjs_v8.h b/fxjs/fxjs_v8.h new file mode 100644 index 0000000000..5f658989a5 --- /dev/null +++ b/fxjs/fxjs_v8.h @@ -0,0 +1,262 @@ +// Copyright 2014 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 + +// FXJS_V8 is a layer that makes it easier to define native objects in V8, but +// has no knowledge of PDF-specific native objects. It could in theory be used +// to implement other sets of native objects. + +// PDFium code should include this file rather than including V8 headers +// directly. + +#ifndef FXJS_FXJS_V8_H_ +#define FXJS_FXJS_V8_H_ + +#include +#include + +#include +#include +#include + +#include "core/fxcrt/fx_string.h" +#ifdef PDF_ENABLE_XFA +// Header for CFXJSE_RuntimeData. FXJS_V8 doesn't interpret this class, +// it is just passed along to XFA. +#include "fxjs/cfxjse_runtimedata.h" +#endif // PDF_ENABLE_XFA + +class CFXJS_Engine; +class CFXJS_ObjDefinition; + +// FXJS_V8 places no restrictions on this class; it merely passes it +// on to caller-provided methods. +class IJS_Context; // A description of the event that caused JS execution. + +enum FXJSOBJTYPE { + FXJSOBJTYPE_DYNAMIC = 0, // Created by native method and returned to JS. + FXJSOBJTYPE_STATIC, // Created by init and hung off of global object. + FXJSOBJTYPE_GLOBAL, // The global object itself (may only appear once). +}; + +struct FXJSErr { + const wchar_t* message; + const wchar_t* srcline; + unsigned linnum; +}; + +// Global weak map to save dynamic objects. +class V8TemplateMapTraits : public v8::StdMapTraits { + public: + typedef v8::GlobalValueMap MapType; + typedef void WeakCallbackDataType; + + static WeakCallbackDataType* WeakCallbackParameter( + MapType* map, + void* key, + const v8::Local& value) { + return key; + } + static MapType* MapFromWeakCallbackInfo( + const v8::WeakCallbackInfo&); + + static void* KeyFromWeakCallbackInfo( + const v8::WeakCallbackInfo& data) { + return data.GetParameter(); + } + static const v8::PersistentContainerCallbackType kCallbackType = + v8::kWeakWithInternalFields; + static void DisposeWeak( + const v8::WeakCallbackInfo& data) {} + static void OnWeakCallback( + const v8::WeakCallbackInfo& data) {} + static void Dispose(v8::Isolate* isolate, + v8::Global value, + void* key); + static void DisposeCallbackData(WeakCallbackDataType* callbackData) {} +}; + +class V8TemplateMap { + public: + typedef v8::GlobalValueMap MapType; + + explicit V8TemplateMap(v8::Isolate* isolate); + ~V8TemplateMap(); + + void set(void* key, v8::Local handle); + + friend class V8TemplateMapTraits; + + private: + MapType m_map; +}; + +class FXJS_PerIsolateData { + public: + ~FXJS_PerIsolateData(); + + static void SetUp(v8::Isolate* pIsolate); + static FXJS_PerIsolateData* Get(v8::Isolate* pIsolate); + + std::vector> m_ObjectDefnArray; +#ifdef PDF_ENABLE_XFA + std::unique_ptr m_pFXJSERuntimeData; +#endif // PDF_ENABLE_XFA + std::unique_ptr m_pDynamicObjsMap; + + protected: + explicit FXJS_PerIsolateData(v8::Isolate* pIsolate); +}; + +class FXJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { + void* Allocate(size_t length) override; + void* AllocateUninitialized(size_t length) override; + void Free(void* data, size_t length) override; +}; + +void FXJS_Initialize(unsigned int embedderDataSlot, v8::Isolate* pIsolate); +void FXJS_Release(); + +// Gets the global isolate set by FXJS_Initialize(), or makes a new one each +// time if there is no such isolate. Returns true if a new isolate had to be +// created. +bool FXJS_GetIsolate(v8::Isolate** pResultIsolate); + +// Get the global isolate's ref count. +size_t FXJS_GlobalIsolateRefCount(); + +class CFXJS_Engine { + public: + explicit CFXJS_Engine(v8::Isolate* pIsolate); + ~CFXJS_Engine(); + + using Constructor = void (*)(CFXJS_Engine* pEngine, + v8::Local obj); + using Destructor = void (*)(CFXJS_Engine* pEngine, v8::Local obj); + + static CFXJS_Engine* CurrentEngineFromIsolate(v8::Isolate* pIsolate); + static int GetObjDefnID(v8::Local pObj); + +#ifdef PDF_ENABLE_XFA + // Called as part of FXJS_InitializeEngine, exposed so PDF can make its + // own contexts compatible with XFA or vice versa. + static void SetForV8Context(v8::Local v8Context, + CFXJS_Engine* pEngine); +#endif // PDF_ENABLE_XFA + + v8::Isolate* GetIsolate() const { return m_isolate; } + + // Always returns a valid, newly-created objDefnID. + int DefineObj(const wchar_t* sObjName, + FXJSOBJTYPE eObjType, + Constructor pConstructor, + Destructor pDestructor); + + void DefineObjMethod(int nObjDefnID, + const wchar_t* sMethodName, + v8::FunctionCallback pMethodCall); + void DefineObjProperty(int nObjDefnID, + const wchar_t* sPropName, + v8::AccessorGetterCallback pPropGet, + v8::AccessorSetterCallback pPropPut); + void DefineObjAllProperties(int nObjDefnID, + v8::NamedPropertyQueryCallback pPropQurey, + v8::NamedPropertyGetterCallback pPropGet, + v8::NamedPropertySetterCallback pPropPut, + v8::NamedPropertyDeleterCallback pPropDel); + void DefineObjConst(int nObjDefnID, + const wchar_t* sConstName, + v8::Local pDefault); + void DefineGlobalMethod(const wchar_t* sMethodName, + v8::FunctionCallback pMethodCall); + void DefineGlobalConst(const wchar_t* sConstName, + v8::FunctionCallback pConstGetter); + + // Called after FXJS_Define* calls made. + void InitializeEngine(); + void ReleaseEngine(); + + // Called after FXJS_InitializeEngine call made. + int Execute(const CFX_WideString& script, FXJSErr* perror); + + v8::Local NewLocalContext(); + v8::Local GetPersistentContext(); + + v8::Local NewNull(); + v8::Local NewArray(); + v8::Local NewNumber(int number); + v8::Local NewNumber(double number); + v8::Local NewNumber(float number); + v8::Local NewBoolean(bool b); + v8::Local NewString(const wchar_t* str); + v8::Local NewDate(double d); + v8::Local NewFxDynamicObj(int nObjDefnID, bool bStatic = false); + + v8::Local GetThisObj(); + int ToInt32(v8::Local pValue); + bool ToBoolean(v8::Local pValue); + double ToNumber(v8::Local pValue); + CFX_WideString ToString(v8::Local pValue); + v8::Local ToObject(v8::Local pValue); + v8::Local ToArray(v8::Local pValue); + + unsigned GetArrayLength(v8::Local pArray); + v8::Local GetArrayElement(v8::Local pArray, + unsigned index); + unsigned PutArrayElement(v8::Local pArray, + unsigned index, + v8::Local pValue); + + std::vector GetObjectPropertyNames( + v8::Local pObj); + v8::Local GetObjectProperty(v8::Local pObj, + const CFX_WideString& PropertyName); + + void PutObjectString(v8::Local pObj, + const CFX_WideString& wsPropertyName, + const CFX_WideString& wsValue); + void PutObjectNumber(v8::Local pObj, + const CFX_WideString& PropertyName, + int nValue); + void PutObjectNumber(v8::Local pObj, + const CFX_WideString& PropertyName, + float fValue); + void PutObjectNumber(v8::Local pObj, + const CFX_WideString& PropertyName, + double dValue); + void PutObjectBoolean(v8::Local pObj, + const CFX_WideString& PropertyName, + bool bValue); + void PutObjectObject(v8::Local pObj, + const CFX_WideString& PropertyName, + v8::Local pPut); + void PutObjectNull(v8::Local pObj, + const CFX_WideString& PropertyName); + + // Native object binding. + void SetObjectPrivate(v8::Local pObj, void* p); + void* GetObjectPrivate(v8::Local pObj); + static void FreeObjectPrivate(void* p); + static void FreeObjectPrivate(v8::Local pObj); + + void SetConstArray(const CFX_WideString& name, v8::Local array); + v8::Local GetConstArray(const CFX_WideString& name); + + v8::Local WSToJSString(const CFX_WideString& wsPropertyName); + void Error(const CFX_WideString& message); + + protected: + CFXJS_Engine(); + + void SetIsolate(v8::Isolate* pIsolate) { m_isolate = pIsolate; } + + private: + v8::Isolate* m_isolate; + v8::Global m_V8PersistentContext; + std::vector*> m_StaticObjects; + std::map> m_ConstArrays; +}; + +#endif // FXJS_FXJS_V8_H_ diff --git a/fxjs/fxjse.h b/fxjs/fxjse.h new file mode 100644 index 0000000000..0ba285d746 --- /dev/null +++ b/fxjs/fxjse.h @@ -0,0 +1,74 @@ +// Copyright 2014 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_FXJSE_H_ +#define FXJS_FXJSE_H_ + +#include "core/fxcrt/fx_string.h" +#include "core/fxcrt/fx_system.h" +#include "v8/include/v8.h" + +class CFXJSE_Arguments; +class CFXJSE_Value; + +// C++ object which can be wrapped by CFXJSE_value. +class CFXJSE_HostObject { + public: + virtual ~CFXJSE_HostObject() {} +}; + +typedef void (*FXJSE_FuncCallback)(CFXJSE_Value* pThis, + const CFX_ByteStringC& szFuncName, + CFXJSE_Arguments& args); +typedef void (*FXJSE_PropAccessor)(CFXJSE_Value* pObject, + const CFX_ByteStringC& szPropName, + CFXJSE_Value* pValue); +typedef int32_t (*FXJSE_PropTypeGetter)(CFXJSE_Value* pObject, + const CFX_ByteStringC& szPropName, + FX_BOOL bQueryIn); +typedef FX_BOOL (*FXJSE_PropDeleter)(CFXJSE_Value* pObject, + const CFX_ByteStringC& szPropName); + +enum FXJSE_ClassPropTypes { + FXJSE_ClassPropType_None, + FXJSE_ClassPropType_Property, + FXJSE_ClassPropType_Method +}; + +struct FXJSE_FUNCTION_DESCRIPTOR { + const FX_CHAR* name; + FXJSE_FuncCallback callbackProc; +}; + +struct FXJSE_PROPERTY_DESCRIPTOR { + const FX_CHAR* name; + FXJSE_PropAccessor getProc; + FXJSE_PropAccessor setProc; +}; + +struct FXJSE_CLASS_DESCRIPTOR { + const FX_CHAR* name; + FXJSE_FuncCallback constructor; + const FXJSE_PROPERTY_DESCRIPTOR* properties; + const FXJSE_FUNCTION_DESCRIPTOR* methods; + int32_t propNum; + int32_t methNum; + FXJSE_PropTypeGetter dynPropTypeGetter; + FXJSE_PropAccessor dynPropGetter; + FXJSE_PropAccessor dynPropSetter; + FXJSE_PropDeleter dynPropDeleter; + FXJSE_FuncCallback dynMethodCall; +}; + +void FXJSE_Initialize(); +void FXJSE_Finalize(); + +v8::Isolate* FXJSE_Runtime_Create_Own(); +void FXJSE_Runtime_Release(v8::Isolate* pIsolate); + +void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Message); + +#endif // FXJS_FXJSE_H_ diff --git a/fxjs/include/cfxjse_arguments.h b/fxjs/include/cfxjse_arguments.h deleted file mode 100644 index e6c8659732..0000000000 --- a/fxjs/include/cfxjse_arguments.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2016 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_INCLUDE_CFXJSE_ARGUMENTS_H_ -#define FXJS_INCLUDE_CFXJSE_ARGUMENTS_H_ - -#include - -#include "fxjs/include/fxjse.h" - -class CFXJSE_Class; - -class CFXJSE_Arguments { - public: - CFXJSE_Arguments(const v8::FunctionCallbackInfo* pInfo, - CFXJSE_Value* pRetValue) - : m_pInfo(pInfo), m_pRetValue(pRetValue) {} - - v8::Isolate* GetRuntime() const; - int32_t GetLength() const; - std::unique_ptr GetValue(int32_t index) const; - FX_BOOL GetBoolean(int32_t index) const; - int32_t GetInt32(int32_t index) const; - FX_FLOAT GetFloat(int32_t index) const; - CFX_ByteString GetUTF8String(int32_t index) const; - CFXJSE_HostObject* GetObject(int32_t index, - CFXJSE_Class* pClass = nullptr) const; - CFXJSE_Value* GetReturnValue(); - - private: - const v8::FunctionCallbackInfo* m_pInfo; - CFXJSE_Value* m_pRetValue; -}; - -#endif // FXJS_INCLUDE_CFXJSE_ARGUMENTS_H_ diff --git a/fxjs/include/cfxjse_class.h b/fxjs/include/cfxjse_class.h deleted file mode 100644 index 13eb1adb7d..0000000000 --- a/fxjs/include/cfxjse_class.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2014 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_INCLUDE_CFXJSE_CLASS_H_ -#define FXJS_INCLUDE_CFXJSE_CLASS_H_ - -#include "fxjs/include/cfxjse_arguments.h" -#include "fxjs/include/fxjse.h" -#include "v8/include/v8.h" - -class CFXJSE_Context; -class CFXJSE_Value; - -class CFXJSE_Class { - public: - static CFXJSE_Class* Create(CFXJSE_Context* pContext, - const FXJSE_CLASS_DESCRIPTOR* lpClassDefintion, - FX_BOOL bIsJSGlobal = FALSE); - static CFXJSE_Class* GetClassFromContext(CFXJSE_Context* pContext, - const CFX_ByteStringC& szName); - static void SetUpNamedPropHandler( - v8::Isolate* pIsolate, - v8::Local& hObjectTemplate, - const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition); - - ~CFXJSE_Class(); - - CFXJSE_Context* GetContext() { return m_pContext; } - v8::Global& GetTemplate() { return m_hTemplate; } - - protected: - explicit CFXJSE_Class(CFXJSE_Context* lpContext); - - CFX_ByteString m_szClassName; - const FXJSE_CLASS_DESCRIPTOR* m_lpClassDefinition; - CFXJSE_Context* m_pContext; - v8::Global m_hTemplate; - friend class CFXJSE_Context; - friend class CFXJSE_Value; -}; - -#endif // FXJS_INCLUDE_CFXJSE_CLASS_H_ diff --git a/fxjs/include/cfxjse_context.h b/fxjs/include/cfxjse_context.h deleted file mode 100644 index 669fa89517..0000000000 --- a/fxjs/include/cfxjse_context.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2016 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_INCLUDE_CFXJSE_CONTEXT_H_ -#define FXJS_INCLUDE_CFXJSE_CONTEXT_H_ - -#include -#include - -#include "core/fxcrt/fx_basic.h" -#include "fxjs/include/fxjse.h" -#include "v8/include/v8.h" - -class CFXJSE_Class; -class CFXJSE_Value; -struct FXJSE_CLASS_DESCRIPTOR; - -class CFXJSE_Context { - public: - static CFXJSE_Context* Create( - v8::Isolate* pIsolate, - const FXJSE_CLASS_DESCRIPTOR* lpGlobalClass = nullptr, - CFXJSE_HostObject* lpGlobalObject = nullptr); - - ~CFXJSE_Context(); - - v8::Isolate* GetRuntime() { return m_pIsolate; } - std::unique_ptr GetGlobalObject(); - void EnableCompatibleMode(); - FX_BOOL ExecuteScript(const FX_CHAR* szScript, - CFXJSE_Value* lpRetValue, - CFXJSE_Value* lpNewThisObject = nullptr); - - protected: - friend class CFXJSE_Class; - friend class CFXJSE_ScopeUtil_IsolateHandleContext; - - CFXJSE_Context(); - CFXJSE_Context(const CFXJSE_Context&); - explicit CFXJSE_Context(v8::Isolate* pIsolate); - - CFXJSE_Context& operator=(const CFXJSE_Context&); - - v8::Global m_hContext; - v8::Isolate* m_pIsolate; - std::vector> m_rgClasses; -}; - -v8::Local FXJSE_CreateReturnValue(v8::Isolate* pIsolate, - v8::TryCatch& trycatch); - -v8::Local FXJSE_GetGlobalObjectFromContext( - const v8::Local& hContext); - -void FXJSE_UpdateObjectBinding(v8::Local& hObject, - CFXJSE_HostObject* lpNewBinding = nullptr); - -CFXJSE_HostObject* FXJSE_RetrieveObjectBinding( - const v8::Local& hJSObject, - CFXJSE_Class* lpClass = nullptr); - -#endif // FXJS_INCLUDE_CFXJSE_CONTEXT_H_ diff --git a/fxjs/include/cfxjse_value.h b/fxjs/include/cfxjse_value.h deleted file mode 100644 index 9fd1bee786..0000000000 --- a/fxjs/include/cfxjse_value.h +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2014 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_INCLUDE_CFXJSE_VALUE_H_ -#define FXJS_INCLUDE_CFXJSE_VALUE_H_ - -#include "v8/include/v8.h" - -#include "core/fxcrt/fx_string.h" -#include "core/fxcrt/fx_system.h" -#include "fxjs/cfxjse_isolatetracker.h" -#include "fxjs/cfxjse_runtimedata.h" - -class CFXJSE_Class; -class CFXJSE_HostObject; - -class CFXJSE_Value { - public: - explicit CFXJSE_Value(v8::Isolate* pIsolate); - ~CFXJSE_Value(); - - FX_BOOL IsUndefined() const; - FX_BOOL IsNull() const; - FX_BOOL IsBoolean() const; - FX_BOOL IsString() const; - FX_BOOL IsNumber() const; - FX_BOOL IsInteger() const; - FX_BOOL IsObject() const; - FX_BOOL IsArray() const; - FX_BOOL IsFunction() const; - FX_BOOL IsDate() const; - FX_BOOL ToBoolean() const; - FX_FLOAT ToFloat() const; - double ToDouble() const; - int32_t ToInteger() const; - CFX_ByteString ToString() const; - CFX_WideString ToWideString() const { - return CFX_WideString::FromUTF8(ToString().AsStringC()); - } - CFXJSE_HostObject* ToHostObject(CFXJSE_Class* lpClass) const; - - void SetUndefined(); - void SetNull(); - void SetBoolean(FX_BOOL bBoolean); - void SetInteger(int32_t nInteger); - void SetDouble(double dDouble); - void SetString(const CFX_ByteStringC& szString); - void SetFloat(FX_FLOAT fFloat); - void SetJSObject(); - - void SetObject(CFXJSE_HostObject* lpObject, CFXJSE_Class* pClass); - void SetHostObject(CFXJSE_HostObject* lpObject, CFXJSE_Class* lpClass); - void SetArray(uint32_t uValueCount, CFXJSE_Value** rgValues); - void SetDate(double dDouble); - - FX_BOOL GetObjectProperty(const CFX_ByteStringC& szPropName, - CFXJSE_Value* lpPropValue); - FX_BOOL SetObjectProperty(const CFX_ByteStringC& szPropName, - CFXJSE_Value* lpPropValue); - FX_BOOL GetObjectPropertyByIdx(uint32_t uPropIdx, CFXJSE_Value* lpPropValue); - FX_BOOL SetObjectProperty(uint32_t uPropIdx, CFXJSE_Value* lpPropValue); - FX_BOOL DeleteObjectProperty(const CFX_ByteStringC& szPropName); - FX_BOOL HasObjectOwnProperty(const CFX_ByteStringC& szPropName, - FX_BOOL bUseTypeGetter); - FX_BOOL SetObjectOwnProperty(const CFX_ByteStringC& szPropName, - CFXJSE_Value* lpPropValue); - FX_BOOL SetFunctionBind(CFXJSE_Value* lpOldFunction, CFXJSE_Value* lpNewThis); - FX_BOOL Call(CFXJSE_Value* lpReceiver, - CFXJSE_Value* lpRetValue, - uint32_t nArgCount, - CFXJSE_Value** lpArgs); - - v8::Isolate* GetIsolate() const { return m_pIsolate; } - const v8::Global& DirectGetValue() const { return m_hValue; } - void ForceSetValue(v8::Local hValue) { - m_hValue.Reset(m_pIsolate, hValue); - } - void Assign(const CFXJSE_Value* lpValue) { - ASSERT(lpValue); - if (lpValue) { - m_hValue.Reset(m_pIsolate, lpValue->m_hValue); - } else { - m_hValue.Reset(); - } - } - - private: - friend class CFXJSE_Class; - friend class CFXJSE_Context; - - CFXJSE_Value(); - CFXJSE_Value(const CFXJSE_Value&); - CFXJSE_Value& operator=(const CFXJSE_Value&); - - v8::Isolate* m_pIsolate; - v8::Global m_hValue; -}; - -#endif // FXJS_INCLUDE_CFXJSE_VALUE_H_ diff --git a/fxjs/include/fxjs_v8.h b/fxjs/include/fxjs_v8.h deleted file mode 100644 index a9064f3faf..0000000000 --- a/fxjs/include/fxjs_v8.h +++ /dev/null @@ -1,262 +0,0 @@ -// Copyright 2014 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 - -// FXJS_V8 is a layer that makes it easier to define native objects in V8, but -// has no knowledge of PDF-specific native objects. It could in theory be used -// to implement other sets of native objects. - -// PDFium code should include this file rather than including V8 headers -// directly. - -#ifndef FXJS_INCLUDE_FXJS_V8_H_ -#define FXJS_INCLUDE_FXJS_V8_H_ - -#include -#include - -#include -#include -#include - -#include "core/fxcrt/fx_string.h" -#ifdef PDF_ENABLE_XFA -// Header for CFXJSE_RuntimeData. FXJS_V8 doesn't interpret this class, -// it is just passed along to XFA. -#include "fxjs/cfxjse_runtimedata.h" -#endif // PDF_ENABLE_XFA - -class CFXJS_Engine; -class CFXJS_ObjDefinition; - -// FXJS_V8 places no restrictions on this class; it merely passes it -// on to caller-provided methods. -class IJS_Context; // A description of the event that caused JS execution. - -enum FXJSOBJTYPE { - FXJSOBJTYPE_DYNAMIC = 0, // Created by native method and returned to JS. - FXJSOBJTYPE_STATIC, // Created by init and hung off of global object. - FXJSOBJTYPE_GLOBAL, // The global object itself (may only appear once). -}; - -struct FXJSErr { - const wchar_t* message; - const wchar_t* srcline; - unsigned linnum; -}; - -// Global weak map to save dynamic objects. -class V8TemplateMapTraits : public v8::StdMapTraits { - public: - typedef v8::GlobalValueMap MapType; - typedef void WeakCallbackDataType; - - static WeakCallbackDataType* WeakCallbackParameter( - MapType* map, - void* key, - const v8::Local& value) { - return key; - } - static MapType* MapFromWeakCallbackInfo( - const v8::WeakCallbackInfo&); - - static void* KeyFromWeakCallbackInfo( - const v8::WeakCallbackInfo& data) { - return data.GetParameter(); - } - static const v8::PersistentContainerCallbackType kCallbackType = - v8::kWeakWithInternalFields; - static void DisposeWeak( - const v8::WeakCallbackInfo& data) {} - static void OnWeakCallback( - const v8::WeakCallbackInfo& data) {} - static void Dispose(v8::Isolate* isolate, - v8::Global value, - void* key); - static void DisposeCallbackData(WeakCallbackDataType* callbackData) {} -}; - -class V8TemplateMap { - public: - typedef v8::GlobalValueMap MapType; - - explicit V8TemplateMap(v8::Isolate* isolate); - ~V8TemplateMap(); - - void set(void* key, v8::Local handle); - - friend class V8TemplateMapTraits; - - private: - MapType m_map; -}; - -class FXJS_PerIsolateData { - public: - ~FXJS_PerIsolateData(); - - static void SetUp(v8::Isolate* pIsolate); - static FXJS_PerIsolateData* Get(v8::Isolate* pIsolate); - - std::vector> m_ObjectDefnArray; -#ifdef PDF_ENABLE_XFA - std::unique_ptr m_pFXJSERuntimeData; -#endif // PDF_ENABLE_XFA - std::unique_ptr m_pDynamicObjsMap; - - protected: - explicit FXJS_PerIsolateData(v8::Isolate* pIsolate); -}; - -class FXJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { - void* Allocate(size_t length) override; - void* AllocateUninitialized(size_t length) override; - void Free(void* data, size_t length) override; -}; - -void FXJS_Initialize(unsigned int embedderDataSlot, v8::Isolate* pIsolate); -void FXJS_Release(); - -// Gets the global isolate set by FXJS_Initialize(), or makes a new one each -// time if there is no such isolate. Returns true if a new isolate had to be -// created. -bool FXJS_GetIsolate(v8::Isolate** pResultIsolate); - -// Get the global isolate's ref count. -size_t FXJS_GlobalIsolateRefCount(); - -class CFXJS_Engine { - public: - explicit CFXJS_Engine(v8::Isolate* pIsolate); - ~CFXJS_Engine(); - - using Constructor = void (*)(CFXJS_Engine* pEngine, - v8::Local obj); - using Destructor = void (*)(CFXJS_Engine* pEngine, v8::Local obj); - - static CFXJS_Engine* CurrentEngineFromIsolate(v8::Isolate* pIsolate); - static int GetObjDefnID(v8::Local pObj); - -#ifdef PDF_ENABLE_XFA - // Called as part of FXJS_InitializeEngine, exposed so PDF can make its - // own contexts compatible with XFA or vice versa. - static void SetForV8Context(v8::Local v8Context, - CFXJS_Engine* pEngine); -#endif // PDF_ENABLE_XFA - - v8::Isolate* GetIsolate() const { return m_isolate; } - - // Always returns a valid, newly-created objDefnID. - int DefineObj(const wchar_t* sObjName, - FXJSOBJTYPE eObjType, - Constructor pConstructor, - Destructor pDestructor); - - void DefineObjMethod(int nObjDefnID, - const wchar_t* sMethodName, - v8::FunctionCallback pMethodCall); - void DefineObjProperty(int nObjDefnID, - const wchar_t* sPropName, - v8::AccessorGetterCallback pPropGet, - v8::AccessorSetterCallback pPropPut); - void DefineObjAllProperties(int nObjDefnID, - v8::NamedPropertyQueryCallback pPropQurey, - v8::NamedPropertyGetterCallback pPropGet, - v8::NamedPropertySetterCallback pPropPut, - v8::NamedPropertyDeleterCallback pPropDel); - void DefineObjConst(int nObjDefnID, - const wchar_t* sConstName, - v8::Local pDefault); - void DefineGlobalMethod(const wchar_t* sMethodName, - v8::FunctionCallback pMethodCall); - void DefineGlobalConst(const wchar_t* sConstName, - v8::FunctionCallback pConstGetter); - - // Called after FXJS_Define* calls made. - void InitializeEngine(); - void ReleaseEngine(); - - // Called after FXJS_InitializeEngine call made. - int Execute(const CFX_WideString& script, FXJSErr* perror); - - v8::Local NewLocalContext(); - v8::Local GetPersistentContext(); - - v8::Local NewNull(); - v8::Local NewArray(); - v8::Local NewNumber(int number); - v8::Local NewNumber(double number); - v8::Local NewNumber(float number); - v8::Local NewBoolean(bool b); - v8::Local NewString(const wchar_t* str); - v8::Local NewDate(double d); - v8::Local NewFxDynamicObj(int nObjDefnID, bool bStatic = false); - - v8::Local GetThisObj(); - int ToInt32(v8::Local pValue); - bool ToBoolean(v8::Local pValue); - double ToNumber(v8::Local pValue); - CFX_WideString ToString(v8::Local pValue); - v8::Local ToObject(v8::Local pValue); - v8::Local ToArray(v8::Local pValue); - - unsigned GetArrayLength(v8::Local pArray); - v8::Local GetArrayElement(v8::Local pArray, - unsigned index); - unsigned PutArrayElement(v8::Local pArray, - unsigned index, - v8::Local pValue); - - std::vector GetObjectPropertyNames( - v8::Local pObj); - v8::Local GetObjectProperty(v8::Local pObj, - const CFX_WideString& PropertyName); - - void PutObjectString(v8::Local pObj, - const CFX_WideString& wsPropertyName, - const CFX_WideString& wsValue); - void PutObjectNumber(v8::Local pObj, - const CFX_WideString& PropertyName, - int nValue); - void PutObjectNumber(v8::Local pObj, - const CFX_WideString& PropertyName, - float fValue); - void PutObjectNumber(v8::Local pObj, - const CFX_WideString& PropertyName, - double dValue); - void PutObjectBoolean(v8::Local pObj, - const CFX_WideString& PropertyName, - bool bValue); - void PutObjectObject(v8::Local pObj, - const CFX_WideString& PropertyName, - v8::Local pPut); - void PutObjectNull(v8::Local pObj, - const CFX_WideString& PropertyName); - - // Native object binding. - void SetObjectPrivate(v8::Local pObj, void* p); - void* GetObjectPrivate(v8::Local pObj); - static void FreeObjectPrivate(void* p); - static void FreeObjectPrivate(v8::Local pObj); - - void SetConstArray(const CFX_WideString& name, v8::Local array); - v8::Local GetConstArray(const CFX_WideString& name); - - v8::Local WSToJSString(const CFX_WideString& wsPropertyName); - void Error(const CFX_WideString& message); - - protected: - CFXJS_Engine(); - - void SetIsolate(v8::Isolate* pIsolate) { m_isolate = pIsolate; } - - private: - v8::Isolate* m_isolate; - v8::Global m_V8PersistentContext; - std::vector*> m_StaticObjects; - std::map> m_ConstArrays; -}; - -#endif // FXJS_INCLUDE_FXJS_V8_H_ diff --git a/fxjs/include/fxjse.h b/fxjs/include/fxjse.h deleted file mode 100644 index eafae88d2d..0000000000 --- a/fxjs/include/fxjse.h +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2014 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_INCLUDE_FXJSE_H_ -#define FXJS_INCLUDE_FXJSE_H_ - -#include "core/fxcrt/fx_string.h" -#include "core/fxcrt/fx_system.h" -#include "v8/include/v8.h" - -class CFXJSE_Arguments; -class CFXJSE_Value; - -// C++ object which can be wrapped by CFXJSE_value. -class CFXJSE_HostObject { - public: - virtual ~CFXJSE_HostObject() {} -}; - -typedef void (*FXJSE_FuncCallback)(CFXJSE_Value* pThis, - const CFX_ByteStringC& szFuncName, - CFXJSE_Arguments& args); -typedef void (*FXJSE_PropAccessor)(CFXJSE_Value* pObject, - const CFX_ByteStringC& szPropName, - CFXJSE_Value* pValue); -typedef int32_t (*FXJSE_PropTypeGetter)(CFXJSE_Value* pObject, - const CFX_ByteStringC& szPropName, - FX_BOOL bQueryIn); -typedef FX_BOOL (*FXJSE_PropDeleter)(CFXJSE_Value* pObject, - const CFX_ByteStringC& szPropName); - -enum FXJSE_ClassPropTypes { - FXJSE_ClassPropType_None, - FXJSE_ClassPropType_Property, - FXJSE_ClassPropType_Method -}; - -struct FXJSE_FUNCTION_DESCRIPTOR { - const FX_CHAR* name; - FXJSE_FuncCallback callbackProc; -}; - -struct FXJSE_PROPERTY_DESCRIPTOR { - const FX_CHAR* name; - FXJSE_PropAccessor getProc; - FXJSE_PropAccessor setProc; -}; - -struct FXJSE_CLASS_DESCRIPTOR { - const FX_CHAR* name; - FXJSE_FuncCallback constructor; - const FXJSE_PROPERTY_DESCRIPTOR* properties; - const FXJSE_FUNCTION_DESCRIPTOR* methods; - int32_t propNum; - int32_t methNum; - FXJSE_PropTypeGetter dynPropTypeGetter; - FXJSE_PropAccessor dynPropGetter; - FXJSE_PropAccessor dynPropSetter; - FXJSE_PropDeleter dynPropDeleter; - FXJSE_FuncCallback dynMethodCall; -}; - -void FXJSE_Initialize(); -void FXJSE_Finalize(); - -v8::Isolate* FXJSE_Runtime_Create_Own(); -void FXJSE_Runtime_Release(v8::Isolate* pIsolate); - -void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Message); - -#endif // FXJS_INCLUDE_FXJSE_H_ diff --git a/testing/DEPS b/testing/DEPS index 32b3100b72..4110b9b4d7 100644 --- a/testing/DEPS +++ b/testing/DEPS @@ -2,9 +2,9 @@ include_rules = [ '+core/fpdfapi', '+core/fxcodec', '+core/fxcrt', - '+core/fxge/include', - '+core/include', - '+fxjs/include', + '+core/fxge', + '+core', + '+fxjs', '+public', '+v8', '+xfa/fde', diff --git a/testing/js_embedder_test.h b/testing/js_embedder_test.h index f0beb1eb29..fbec0ea5c9 100644 --- a/testing/js_embedder_test.h +++ b/testing/js_embedder_test.h @@ -8,7 +8,7 @@ #include #include -#include "fxjs/include/fxjs_v8.h" +#include "fxjs/fxjs_v8.h" #include "testing/embedder_test.h" class JSEmbedderTest : public EmbedderTest { diff --git a/xfa/fxfa/DEPS b/xfa/fxfa/DEPS index 589b532e2c..886ee8e2b7 100644 --- a/xfa/fxfa/DEPS +++ b/xfa/fxfa/DEPS @@ -1,3 +1,3 @@ include_rules = [ - '+fxjs/include', + '+fxjs', ] diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp index 859de5ca39..2be27ca528 100644 --- a/xfa/fxfa/app/xfa_ffnotify.cpp +++ b/xfa/fxfa/app/xfa_ffnotify.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/app/xfa_ffnotify.h" -#include "fxjs/include/cfxjse_value.h" +#include "fxjs/cfxjse_value.h" #include "xfa/fxfa/app/xfa_ffbarcode.h" #include "xfa/fxfa/app/xfa_ffcheckbutton.h" #include "xfa/fxfa/app/xfa_ffchoicelist.h" diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 592074f916..47ce0968c7 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -9,7 +9,7 @@ #include #include -#include "fxjs/include/cfxjse_value.h" +#include "fxjs/cfxjse_value.h" #include "xfa/fde/tto/fde_textout.h" #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fxfa/app/xfa_ffcheckbutton.h" diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index d8d29ec2c5..59bbc89717 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -9,9 +9,9 @@ #include #include "core/fxcrt/fx_ext.h" -#include "fxjs/include/cfxjse_arguments.h" -#include "fxjs/include/cfxjse_class.h" -#include "fxjs/include/cfxjse_value.h" +#include "fxjs/cfxjse_arguments.h" +#include "fxjs/cfxjse_class.h" +#include "fxjs/cfxjse_value.h" #include "xfa/fgas/localization/fgas_locale.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/fm2js/xfa_program.h" diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.h b/xfa/fxfa/fm2js/xfa_fm2jscontext.h index 5f87b60f90..2a81c48382 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.h +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.h @@ -7,8 +7,8 @@ #ifndef XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ #define XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ -#include "fxjs/include/cfxjse_arguments.h" -#include "fxjs/include/cfxjse_context.h" +#include "fxjs/cfxjse_arguments.h" +#include "fxjs/cfxjse_context.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" class CXFA_FM2JSContext : public CFXJSE_HostObject { diff --git a/xfa/fxfa/include/fxfa_basic.h b/xfa/fxfa/include/fxfa_basic.h index c4dcfca750..e2d5330cc8 100644 --- a/xfa/fxfa/include/fxfa_basic.h +++ b/xfa/fxfa/include/fxfa_basic.h @@ -7,8 +7,8 @@ #ifndef XFA_FXFA_INCLUDE_FXFA_BASIC_H_ #define XFA_FXFA_INCLUDE_FXFA_BASIC_H_ -#include "fxjs/include/cfxjse_arguments.h" -#include "fxjs/include/fxjse.h" +#include "fxjs/cfxjse_arguments.h" +#include "fxjs/fxjse.h" class CXFA_Measurement; enum class XFA_ObjectType; diff --git a/xfa/fxfa/parser/cscript_datawindow.cpp b/xfa/fxfa/parser/cscript_datawindow.cpp index fbf9704aac..50ed398ec0 100644 --- a/xfa/fxfa/parser/cscript_datawindow.cpp +++ b/xfa/fxfa/parser/cscript_datawindow.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cscript_datawindow.h" -#include "fxjs/include/cfxjse_arguments.h" +#include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" diff --git a/xfa/fxfa/parser/cscript_datawindow.h b/xfa/fxfa/parser/cscript_datawindow.h index e1ee13ad44..b2b35e9c59 100644 --- a/xfa/fxfa/parser/cscript_datawindow.h +++ b/xfa/fxfa/parser/cscript_datawindow.h @@ -7,7 +7,7 @@ #ifndef XFA_FXFA_PARSER_CSCRIPT_DATAWINDOW_H_ #define XFA_FXFA_PARSER_CSCRIPT_DATAWINDOW_H_ -#include "fxjs/include/cfxjse_arguments.h" +#include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/parser/xfa_object.h" class CScript_DataWindow : public CXFA_Object { diff --git a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp index c961164c4d..73356af8bf 100644 --- a/xfa/fxfa/parser/cscript_eventpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_eventpseudomodel.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cscript_eventpseudomodel.h" -#include "fxjs/include/cfxjse_arguments.h" +#include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/include/cxfa_eventparam.h" #include "xfa/fxfa/include/xfa_ffwidgethandler.h" diff --git a/xfa/fxfa/parser/cscript_eventpseudomodel.h b/xfa/fxfa/parser/cscript_eventpseudomodel.h index 41307d4d39..c747ad2d19 100644 --- a/xfa/fxfa/parser/cscript_eventpseudomodel.h +++ b/xfa/fxfa/parser/cscript_eventpseudomodel.h @@ -7,7 +7,7 @@ #ifndef XFA_FXFA_PARSER_CSCRIPT_EVENTPSEUDOMODEL_H_ #define XFA_FXFA_PARSER_CSCRIPT_EVENTPSEUDOMODEL_H_ -#include "fxjs/include/cfxjse_arguments.h" +#include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/parser/xfa_object.h" enum class XFA_Event { diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp index d4fd19e8e0..1525b0629b 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cscript_hostpseudomodel.h" -#include "fxjs/include/cfxjse_arguments.h" +#include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.h b/xfa/fxfa/parser/cscript_hostpseudomodel.h index 0cfb4f8a19..c2183ac9d7 100644 --- a/xfa/fxfa/parser/cscript_hostpseudomodel.h +++ b/xfa/fxfa/parser/cscript_hostpseudomodel.h @@ -7,7 +7,7 @@ #ifndef XFA_FXFA_PARSER_CSCRIPT_HOSTPSEUDOMODEL_H_ #define XFA_FXFA_PARSER_CSCRIPT_HOSTPSEUDOMODEL_H_ -#include "fxjs/include/cfxjse_arguments.h" +#include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/xfa_object.h" diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp index 7c451a96c0..b6ee3672e6 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp @@ -8,7 +8,7 @@ #include -#include "fxjs/include/cfxjse_arguments.h" +#include "fxjs/cfxjse_arguments.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_containerlayoutitem.h" diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.h b/xfa/fxfa/parser/cscript_layoutpseudomodel.h index 793e43cfff..d7661bcda9 100644 --- a/xfa/fxfa/parser/cscript_layoutpseudomodel.h +++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.h @@ -7,7 +7,7 @@ #ifndef XFA_FXFA_PARSER_CSCRIPT_LAYOUTPSEUDOMODEL_H_ #define XFA_FXFA_PARSER_CSCRIPT_LAYOUTPSEUDOMODEL_H_ -#include "fxjs/include/cfxjse_arguments.h" +#include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/parser/xfa_object.h" enum XFA_LAYOUTMODEL_HWXY { diff --git a/xfa/fxfa/parser/cscript_logpseudomodel.cpp b/xfa/fxfa/parser/cscript_logpseudomodel.cpp index 96c61a9e0f..48ccce027f 100644 --- a/xfa/fxfa/parser/cscript_logpseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_logpseudomodel.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cscript_logpseudomodel.h" -#include "fxjs/include/cfxjse_arguments.h" +#include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/xfa_localemgr.h" #include "xfa/fxfa/parser/xfa_object.h" diff --git a/xfa/fxfa/parser/cscript_logpseudomodel.h b/xfa/fxfa/parser/cscript_logpseudomodel.h index 1da076ef3d..18f9f51ae7 100644 --- a/xfa/fxfa/parser/cscript_logpseudomodel.h +++ b/xfa/fxfa/parser/cscript_logpseudomodel.h @@ -7,7 +7,7 @@ #ifndef XFA_FXFA_PARSER_CSCRIPT_LOGPSEUDOMODEL_H_ #define XFA_FXFA_PARSER_CSCRIPT_LOGPSEUDOMODEL_H_ -#include "fxjs/include/cfxjse_arguments.h" +#include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/parser/xfa_object.h" class CScript_LogPseudoModel : public CXFA_Object { diff --git a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp index 83e84b6d79..5a484ab12c 100644 --- a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp @@ -6,7 +6,7 @@ #include "xfa/fxfa/parser/cscript_signaturepseudomodel.h" -#include "fxjs/include/cfxjse_arguments.h" +#include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_scriptcontext.h" diff --git a/xfa/fxfa/parser/cscript_signaturepseudomodel.h b/xfa/fxfa/parser/cscript_signaturepseudomodel.h index f8478c2a0f..4f9ded0663 100644 --- a/xfa/fxfa/parser/cscript_signaturepseudomodel.h +++ b/xfa/fxfa/parser/cscript_signaturepseudomodel.h @@ -7,7 +7,7 @@ #ifndef XFA_FXFA_PARSER_CSCRIPT_SIGNATUREPSEUDOMODEL_H_ #define XFA_FXFA_PARSER_CSCRIPT_SIGNATUREPSEUDOMODEL_H_ -#include "fxjs/include/cfxjse_arguments.h" +#include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/parser/xfa_object.h" class CScript_SignaturePseudoModel : public CXFA_Object { diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index dae40ac515..5152436aeb 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -10,7 +10,7 @@ #include #include "core/fxcrt/fx_ext.h" -#include "fxjs/include/cfxjse_value.h" +#include "fxjs/cfxjse_value.h" #include "third_party/base/stl_util.h" #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fgas/crt/fgas_codepage.h" diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp index 7f35c73a20..10e1b822e2 100644 --- a/xfa/fxfa/parser/cxfa_object.cpp +++ b/xfa/fxfa/parser/cxfa_object.cpp @@ -7,7 +7,7 @@ #include "xfa/fxfa/parser/xfa_object.h" #include "core/fxcrt/fx_ext.h" -#include "fxjs/include/cfxjse_value.h" +#include "fxjs/cfxjse_value.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/parser/cxfa_document.h" diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp index a1a45ab127..0a0e5bde5d 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp +++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp @@ -7,9 +7,9 @@ #include "xfa/fxfa/parser/cxfa_scriptcontext.h" #include "core/fxcrt/fx_ext.h" -#include "fxjs/include/cfxjse_arguments.h" -#include "fxjs/include/cfxjse_class.h" -#include "fxjs/include/cfxjse_value.h" +#include "fxjs/cfxjse_arguments.h" +#include "fxjs/cfxjse_class.h" +#include "fxjs/cfxjse_value.h" #include "xfa/fxfa/app/xfa_ffnotify.h" #include "xfa/fxfa/include/cxfa_eventparam.h" #include "xfa/fxfa/parser/cxfa_document.h" diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.h b/xfa/fxfa/parser/cxfa_scriptcontext.h index a6737e6125..2816d26808 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.h +++ b/xfa/fxfa/parser/cxfa_scriptcontext.h @@ -11,7 +11,7 @@ #include #include -#include "fxjs/include/cfxjse_arguments.h" +#include "fxjs/cfxjse_arguments.h" #include "xfa/fxfa/fm2js/xfa_fm2jscontext.h" #include "xfa/fxfa/include/cxfa_eventparam.h" #include "xfa/fxfa/parser/cxfa_document.h" diff --git a/xfa/fxfa/parser/cxfa_valuearray.h b/xfa/fxfa/parser/cxfa_valuearray.h index 4bc59c79d2..c1af419c10 100644 --- a/xfa/fxfa/parser/cxfa_valuearray.h +++ b/xfa/fxfa/parser/cxfa_valuearray.h @@ -7,7 +7,7 @@ #ifndef XFA_FXFA_PARSER_CXFA_VALUEARRAY_H_ #define XFA_FXFA_PARSER_CXFA_VALUEARRAY_H_ -#include "fxjs/include/cfxjse_value.h" +#include "fxjs/cfxjse_value.h" #include "xfa/fxfa/include/fxfa.h" class CXFA_ValueArray : public CFX_ArrayTemplate { diff --git a/xfa/fxfa/parser/xfa_object.h b/xfa/fxfa/parser/xfa_object.h index 08eedeeab5..5056f59d9c 100644 --- a/xfa/fxfa/parser/xfa_object.h +++ b/xfa/fxfa/parser/xfa_object.h @@ -9,7 +9,7 @@ #include -#include "fxjs/include/cfxjse_arguments.h" +#include "fxjs/cfxjse_arguments.h" #include "xfa/fde/xml/fde_xml.h" #include "xfa/fxfa/parser/xfa_utils.h" diff --git a/xfa/fxfa/parser/xfa_resolvenode_rs.h b/xfa/fxfa/parser/xfa_resolvenode_rs.h index 809ba95ff6..407352e8c9 100644 --- a/xfa/fxfa/parser/xfa_resolvenode_rs.h +++ b/xfa/fxfa/parser/xfa_resolvenode_rs.h @@ -7,7 +7,7 @@ #ifndef XFA_FXFA_PARSER_XFA_RESOLVENODE_RS_H_ #define XFA_FXFA_PARSER_XFA_RESOLVENODE_RS_H_ -#include "fxjs/include/cfxjse_value.h" +#include "fxjs/cfxjse_value.h" #include "xfa/fxfa/include/fxfa.h" #include "xfa/fxfa/parser/cxfa_valuearray.h" -- cgit v1.2.3