Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: fpdfsdk/src/javascript/Document.cpp

Issue 1039063002: doc.external - Check direction of property access before blindly getting. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "../../include/javascript/JavaScript.h" 7 #include "../../include/javascript/JavaScript.h"
8 #include "../../include/javascript/IJavaScript.h" 8 #include "../../include/javascript/IJavaScript.h"
9 #include "../../include/javascript/JS_Define.h" 9 #include "../../include/javascript/JS_Define.h"
10 #include "../../include/javascript/JS_Object.h" 10 #include "../../include/javascript/JS_Object.h"
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); 1132 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY);
1133 return FALSE; 1133 return FALSE;
1134 } 1134 }
1135 vp << m_pDocument->GetPageCount(); 1135 vp << m_pDocument->GetPageCount();
1136 return TRUE; 1136 return TRUE;
1137 } 1137 }
1138 1138
1139 FX_BOOL Document::external(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) 1139 FX_BOOL Document::external(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
1140 { 1140 {
1141 //In Chrome case,should always return true. 1141 //In Chrome case,should always return true.
1142 » vp << TRUE; 1142 » if (vp.IsGetting()) {
1143 » » vp << TRUE;
1144 » }
1143 return TRUE; 1145 return TRUE;
1144 } 1146 }
1145 1147
1146 FX_BOOL Document::filesize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) 1148 FX_BOOL Document::filesize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
1147 { 1149 {
1148 if (vp.IsSetting()) { 1150 if (vp.IsSetting()) {
1149 CJS_Context* pContext = static_cast<CJS_Context*>(cc); 1151 CJS_Context* pContext = static_cast<CJS_Context*>(cc);
1150 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); 1152 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY);
1151 return FALSE; 1153 return FALSE;
1152 } 1154 }
1153 vp << 0; 1155 vp << 0;
1154 return TRUE; 1156 return TRUE;
1155 } 1157 }
1156 1158
1157 FX_BOOL Document::mouseX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error) 1159 FX_BOOL Document::mouseX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error)
1158 { 1160 {
1159 return TRUE; 1161 return TRUE;
1160 } 1162 }
1161 1163
1162 FX_BOOL Document::mouseY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error) 1164 FX_BOOL Document::mouseY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s Error)
1163 { 1165 {
1164 return TRUE; 1166 return TRUE;
1165 } 1167 }
1166 1168
1167 FX_BOOL Document::baseURL(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) 1169 FX_BOOL Document::baseURL(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
1168 { 1170 {
1169 if (vp.IsGetting()) 1171 if (vp.IsGetting())
1170 { 1172 {
1171 vp << m_cwBaseURL; 1173 vp << m_cwBaseURL;
1172 return TRUE;
1173 } 1174 }
1174 else 1175 else
1175 { 1176 {
1176 vp >> m_cwBaseURL; 1177 vp >> m_cwBaseURL;
1177 return TRUE;
1178 } 1178 }
1179 return TRUE;
1179 } 1180 }
1180 1181
1181 FX_BOOL Document::calculate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString & sError) 1182 FX_BOOL Document::calculate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString & sError)
1182 { 1183 {
1183 ASSERT(m_pDocument != NULL); 1184 ASSERT(m_pDocument != NULL);
1184 1185
1185 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte rForm(); 1186 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte rForm();
1186 ASSERT(pInterForm != NULL); 1187 ASSERT(pInterForm != NULL);
1187 1188
1188 if (vp.IsGetting()) 1189 if (vp.IsGetting())
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 } 1296 }
1296 1297
1297 FX_BOOL Document::addLink(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V alue& vRet, CFX_WideString& sError) 1298 FX_BOOL Document::addLink(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V alue& vRet, CFX_WideString& sError)
1298 { 1299 {
1299 return TRUE; 1300 return TRUE;
1300 } 1301 }
1301 1302
1302 FX_BOOL Document::closeDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_ Value& vRet, CFX_WideString& sError) 1303 FX_BOOL Document::closeDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_ Value& vRet, CFX_WideString& sError)
1303 { 1304 {
1304 ASSERT(m_pDocument != NULL); 1305 ASSERT(m_pDocument != NULL);
1305
1306
1307
1308
1309
1310 return TRUE; 1306 return TRUE;
1311 } 1307 }
1312 1308
1313 FX_BOOL Document::getPageBox(IFXJS_Context* cc, const CJS_Parameters& params, CJ S_Value& vRet, CFX_WideString& sError) 1309 FX_BOOL Document::getPageBox(IFXJS_Context* cc, const CJS_Parameters& params, CJ S_Value& vRet, CFX_WideString& sError)
1314 { 1310 {
1315 return TRUE; 1311 return TRUE;
1316 } 1312 }
1317 1313
1318
1319 FX_BOOL Document::getAnnot(IFXJS_Context* cc, const CJS_Parameters& params, CJS_ Value& vRet, CFX_WideString& sError) 1314 FX_BOOL Document::getAnnot(IFXJS_Context* cc, const CJS_Parameters& params, CJS_ Value& vRet, CFX_WideString& sError)
1320 { 1315 {
1321 return TRUE; 1316 return TRUE;
1322 } 1317 }
1323 1318
1324 FX_BOOL Document::getAnnots(IFXJS_Context* cc, const CJS_Parameters& params, CJS _Value& vRet, CFX_WideString& sError) 1319 FX_BOOL Document::getAnnots(IFXJS_Context* cc, const CJS_Parameters& params, CJS _Value& vRet, CFX_WideString& sError)
1325 { 1320 {
1326 vRet.SetNull(); 1321 vRet.SetNull();
1327 return TRUE; 1322 return TRUE;
1328 } 1323 }
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 1940
1946 void Document::DoAnnotDelay() 1941 void Document::DoAnnotDelay()
1947 { 1942 {
1948 CFX_DWordArray DelArray; 1943 CFX_DWordArray DelArray;
1949 1944
1950 for (int j=DelArray.GetSize()-1; j>=0; j--) 1945 for (int j=DelArray.GetSize()-1; j>=0; j--)
1951 { 1946 {
1952 m_DelayData.RemoveAt(DelArray[j]); 1947 m_DelayData.RemoveAt(DelArray[j]);
1953 } 1948 }
1954 } 1949 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698