diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-09-17 15:40:06 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-09-17 15:40:06 -0700 |
commit | d5a0e95db021e50064cc2e761f023b75c24b72a2 (patch) | |
tree | b355b190bdec2a9e8cc56d8f4b2be888a891fc6f /fpdfsdk/src/jsapi | |
parent | 39bfe122b4867601051c56562a5ab9cf6be644ad (diff) | |
download | pdfium-d5a0e95db021e50064cc2e761f023b75c24b72a2.tar.xz |
Merge to XFA: Don't pass null isolates to FXJS_ when we have a real isolate.
(cherry picked from commit 34b39e1d4fa0b16d47770b823230344356cc451a)
Original Review URL: https://codereview.chromium.org/1350703003 .
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1342403005 .
Diffstat (limited to 'fpdfsdk/src/jsapi')
-rw-r--r-- | fpdfsdk/src/jsapi/fxjs_v8.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp index 190641131a..6349ca3a6f 100644 --- a/fpdfsdk/src/jsapi/fxjs_v8.cpp +++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp @@ -497,13 +497,6 @@ const wchar_t* FXJS_GetTypeof(v8::Local<v8::Value> pObj) { return kFXJSValueNameUndefined; return NULL; } -void FXJS_SetPrivate(v8::Local<v8::Object> pObj, void* p) { - FXJS_SetPrivate(NULL, pObj, p); -} - -void* FXJS_GetPrivate(v8::Local<v8::Object> pObj) { - return FXJS_GetPrivate(NULL, pObj); -} void FXJS_SetPrivate(v8::Isolate* pIsolate, v8::Local<v8::Object> pObj, @@ -519,24 +512,21 @@ void FXJS_SetPrivate(v8::Isolate* pIsolate, void* FXJS_GetPrivate(v8::Isolate* pIsolate, v8::Local<v8::Object> pObj) { if (pObj.IsEmpty()) - return NULL; - CFXJS_PrivateData* pPrivateData = NULL; - if (pObj->InternalFieldCount()) + return nullptr; + CFXJS_PrivateData* pPrivateData = nullptr; + if (pObj->InternalFieldCount()) { pPrivateData = (CFXJS_PrivateData*)pObj->GetAlignedPointerFromInternalField(0); - else { + } else { // It could be a global proxy object. v8::Local<v8::Value> v = pObj->GetPrototype(); - v8::Isolate* isolate = (v8::Isolate*)pIsolate; - v8::Local<v8::Context> context = isolate->GetCurrentContext(); + v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); if (v->IsObject()) pPrivateData = (CFXJS_PrivateData*)v->ToObject(context) .ToLocalChecked() ->GetAlignedPointerFromInternalField(0); } - if (!pPrivateData) - return NULL; - return pPrivateData->pPrivate; + return pPrivateData ? pPrivateData->pPrivate : nullptr; } void FXJS_FreePrivate(void* pPrivateData) { |