[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/khtml
From:       Stephan Kulow <coolo () kde ! org>
Date:       2004-08-27 12:03:58
Message-ID: 20040827120358.47F8124FF () office ! kde ! org
[Download RAW message or body]

CVS commit by coolo: 

after Germain fixed to make complete() work reliable, the problem with 
the test cases that use JS timers to test something, came back. So I discussed
this with David and query for JS timers for about two seconds at maximum
(so we don't wait forever for an endless timer)


  M +18 -2     test_regression.cpp   1.104
  M +7 -2      ecma/kjs_window.cpp   1.384
  M +1 -0      ecma/kjs_window.h   1.107


--- kdelibs/khtml/test_regression.cpp  #1.103:1.104
@@ -100,4 +100,5 @@ PartMonitor::PartMonitor(KHTMLPart *_par
     m_ownLoopLevel = 0;
     connect(m_part,SIGNAL(completed()),this,SLOT(partCompleted()));
+    m_timer_waits = 200;
 }
 
@@ -113,8 +114,11 @@ void PartMonitor::waitForCompletion()
         if (--sm_loopLevel) {
             assert(m_previousMonitor);
-            QTimer::singleShot( visual ? 100 : 20 , m_previousMonitor, SLOT( timeout() ) );
+            QTimer::singleShot( visual ? 100 : 10 , m_previousMonitor, SLOT( timeout() ) );
         }
         sm_highestMonitor = m_previousMonitor;
     }
+
+    QTimer::singleShot( 0, this, SLOT( finishTimers() ) );
+    kapp->enter_loop();
 }
 
@@ -124,4 +128,16 @@ void PartMonitor::timeout()
 }
 
+void PartMonitor::finishTimers()
+{
+    KJS::Window *w = KJS::Window::retrieveWindow( m_part );
+    --m_timer_waits;
+    if ( m_timer_waits && w && w->winq->hasTimers() ) {
+        // wait a bit
+        QTimer::singleShot( 10, this, SLOT(finishTimers() ) );
+        return;
+    }
+    kapp->exit_loop();
+}
+
 void PartMonitor::partCompleted()
 {
@@ -132,5 +148,5 @@ void PartMonitor::partCompleted()
     {
         RenderWidget::flushWidgetResizes();
-        QTimer::singleShot( visual ? 100 : 20, this, SLOT( timeout() ) );
+        QTimer::singleShot( visual ? 100 : 2, this, SLOT( timeout() ) );
     }
     disconnect(m_part,SIGNAL(completed()),this,SLOT(partCompleted()));

--- kdelibs/khtml/ecma/kjs_window.cpp  #1.383:1.384
@@ -1861,4 +1861,9 @@ void WindowQObject::clearTimeout(int tim
 }
 
+bool WindowQObject::hasTimers() const
+{
+  return scheduledActions.count();
+}
+
 void WindowQObject::mark()
 {

--- kdelibs/khtml/ecma/kjs_window.h  #1.106:1.107
@@ -204,4 +204,5 @@ namespace KJS {
     void clearTimeout(int timerId);
     void mark();
+    bool hasTimers() const;
   public slots:
     void timeoutClose();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic