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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/generic/scriptengines/webkit
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2010-01-04 1:54:59
Message-ID: 1262570099.504264.29244.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1069669 by aseigo:

check if the js function exists before calling it; fewer runtime errors result this way


 M  +2 -2      plasmawebapplet.cpp  


--- trunk/KDE/kdebase/workspace/plasma/generic/scriptengines/webkit/plasmawebapplet.cpp #1069668:1069669
@@ -321,7 +321,7 @@
 {
     if (loaded()) {
         m_args = args;
-        QString cmd = func + '(';
+        QString cmd = "if (window." + func + ") { " + func + '(';
         for(int i = 0; i < args.count(); ++i) {
             if (i > 0) {
                 cmd += ',';
@@ -332,7 +332,7 @@
                 cmd += QString("window.plasmoid.arg(%1)").arg(i);
             }
         }
-        cmd += ')';
+        cmd += ") }";
         //kDebug() << cmd;
         return page()->mainFrame()->evaluateJavaScript(cmd);
     }
[prev in list] [next in list] [prev in thread] [next in thread] 

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