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 "fxjse/context.h" | 7 #include "fxjse/context.h" |
8 | 8 |
9 #include "fxjse/include/cfxjse_class.h" | 9 #include "fxjse/include/cfxjse_class.h" |
10 #include "fxjse/include/cfxjse_value.h" | 10 #include "fxjse/include/cfxjse_value.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 lpGlobalClassObj = CFXJSE_Class::Create(pContext, lpGlobalClass, TRUE); | 134 lpGlobalClassObj = CFXJSE_Class::Create(pContext, lpGlobalClass, TRUE); |
135 ASSERT(lpGlobalClassObj); | 135 ASSERT(lpGlobalClassObj); |
136 v8::Local<v8::FunctionTemplate> hFunctionTemplate = | 136 v8::Local<v8::FunctionTemplate> hFunctionTemplate = |
137 v8::Local<v8::FunctionTemplate>::New(pIsolate, | 137 v8::Local<v8::FunctionTemplate>::New(pIsolate, |
138 lpGlobalClassObj->m_hTemplate); | 138 lpGlobalClassObj->m_hTemplate); |
139 hObjectTemplate = hFunctionTemplate->InstanceTemplate(); | 139 hObjectTemplate = hFunctionTemplate->InstanceTemplate(); |
140 } else { | 140 } else { |
141 hObjectTemplate = v8::ObjectTemplate::New(pIsolate); | 141 hObjectTemplate = v8::ObjectTemplate::New(pIsolate); |
142 hObjectTemplate->SetInternalFieldCount(1); | 142 hObjectTemplate->SetInternalFieldCount(1); |
143 } | 143 } |
| 144 hObjectTemplate->Set( |
| 145 v8::Symbol::GetToStringTag(pIsolate), |
| 146 v8::String::NewFromUtf8(pIsolate, "global", v8::NewStringType::kNormal) |
| 147 .ToLocalChecked()); |
144 v8::Local<v8::Context> hNewContext = | 148 v8::Local<v8::Context> hNewContext = |
145 v8::Context::New(pIsolate, NULL, hObjectTemplate); | 149 v8::Context::New(pIsolate, NULL, hObjectTemplate); |
146 v8::Local<v8::Context> hRootContext = v8::Local<v8::Context>::New( | 150 v8::Local<v8::Context> hRootContext = v8::Local<v8::Context>::New( |
147 pIsolate, CFXJSE_RuntimeData::Get(pIsolate)->m_hRootContext); | 151 pIsolate, CFXJSE_RuntimeData::Get(pIsolate)->m_hRootContext); |
148 hNewContext->SetSecurityToken(hRootContext->GetSecurityToken()); | 152 hNewContext->SetSecurityToken(hRootContext->GetSecurityToken()); |
149 v8::Local<v8::Object> hGlobalObject = | 153 v8::Local<v8::Object> hGlobalObject = |
150 FXJSE_GetGlobalObjectFromContext(hNewContext); | 154 FXJSE_GetGlobalObjectFromContext(hNewContext); |
151 FXJSE_UpdateObjectBinding(hGlobalObject, lpGlobalObject); | 155 FXJSE_UpdateObjectBinding(hGlobalObject, lpGlobalObject); |
152 pContext->m_hContext.Reset(pIsolate, hNewContext); | 156 pContext->m_hContext.Reset(pIsolate, hNewContext); |
153 return pContext; | 157 return pContext; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 return TRUE; | 221 return TRUE; |
218 } | 222 } |
219 } | 223 } |
220 if (lpRetValue) { | 224 if (lpRetValue) { |
221 lpRetValue->m_hValue.Reset(m_pIsolate, | 225 lpRetValue->m_hValue.Reset(m_pIsolate, |
222 FXJSE_CreateReturnValue(m_pIsolate, trycatch)); | 226 FXJSE_CreateReturnValue(m_pIsolate, trycatch)); |
223 } | 227 } |
224 return FALSE; | 228 return FALSE; |
225 } | 229 } |
226 } | 230 } |
OLD | NEW |