| 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 "../../include/javascript/IJavaScript.h" | 7 #include "../../include/javascript/IJavaScript.h" |
| 8 #include "../../include/javascript/JS_Context.h" | 8 #include "../../include/javascript/JS_Context.h" |
| 9 #include "../../include/javascript/JS_Define.h" | 9 #include "../../include/javascript/JS_Define.h" |
| 10 #include "../../include/javascript/JS_EventHandler.h" | 10 #include "../../include/javascript/JS_EventHandler.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 ASSERT(pFactory); | 137 ASSERT(pFactory); |
| 138 m_pGlobalData = pFactory->NewGlobalData(pApp); | 138 m_pGlobalData = pFactory->NewGlobalData(pApp); |
| 139 UpdateGlobalPersistentVariables(); | 139 UpdateGlobalPersistentVariables(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 FX_BOOL global_alternate::QueryProperty(FX_LPCWSTR propname) | 142 FX_BOOL global_alternate::QueryProperty(FX_LPCWSTR propname) |
| 143 { | 143 { |
| 144 return CFX_WideString(propname) != L"setPersistent"; | 144 return CFX_WideString(propname) != L"setPersistent"; |
| 145 } | 145 } |
| 146 | 146 |
| 147 FX_BOOL»global_alternate::DelProperty(IFXJS_Context* cc, FX_LPCWSTR propname, JS
_ErrorString& sError) | 147 FX_BOOL»global_alternate::DelProperty(IFXJS_Context* cc, FX_LPCWSTR propname, CF
X_WideString& sError) |
| 148 { | 148 { |
| 149 js_global_data* pData = NULL; | 149 js_global_data* pData = NULL; |
| 150 CFX_ByteString sPropName = CFX_ByteString::FromUnicode(propname); | 150 CFX_ByteString sPropName = CFX_ByteString::FromUnicode(propname); |
| 151 | 151 |
| 152 if (m_mapGlobal.Lookup(sPropName, (FX_LPVOID&)pData)) | 152 if (m_mapGlobal.Lookup(sPropName, (FX_LPVOID&)pData)) |
| 153 { | 153 { |
| 154 pData->bDeleted = TRUE; | 154 pData->bDeleted = TRUE; |
| 155 return TRUE; | 155 return TRUE; |
| 156 } | 156 } |
| 157 | 157 |
| 158 return FALSE; | 158 return FALSE; |
| 159 } | 159 } |
| 160 | 160 |
| 161 FX_BOOL global_alternate::DoProperty(IFXJS_Context* cc, FX_LPCWSTR propname, CJS
_PropValue& vp, JS_ErrorString& sError) | 161 FX_BOOL global_alternate::DoProperty(IFXJS_Context* cc, FX_LPCWSTR propname, CJS
_PropValue& vp, CFX_WideString& sError) |
| 162 { | 162 { |
| 163 if (vp.IsSetting()) | 163 if (vp.IsSetting()) |
| 164 { | 164 { |
| 165 CFX_ByteString sPropName = CFX_ByteString::FromUnicode(propname)
; | 165 CFX_ByteString sPropName = CFX_ByteString::FromUnicode(propname)
; |
| 166 switch (vp.GetType()) | 166 switch (vp.GetType()) |
| 167 { | 167 { |
| 168 case VT_number: | 168 case VT_number: |
| 169 { | 169 { |
| 170 double dData; | 170 double dData; |
| 171 vp >> dData; | 171 vp >> dData; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 else | 263 else |
| 264 { | 264 { |
| 265 vp.SetNull(); | 265 vp.SetNull(); |
| 266 return TRUE; | 266 return TRUE; |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 | 269 |
| 270 return FALSE; | 270 return FALSE; |
| 271 } | 271 } |
| 272 | 272 |
| 273 FX_BOOL global_alternate::setPersistent(IFXJS_Context* cc, const CJS_Parameters&
params, CJS_Value& vRet, JS_ErrorString& sError) | 273 FX_BOOL global_alternate::setPersistent(IFXJS_Context* cc, const CJS_Parameters&
params, CJS_Value& vRet, CFX_WideString& sError) |
| 274 { | 274 { |
| 275 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 275 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
| 276 if (params.size() != 2) | 276 if (params.size() != 2) |
| 277 { | 277 { |
| 278 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); | 278 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); |
| 279 return FALSE; | 279 return FALSE; |
| 280 } | 280 } |
| 281 | 281 |
| 282 CFX_ByteString sName = params[0]; | 282 CFX_ByteString sName = params[0]; |
| 283 | 283 |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 if (nHash == JSCONST_nDateHash) | 636 if (nHash == JSCONST_nDateHash) |
| 637 return VT_date; | 637 return VT_date; |
| 638 if (nHash == JSCONST_nObjectHash) | 638 if (nHash == JSCONST_nObjectHash) |
| 639 return VT_object; | 639 return VT_object; |
| 640 if (nHash == JSCONST_nFXobjHash) | 640 if (nHash == JSCONST_nFXobjHash) |
| 641 return VT_fxobject; | 641 return VT_fxobject; |
| 642 | 642 |
| 643 return VT_unknown; | 643 return VT_unknown; |
| 644 } | 644 } |
| 645 | 645 |
| OLD | NEW |