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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 return TRUE; | 102 return TRUE; |
103 }; | 103 }; |
104 | 104 |
105 JSGlobalAlternate::JSGlobalAlternate(CJS_Object* pJSObject) | 105 JSGlobalAlternate::JSGlobalAlternate(CJS_Object* pJSObject) |
106 : CJS_EmbedObj(pJSObject), m_pApp(NULL) { | 106 : CJS_EmbedObj(pJSObject), m_pApp(NULL) { |
107 } | 107 } |
108 | 108 |
109 JSGlobalAlternate::~JSGlobalAlternate() { | 109 JSGlobalAlternate::~JSGlobalAlternate() { |
110 DestroyGlobalPersisitentVariables(); | 110 DestroyGlobalPersisitentVariables(); |
111 m_pApp->GetRuntimeFactory()->ReleaseGlobalData(); | 111 m_pGlobalData->Release(); |
112 } | 112 } |
113 | 113 |
114 void JSGlobalAlternate::Initial(CPDFDoc_Environment* pApp) { | 114 void JSGlobalAlternate::Initial(CPDFDoc_Environment* pApp) { |
115 m_pApp = pApp; | 115 m_pApp = pApp; |
116 m_pGlobalData = pApp->GetRuntimeFactory()->NewGlobalData(pApp); | 116 m_pGlobalData = CJS_GlobalData::GetRetainedInstance(pApp); |
117 UpdateGlobalPersistentVariables(); | 117 UpdateGlobalPersistentVariables(); |
118 } | 118 } |
119 | 119 |
120 FX_BOOL JSGlobalAlternate::QueryProperty(const FX_WCHAR* propname) { | 120 FX_BOOL JSGlobalAlternate::QueryProperty(const FX_WCHAR* propname) { |
121 return CFX_WideString(propname) != L"setPersistent"; | 121 return CFX_WideString(propname) != L"setPersistent"; |
122 } | 122 } |
123 | 123 |
124 FX_BOOL JSGlobalAlternate::DelProperty(IFXJS_Context* cc, | 124 FX_BOOL JSGlobalAlternate::DelProperty(IFXJS_Context* cc, |
125 const FX_WCHAR* propname, | 125 const FX_WCHAR* propname, |
126 CFX_WideString& sError) { | 126 CFX_WideString& sError) { |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 return VT_boolean; | 535 return VT_boolean; |
536 if (nHash == JSCONST_nDateHash) | 536 if (nHash == JSCONST_nDateHash) |
537 return VT_date; | 537 return VT_date; |
538 if (nHash == JSCONST_nObjectHash) | 538 if (nHash == JSCONST_nObjectHash) |
539 return VT_object; | 539 return VT_object; |
540 if (nHash == JSCONST_nFXobjHash) | 540 if (nHash == JSCONST_nFXobjHash) |
541 return VT_fxobject; | 541 return VT_fxobject; |
542 | 542 |
543 return VT_unknown; | 543 return VT_unknown; |
544 } | 544 } |
OLD | NEW |