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

List:       kde-commits
Subject:    kdelibs/khtml/ecma
From:       David Faure <faure () kde ! org>
Date:       2005-03-09 18:05:48
Message-ID: 20050309180548.201BC110E7 () office ! kde ! org
[Download RAW message or body]

CVS commit by faure: 

Don't crash when JS is disabled, based on patch by Mario Weilguni.


  M +9 -5      kjs_window.cpp   1.397
  M +1 -1      kjs_window.h   1.109


--- kdelibs/khtml/ecma/kjs_window.cpp  #1.396:1.397
@@ -1752,9 +1752,9 @@ ScheduledAction::ScheduledAction(QString
 }
 
-void ScheduledAction::execute(Window *window)
+bool ScheduledAction::execute(Window *window)
 {
   KHTMLPart *part = ::qt_cast<KHTMLPart *>(window->m_frame->m_part);
-  if (!part)
-    return;
+  if (!part || !part->jScriptEnabled())
+    return false;
   ScriptInterpreter *interpreter = static_cast<ScriptInterpreter *>(part->jScript()->interpreter());
 
@@ -1786,4 +1786,5 @@ void ScheduledAction::execute(Window *wi
 
   interpreter->setProcessingTimerCallback(false);
+  return true;
 }
 
@@ -1911,6 +1912,9 @@ void WindowQObject::timerEvent(QTimerEve
     if (action->singleShot)
       scheduledActions.removeRef(action);
-    if (parent->part())
-      action->execute(parent);
+    if (parent->part()) {
+      bool ok = action->execute(parent);
+      if ( !ok ) // e.g. JS disabled
+        scheduledActions.removeRef( action );
+    }
 
     action->executing = false;

--- kdelibs/khtml/ecma/kjs_window.h  #1.108:1.109
@@ -180,5 +180,5 @@ namespace KJS {
     ScheduledAction(QString _code, QTime _nextTime, int _interval, bool _singleShot, int _timerId);
     ~ScheduledAction();
-    void execute(Window *window);
+    bool execute(Window *window);
     void mark();
 


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

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