| 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/jsapi/fxjs_v8.h" | 7 #include "../../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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 v8::Local<v8::Context>::New(pIsolate, v8PersistentContext); | 328 v8::Local<v8::Context>::New(pIsolate, v8PersistentContext); |
| 329 v8::Context::Scope context_scope(context); | 329 v8::Context::Scope context_scope(context); |
| 330 | 330 |
| 331 FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate); | 331 FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate); |
| 332 if (!pData) | 332 if (!pData) |
| 333 return; | 333 return; |
| 334 | 334 |
| 335 int maxID = CFXJS_ObjDefinition::MaxID(pIsolate); | 335 int maxID = CFXJS_ObjDefinition::MaxID(pIsolate); |
| 336 for (int i = 0; i < maxID; ++i) { | 336 for (int i = 0; i < maxID; ++i) { |
| 337 CFXJS_ObjDefinition* pObjDef = CFXJS_ObjDefinition::ForID(pIsolate, i); | 337 CFXJS_ObjDefinition* pObjDef = CFXJS_ObjDefinition::ForID(pIsolate, i); |
| 338 if (!pObjDef->m_StaticObj.IsEmpty()) { | 338 v8::Local<v8::Object> pObj; |
| 339 v8::Local<v8::Object> pObj = | 339 if (pObjDef->m_ObjType == FXJSOBJTYPE_GLOBAL) { |
| 340 v8::Local<v8::Object>::New(pIsolate, pObjDef->m_StaticObj); | 340 pObj = |
| 341 context->Global()->GetPrototype()->ToObject(context).ToLocalChecked(); |
| 342 } else if (!pObjDef->m_StaticObj.IsEmpty()) { |
| 343 pObj = v8::Local<v8::Object>::New(pIsolate, pObjDef->m_StaticObj); |
| 344 } |
| 345 |
| 346 if (!pObj.IsEmpty()) { |
| 341 if (pObjDef->m_pDestructor) | 347 if (pObjDef->m_pDestructor) |
| 342 pObjDef->m_pDestructor(pObj); | 348 pObjDef->m_pDestructor(pObj); |
| 343 FXJS_FreePrivate(pObj); | 349 FXJS_FreePrivate(pObj); |
| 344 } | 350 } |
| 345 delete pObjDef; | 351 delete pObjDef; |
| 346 } | 352 } |
| 347 | 353 |
| 348 pIsolate->SetData(g_embedderDataSlot, nullptr); | 354 pIsolate->SetData(g_embedderDataSlot, nullptr); |
| 349 delete pData; | 355 delete pData; |
| 350 } | 356 } |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 return v8::Local<v8::Array>(); | 752 return v8::Local<v8::Array>(); |
| 747 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); | 753 v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); |
| 748 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); | 754 return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked()); |
| 749 } | 755 } |
| 750 | 756 |
| 751 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { | 757 void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom) { |
| 752 pTo = pFrom; | 758 pTo = pFrom; |
| 753 } | 759 } |
| 754 | 760 |
| 755 | 761 |
| OLD | NEW |