summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/Document.h
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-12 11:21:42 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-12 11:21:42 -0700
commit55be02e2d6deb857fcf404c78b3633a3eac57e6c (patch)
tree8712da4a1b90a323ca3c3dfa0de18a41c2ac67cf /fpdfsdk/javascript/Document.h
parent0b022056c74c00d0c52166e33c81c8b842d00d63 (diff)
downloadpdfium-55be02e2d6deb857fcf404c78b3633a3eac57e6c.tar.xz
Make wrapped JS Document observe C++-side object.
First of several patches to ensure JS objects don't track stale C++ objects. Review-Url: https://codereview.chromium.org/2323903002
Diffstat (limited to 'fpdfsdk/javascript/Document.h')
-rw-r--r--fpdfsdk/javascript/Document.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/fpdfsdk/javascript/Document.h b/fpdfsdk/javascript/Document.h
index feef228c6e..a35358d4df 100644
--- a/fpdfsdk/javascript/Document.h
+++ b/fpdfsdk/javascript/Document.h
@@ -13,6 +13,7 @@
#include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h"
#include "core/fpdfapi/fpdf_page/include/cpdf_textobject.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
#include "fpdfsdk/javascript/JS_Define.h"
class PrintParamsObj : public CJS_EmbedObj {
@@ -270,7 +271,7 @@ class Document : public CJS_EmbedObj {
FX_BOOL URL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
void AttachDoc(CPDFSDK_Document* pDoc);
- CPDFSDK_Document* GetReaderDoc();
+ CPDFSDK_Document* GetReaderDoc() const { return m_pDocument.Get(); }
void AddDelayData(CJS_DelayData* pData);
void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex);
CJS_Document* GetCJSDoc() const;
@@ -285,7 +286,7 @@ class Document : public CJS_EmbedObj {
const CFX_ByteString& propName,
CFX_WideString& sError);
- CPDFSDK_Document* m_pDocument;
+ CPDFSDK_Document::ObservedPtr m_pDocument;
CFX_WideString m_cwBaseURL;
std::list<std::unique_ptr<CJS_DelayData>> m_DelayData;
std::list<std::unique_ptr<IconElement>> m_IconList;