| 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/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 251 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(OBJ_METHOD_PARAMS) | 272 FX_BOOL global_alternate::setPersistent(IFXJS_Context* cc, const CJS_Parameters&
params, CJS_Value& vRet, JS_ErrorString& sError) |
| 273 { | 273 { |
| 274 if (params.size() != 2) | 274 if (params.size() != 2) |
| 275 { | 275 { |
| 276 //sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); | 276 //sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); |
| 277 return FALSE; | 277 return FALSE; |
| 278 } | 278 } |
| 279 | 279 |
| 280 CFX_ByteString sName = params[0]; | 280 CFX_ByteString sName = params[0]; |
| 281 | 281 |
| 282 js_global_data* pData = NULL; | 282 js_global_data* pData = NULL; |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 } | 609 } |
| 610 break; | 610 break; |
| 611 default: | 611 default: |
| 612 return FALSE; | 612 return FALSE; |
| 613 } | 613 } |
| 614 | 614 |
| 615 m_mapGlobal.SetAt(propname, (FX_LPVOID)pNewData); | 615 m_mapGlobal.SetAt(propname, (FX_LPVOID)pNewData); |
| 616 | 616 |
| 617 return TRUE; | 617 return TRUE; |
| 618 } | 618 } |
| 619 |
| 620 FXJSVALUETYPE GET_VALUE_TYPE(v8::Handle<v8::Value> p) |
| 621 { |
| 622 const unsigned int nHash = JS_CalcHash(JS_GetTypeof(p)); |
| 623 |
| 624 if (nHash == JSCONST_nUndefHash) |
| 625 return VT_undefined; |
| 626 if (nHash == JSCONST_nNullHash) |
| 627 return VT_null; |
| 628 if (nHash == JSCONST_nStringHash) |
| 629 return VT_string; |
| 630 if (nHash == JSCONST_nNumberHash) |
| 631 return VT_number; |
| 632 if (nHash == JSCONST_nBoolHash) |
| 633 return VT_boolean; |
| 634 if (nHash == JSCONST_nDateHash) |
| 635 return VT_date; |
| 636 if (nHash == JSCONST_nObjectHash) |
| 637 return VT_object; |
| 638 if (nHash == JSCONST_nFXobjHash) |
| 639 return VT_fxobject; |
| 640 |
| 641 return VT_unknown; |
| 642 } |
| 643 |
| OLD | NEW |