Revert "Fix else-after-returns throughout pdfium."
[pdfium.git] / fpdfsdk / src / javascript / JS_Runtime.cpp
index 6ceb640..34a451b 100644 (file)
@@ -35,7 +35,11 @@ IFXJS_Runtime*                                       CJS_RuntimeFactory::NewJSRuntime(CPDFDoc_Environment* pApp)
 {
        if (!m_bInit)
        {
-               JS_Initial();
+               unsigned int embedderDataSlot = 0;
+               if (pApp->GetFormFillInfo()->m_pJsPlatform->version >= 2) {
+                       embedderDataSlot = pApp->GetFormFillInfo()->m_pJsPlatform->m_v8EmbedderSlot;
+                }
+               JS_Initial(embedderDataSlot);
                m_bInit = TRUE;
        }
        return new CJS_Runtime(pApp);
@@ -61,8 +65,7 @@ void                                                  CJS_RuntimeFactory::Release()
 
 void                                                   CJS_RuntimeFactory::DeleteJSRuntime(IFXJS_Runtime* pRuntime)
 {
-       if(pRuntime)
-               delete (CJS_Runtime*)pRuntime;
+    delete (CJS_Runtime*)pRuntime;
 }
 
 CJS_GlobalData*        CJS_RuntimeFactory::NewGlobalData(CPDFDoc_Environment* pApp)
@@ -109,12 +112,11 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment * pApp) :
        m_pApp(pApp),
        m_pDocument(NULL),
        m_bBlocking(FALSE),
-       m_bRegistered(FALSE),
        m_pFieldEventPath(NULL),
         m_isolate(NULL)
 {
        if (m_pApp->GetFormFillInfo()->m_pJsPlatform->version >= 2) {
-               m_isolate = m_pApp->GetFormFillInfo()->m_pJsPlatform->m_isolate;
+               m_isolate = reinterpret_cast<v8::Isolate*>(m_pApp->GetFormFillInfo()->m_pJsPlatform->m_isolate);
        }
        if (!m_isolate) {
                m_pArrayBufferAllocator.reset(new CJS_ArrayBufferAllocator());