| 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 "fpdfsdk/include/jsapi/fxjs_v8.h" | 7 #include "fpdfsdk/include/jsapi/fxjs_v8.h" |
| 8 | 8 |
| 9 #include "core/include/fxcrt/fx_basic.h" | 9 #include "core/include/fxcrt/fx_basic.h" |
| 10 | 10 |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 v8::HandleScope handle_scope(pIsolate); | 363 v8::HandleScope handle_scope(pIsolate); |
| 364 v8::Local<v8::Context> context = | 364 v8::Local<v8::Context> context = |
| 365 v8::Local<v8::Context>::New(pIsolate, *pV8PersistentContext); | 365 v8::Local<v8::Context>::New(pIsolate, *pV8PersistentContext); |
| 366 v8::Context::Scope context_scope(context); | 366 v8::Context::Scope context_scope(context); |
| 367 | 367 |
| 368 FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate); | 368 FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate); |
| 369 if (!pData) | 369 if (!pData) |
| 370 return; | 370 return; |
| 371 pData->ReleaseDynamicObjsMap(); | 371 pData->ReleaseDynamicObjsMap(); |
| 372 | 372 |
| 373 #ifdef PDF_ENABLE_XFA | |
| 374 // XFA, if present, should have already cleaned itself up. | |
| 375 FXSYS_assert(!pData->m_pFXJSERuntimeData); | |
| 376 #endif // PDF_ENABLE_XFA | |
| 377 | |
| 378 int maxID = CFXJS_ObjDefinition::MaxID(pIsolate); | 373 int maxID = CFXJS_ObjDefinition::MaxID(pIsolate); |
| 379 for (int i = 0; i < maxID; ++i) { | 374 for (int i = 0; i < maxID; ++i) { |
| 380 CFXJS_ObjDefinition* pObjDef = CFXJS_ObjDefinition::ForID(pIsolate, i); | 375 CFXJS_ObjDefinition* pObjDef = CFXJS_ObjDefinition::ForID(pIsolate, i); |
| 381 v8::Local<v8::Object> pObj; | 376 v8::Local<v8::Object> pObj; |
| 382 if (pObjDef->m_ObjType == FXJSOBJTYPE_GLOBAL) { | 377 if (pObjDef->m_ObjType == FXJSOBJTYPE_GLOBAL) { |
| 383 pObj = | 378 pObj = |
| 384 context->Global()->GetPrototype()->ToObject(context).ToLocalChecked(); | 379 context->Global()->GetPrototype()->ToObject(context).ToLocalChecked(); |
| 385 } else if (pStaticObjects->at(i) && !pStaticObjects->at(i)->IsEmpty()) { | 380 } else if (pStaticObjects->at(i) && !pStaticObjects->at(i)->IsEmpty()) { |
| 386 pObj = v8::Local<v8::Object>::New(pIsolate, *pStaticObjects->at(i)); | 381 pObj = v8::Local<v8::Object>::New(pIsolate, *pStaticObjects->at(i)); |
| 387 delete pStaticObjects->at(i); | 382 delete pStaticObjects->at(i); |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 return v8::Local<v8::Array>(); | 801 return v8::Local<v8::Array>(); |
| 807 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); | 802 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); |
| 808 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); | 803 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); |
| 809 } | 804 } |
| 810 | 805 |
| 811 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { | 806 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { |
| 812 pTo = pFrom; | 807 pTo = pFrom; |
| 813 } | 808 } |
| 814 | 809 |
| 815 | 810 |
| OLD | NEW |