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