OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "fpdfsdk/javascript/Document.h" | 7 #include "fpdfsdk/javascript/Document.h" |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) { | 880 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) { |
881 sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION); | 881 sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION); |
882 return FALSE; | 882 return FALSE; |
883 } | 883 } |
884 vp >> m_bDelay; | 884 vp >> m_bDelay; |
885 if (m_bDelay) { | 885 if (m_bDelay) { |
886 m_DelayData.clear(); | 886 m_DelayData.clear(); |
887 } else { | 887 } else { |
888 std::list<std::unique_ptr<CJS_DelayData>> DelayDataToProcess; | 888 std::list<std::unique_ptr<CJS_DelayData>> DelayDataToProcess; |
889 DelayDataToProcess.swap(m_DelayData); | 889 DelayDataToProcess.swap(m_DelayData); |
890 for (const auto& pData : DelayDataToProcess) | 890 for (const auto& pData : DelayDataToProcess) { |
891 Field::DoDelay(m_pDocument.Get(), pData.get()); | 891 if (m_pDocument.Get()) |
| 892 Field::DoDelay(m_pDocument->GetEnv(), pData.get()); |
| 893 } |
892 } | 894 } |
893 } | 895 } |
894 return TRUE; | 896 return TRUE; |
895 } | 897 } |
896 | 898 |
897 FX_BOOL Document::keywords(IJS_Context* cc, | 899 FX_BOOL Document::keywords(IJS_Context* cc, |
898 CJS_PropValue& vp, | 900 CJS_PropValue& vp, |
899 CFX_WideString& sError) { | 901 CFX_WideString& sError) { |
900 return getPropertyInternal(cc, vp, "Keywords", sError); | 902 return getPropertyInternal(cc, vp, "Keywords", sError); |
901 } | 903 } |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 auto iter = m_DelayData.begin(); | 1716 auto iter = m_DelayData.begin(); |
1715 while (iter != m_DelayData.end()) { | 1717 while (iter != m_DelayData.end()) { |
1716 auto old = iter++; | 1718 auto old = iter++; |
1717 if ((*old)->sFieldName == sFieldName && | 1719 if ((*old)->sFieldName == sFieldName && |
1718 (*old)->nControlIndex == nControlIndex) { | 1720 (*old)->nControlIndex == nControlIndex) { |
1719 DelayDataForFieldAndControlIndex.push_back(std::move(*old)); | 1721 DelayDataForFieldAndControlIndex.push_back(std::move(*old)); |
1720 m_DelayData.erase(old); | 1722 m_DelayData.erase(old); |
1721 } | 1723 } |
1722 } | 1724 } |
1723 | 1725 |
1724 for (const auto& pData : DelayDataForFieldAndControlIndex) | 1726 for (const auto& pData : DelayDataForFieldAndControlIndex) { |
1725 Field::DoDelay(m_pDocument.Get(), pData.get()); | 1727 if (m_pDocument.Get()) |
| 1728 Field::DoDelay(m_pDocument->GetEnv(), pData.get()); |
| 1729 } |
1726 } | 1730 } |
1727 | 1731 |
1728 CJS_Document* Document::GetCJSDoc() const { | 1732 CJS_Document* Document::GetCJSDoc() const { |
1729 return static_cast<CJS_Document*>(m_pJSObject); | 1733 return static_cast<CJS_Document*>(m_pJSObject); |
1730 } | 1734 } |
OLD | NEW |