Revert "Leak per-isolate data in pdfium"
[pdfium.git] / fpdfsdk / src / javascript / JS_Context.cpp
index 2bee913..342616d 100644 (file)
@@ -46,8 +46,9 @@ FX_BOOL CJS_Context::RunScript(const CFX_WideString& script,
   m_bBusy = TRUE;
 
   ASSERT(m_pEventHandler->IsValid());
-  if (!m_pRuntime->AddEventToLoop(m_pEventHandler->TargetName(),
-                                  m_pEventHandler->EventType())) {
+  CJS_Runtime::FieldEvent event(m_pEventHandler->TargetName(),
+                                m_pEventHandler->EventType());
+  if (!m_pRuntime->AddEventToSet(event)) {
     info = JSGetStringFromID(this, IDS_STRING_JSEVENT);
     return FALSE;
   }
@@ -55,8 +56,8 @@ FX_BOOL CJS_Context::RunScript(const CFX_WideString& script,
   FXJSErr error = {NULL, NULL, 0};
   int nRet = 0;
   if (script.GetLength() > 0) {
-    nRet = JS_Execute(m_pRuntime->GetIsolate(), this, script.c_str(),
-                      script.GetLength(), &error);
+    nRet = FXJS_Execute(m_pRuntime->GetIsolate(), this, script.c_str(),
+                        script.GetLength(), &error);
   }
 
   if (nRet < 0) {
@@ -68,9 +69,7 @@ FX_BOOL CJS_Context::RunScript(const CFX_WideString& script,
     info = JSGetStringFromID(this, IDS_STRING_RUN);
   }
 
-  m_pRuntime->RemoveEventInLoop(m_pEventHandler->TargetName(),
-                                m_pEventHandler->EventType());
-
+  m_pRuntime->RemoveEventFromSet(event);
   m_pEventHandler->Destroy();
   m_bBusy = FALSE;