summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-01 18:56:07 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-01 18:56:07 +0000
commit1bc5e494b675aeb5e73cae1d0d3cfad341a05a60 (patch)
treef6b757d623c873dc981e8ed007aba6294af7bae1
parent46ad7f84cfeef009a4f5e4bc13f8b3435f789f30 (diff)
downloadpdfium-1bc5e494b675aeb5e73cae1d0d3cfad341a05a60.tar.xz
Add CJX_ThisProxy
This CL creates a CJX_ThisProxy which is created by CXFA_ThisProxy. This allows CJX_Object constructor to be protected. Change-Id: Ie6865c82c29cd1d129faa487c9021a63310c78a6 Reviewed-on: https://pdfium-review.googlesource.com/17314 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r--BUILD.gn2
-rw-r--r--fxjs/cjx_object.h5
-rw-r--r--fxjs/cjx_thisproxy.cpp13
-rw-r--r--fxjs/cjx_thisproxy.h20
-rw-r--r--xfa/fxfa/parser/cxfa_thisproxy.cpp4
5 files changed, 40 insertions, 4 deletions
diff --git a/BUILD.gn b/BUILD.gn
index cadae4ee8f..877b622ffd 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1317,6 +1317,8 @@ static_library("fxjs") {
"fxjs/cjx_object.h",
"fxjs/cjx_signaturepseudomodel.cpp",
"fxjs/cjx_signaturepseudomodel.h",
+ "fxjs/cjx_thisproxy.cpp",
+ "fxjs/cjx_thisproxy.h",
"fxjs/fxjse.h",
]
}
diff --git a/fxjs/cjx_object.h b/fxjs/cjx_object.h
index 9e957d88ba..7cb91b9d27 100644
--- a/fxjs/cjx_object.h
+++ b/fxjs/cjx_object.h
@@ -16,7 +16,6 @@ class CXFA_Object;
class CJX_Object {
public:
- explicit CJX_Object(CXFA_Object* object);
virtual ~CJX_Object();
CXFA_Object* GetXFAObject() { return object_.Get(); }
@@ -31,7 +30,9 @@ class CJX_Object {
void ThrowIndexOutOfBoundsException() const;
void ThrowParamCountMismatchException(const WideString& method) const;
- // Make this protected when the cscript_* objects are converted to CJX.
+ protected:
+ explicit CJX_Object(CXFA_Object* object);
+
void ThrowException(const wchar_t* str, ...) const;
private:
diff --git a/fxjs/cjx_thisproxy.cpp b/fxjs/cjx_thisproxy.cpp
new file mode 100644
index 0000000000..281bb44ede
--- /dev/null
+++ b/fxjs/cjx_thisproxy.cpp
@@ -0,0 +1,13 @@
+// Copyright 2017 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/cjx_thisproxy.h"
+
+#include "xfa/fxfa/parser/cxfa_thisproxy.h"
+
+CJX_ThisProxy::CJX_ThisProxy(CXFA_ThisProxy* proxy) : CJX_Object(proxy) {}
+
+CJX_ThisProxy::~CJX_ThisProxy() {}
diff --git a/fxjs/cjx_thisproxy.h b/fxjs/cjx_thisproxy.h
new file mode 100644
index 0000000000..397589b5a1
--- /dev/null
+++ b/fxjs/cjx_thisproxy.h
@@ -0,0 +1,20 @@
+// Copyright 2017 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_CJX_THISPROXY_H_
+#define FXJS_CJX_THISPROXY_H_
+
+#include "fxjs/cjx_object.h"
+
+class CXFA_ThisProxy;
+
+class CJX_ThisProxy : public CJX_Object {
+ public:
+ explicit CJX_ThisProxy(CXFA_ThisProxy* proxy);
+ ~CJX_ThisProxy() override;
+};
+
+#endif // FXJS_CJX_THISPROXY_H_
diff --git a/xfa/fxfa/parser/cxfa_thisproxy.cpp b/xfa/fxfa/parser/cxfa_thisproxy.cpp
index 6b84913afb..bbf88a86b7 100644
--- a/xfa/fxfa/parser/cxfa_thisproxy.cpp
+++ b/xfa/fxfa/parser/cxfa_thisproxy.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_thisproxy.h"
-#include "fxjs/cjx_object.h"
+#include "fxjs/cjx_thisproxy.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fxfa/parser/cxfa_node.h"
@@ -15,7 +15,7 @@ CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode)
XFA_ObjectType::VariablesThis,
XFA_Element::Unknown,
WideStringView(),
- pdfium::MakeUnique<CJX_Object>(this)),
+ pdfium::MakeUnique<CJX_ThisProxy>(this)),
m_pThisNode(pThisNode),
m_pScriptNode(pScriptNode) {}