Chromium Code Reviews| Index: fpdfsdk/src/javascript/JS_Runtime.cpp |
| diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp |
| index 8b0475b85110d3c09d9325b6e499685372f0b5d9..9c2c6c6fed47073cb23092b764301e3c6d6aefae 100644 |
| --- a/fpdfsdk/src/javascript/JS_Runtime.cpp |
| +++ b/fpdfsdk/src/javascript/JS_Runtime.cpp |
| @@ -245,12 +245,18 @@ FX_BOOL CJS_Runtime::GetHValueByName(const CFX_ByteStringC& utf8Name, |
| v8::Locker lock(GetIsolate()); |
| v8::Isolate::Scope isolate_scope(GetIsolate()); |
| v8::HandleScope handle_scope(GetIsolate()); |
| + v8::Local<v8::Context> old_context = GetIsolate()->GetCurrentContext(); |
| v8::Local<v8::Context> context = |
| v8::Local<v8::Context>::New(GetIsolate(), m_context); |
| v8::Context::Scope context_scope(context); |
| - // v8::Local<v8::Context> tmpCotext = |
| - // v8::Local<v8::Context>::New(GetIsolate(), m_context); |
| + // Caution: We're about to hand to XFA an object that may well require |
| + // |context| to obtain this CJS_Runtime, but XFA will invoke against |
| + // its own |old_context|, which has no CJS_Runtime. Associate ourselves |
| + // with it at this point. |
|
jochen (gone - plz use gerrit)
2015/11/07 05:56:18
i don't understand this comment?
Tom Sepez
2015/11/09 22:15:05
Because the new XFA code and the old PDF code don'
|
| + // TODO(tsepez): redesign PDF-side objects to not rely on context. |
|
jochen (gone - plz use gerrit)
2015/11/07 05:56:18
nor this
Tom Sepez
2015/11/09 22:15:05
Changed. Better?
|
| + FXJS_SetRuntimeForV8Context(old_context, this); |
| + |
| v8::Local<v8::Value> propvalue = |
| context->Global()->Get(v8::String::NewFromUtf8( |
| GetIsolate(), name, v8::String::kNormalString, utf8Name.GetLength())); |