diff options
author | JUN FANG <jun_fang@foxitsoftware.com> | 2015-04-06 12:39:51 -0700 |
---|---|---|
committer | JUN FANG <jun_fang@foxitsoftware.com> | 2015-04-06 12:39:51 -0700 |
commit | f15807369f2fc3c346cfe06b1d9d847de0feee1d (patch) | |
tree | 266821bacd0a2ce316e8ee41dbaf89b471234de6 /fpdfsdk/include | |
parent | 6fcecb529007b65596f0ce30efde571f820df56b (diff) | |
download | pdfium-f15807369f2fc3c346cfe06b1d9d847de0feee1d.tar.xz |
Fix a fatal error due to cloning a global document object
BUG=454595
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1053373002
Diffstat (limited to 'fpdfsdk/include')
-rw-r--r-- | fpdfsdk/include/javascript/Document.h | 52 | ||||
-rw-r--r-- | fpdfsdk/include/javascript/JS_Value.h | 38 |
2 files changed, 41 insertions, 49 deletions
diff --git a/fpdfsdk/include/javascript/Document.h b/fpdfsdk/include/javascript/Document.h index 7d7cd7c8a0..8aa53fe7f7 100644 --- a/fpdfsdk/include/javascript/Document.h +++ b/fpdfsdk/include/javascript/Document.h @@ -160,38 +160,32 @@ public: FX_BOOL removeIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError); public: - void AttachDoc(CPDFSDK_Document* pDoc); - CPDFSDK_Document* GetReaderDoc(); - - static FX_BOOL ExtractFileName(CPDFSDK_Document* pDoc, CFX_ByteString& strFileName); - static FX_BOOL ExtractFolderName(CPDFSDK_Document* pDoc, CFX_ByteString& strFolderName); - -public: - void AddDelayData(CJS_DelayData* pData); - void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex); - - void AddDelayAnnotData(CJS_AnnotObj *pData); - void DoAnnotDelay(); - void SetIsolate(v8::Isolate* isolate) {m_isolate = isolate;} - -private: - CFX_WideString ReversalStr(CFX_WideString cbFrom); - CFX_WideString CutString(CFX_WideString cbFrom); - bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect); - int CountWords(CPDF_TextObject* pTextObj); - CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex); - - FX_BOOL ParserParams(JSObject *pObj,CJS_AnnotObj& annotobj); + void AttachDoc(CPDFSDK_Document* pDoc); + CPDFSDK_Document* GetReaderDoc(); + static FX_BOOL ExtractFileName(CPDFSDK_Document* pDoc, CFX_ByteString& strFileName); + static FX_BOOL ExtractFolderName(CPDFSDK_Document* pDoc, CFX_ByteString& strFolderName); + void AddDelayData(CJS_DelayData* pData); + void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex); + void AddDelayAnnotData(CJS_AnnotObj *pData); + void DoAnnotDelay(); + void SetIsolate(v8::Isolate* isolate) {m_isolate = isolate;} + CJS_Document* GetCJSDoc() const; private: - v8::Isolate* m_isolate; - IconTree* m_pIconTree; - CPDFSDK_Document* m_pDocument; - CFX_WideString m_cwBaseURL; + CFX_WideString ReversalStr(CFX_WideString cbFrom); + CFX_WideString CutString(CFX_WideString cbFrom); + bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect); + int CountWords(CPDF_TextObject* pTextObj); + CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex); + FX_BOOL ParserParams(JSObject *pObj,CJS_AnnotObj& annotobj); - FX_BOOL m_bDelay; - CFX_ArrayTemplate<CJS_DelayData*> m_DelayData; - CFX_ArrayTemplate<CJS_AnnotObj*> m_DelayAnnotData; + v8::Isolate* m_isolate; + IconTree* m_pIconTree; + CPDFSDK_Document* m_pDocument; + CFX_WideString m_cwBaseURL; + FX_BOOL m_bDelay; + CFX_ArrayTemplate<CJS_DelayData*> m_DelayData; + CFX_ArrayTemplate<CJS_AnnotObj*> m_DelayAnnotData; }; class CJS_Document : public CJS_Object diff --git a/fpdfsdk/include/javascript/JS_Value.h b/fpdfsdk/include/javascript/JS_Value.h index 4962ddcf3d..165898cf33 100644 --- a/fpdfsdk/include/javascript/JS_Value.h +++ b/fpdfsdk/include/javascript/JS_Value.h @@ -52,6 +52,7 @@ public: void operator = (double); void operator = (float); void operator = (CJS_Object*); + void operator = (CJS_Document*); void operator = (v8::Handle<v8::Object>); void operator = (CJS_Array &); void operator = (CJS_Date &); @@ -87,37 +88,34 @@ public: class CJS_PropValue: public CJS_Value { public: - CJS_PropValue(const CJS_Value &); + CJS_PropValue(const CJS_Value&); CJS_PropValue(v8::Isolate* isolate); ~CJS_PropValue(); public: FX_BOOL IsSetting(); FX_BOOL IsGetting(); - void operator<<(int ); - void operator>>(int &) const; + void operator<<(int); + void operator>>(int&) const; void operator<<(bool); - void operator>>(bool &) const; - void operator<<(double ); - void operator>>(double &) const; - void operator<<(CJS_Object *pObj); - void operator>>(CJS_Object *&ppObj) const; + void operator>>(bool&) const; + void operator<<(double); + void operator>>(double&) const; + void operator<<(CJS_Object* pObj); + void operator>>(CJS_Object*& ppObj) const; + void operator<<(CJS_Document* pJsDoc); + void operator>>(CJS_Document*& ppJsDoc) const; void operator<<(CFX_ByteString); - void operator>>(CFX_ByteString &) const; + void operator>>(CFX_ByteString&) const; void operator<<(CFX_WideString); - void operator>>(CFX_WideString &) const; + void operator>>(CFX_WideString&) const; void operator<<(FX_LPCWSTR c_string); - void operator<<(JSFXObject); - void operator>>(JSFXObject &) const; - - void operator>>(CJS_Array &array) const; - void operator<<(CJS_Array &array); - - void operator<<(CJS_Date &date); - void operator>>(CJS_Date &date) const; - + void operator>>(JSFXObject&) const; + void operator>>(CJS_Array& array) const; + void operator<<(CJS_Array& array); + void operator<<(CJS_Date& date); + void operator>>(CJS_Date& date) const; operator v8::Handle<v8::Value>() const; - void StartSetting(); void StartGetting(); private: |