<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>117834</bug_id>
          
          <creation_ts>2005-12-07 03:14:44 +0000</creation_ts>
          <short_desc>konqueror html w/ javascript has high (80%) cpu usage</short_desc>
          <delta_ts>2006-01-22 03:08:01 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>konqueror</product>
          <component>khtml</component>
          <version>unspecified</version>
          <rep_platform>Gentoo Packages</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Simmons">msimmons</reporter>
          <assigned_to name="Konqueror Bugs">konqueror-bugs-null</assigned_to>
          <cc>maksim</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>396302</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Simmons">msimmons</who>
    <bug_when>2005-12-07 03:14:44 +0000</bug_when>
    <thetext>Version:            (using KDE KDE 3.4.3)
Installed from:    Gentoo Packages
Compiler:          gcc version 3.4.4 
OS:                Linux

The web page
http://www.scied.science.doe.gov/scied/fast/about.html
uses a javascript animation of some sort that uses 80% of the cpu on an AMD64 2GHz. Mozilla 1.7.12 with javascript enabled was not affected at all.

The offending javascript follows:
=================================
/* chaser.js
 * by Aaron Boodman v1.0 000919
 * Copyright (c) 2000 Aaron Boodman. All Rights Reserved.
[snip...get the full license agreement from the linked page]
*/
/*[snip comments]*/
var oChaser = {
  topMargin : 250,
  callRate : 10,
  slideTime : 1200,
  maxDiff : document.all ? document.body.clientHeight : window.innerHeight,
  isIE : document.all ? true : false,
  chaserDiv : document[document.all ? &quot;all&quot; : &quot;layers&quot;][&quot;myChaser&quot;]
}

/*snip comments*/
window.setInterval(&quot;oChaser.main( )&quot;, oChaser.callRate)

/*snip comments*/
oChaser.main = function( )
{
  this.currentY	= this.isIE ? this.chaserDiv.style.pixelTop : this.chaserDiv.top
  this.scrollTop = this.isIE ? document.body.scrollTop : window.pageYOffset
  var newTargetY = this.scrollTop + this.topMargin

  if ( this.currentY != newTargetY ) {
    if ( newTargetY != this.targetY ) {
      this.targetY = newTargetY
      this.slideInit( )
    }
    this.slide( )
  }
}

/*snip comments*/
oChaser.slideInit = function( )
{
  var now = new Date( )
  this.A = this.targetY - this.currentY
  this.B = Math.PI / ( 2 * this.slideTime )
  this.C = now.getTime( )

  if (Math.abs(this.A) &gt; this.maxDiff) {
    this.D = this.A &gt; 0 ? this.targetY - this.maxDiff : this.targetY + this.maxDiff
    this.A = this.A &gt; 0 ? this.maxDiff : -this.maxDiff
  } else {
    this.D = this.currentY
  }
}

/*snip comments*/
oChaser.slide = function( )
{
  var now = new Date( )
  var newY = this.A * Math.sin( this.B * ( now.getTime( ) - this.C ) ) + this.D
  newY = Math.round( newY )

  if (( this.A &gt; 0 &amp;&amp; newY &gt; this.currentY ) ||
    ( this.A &lt; 0 &amp;&amp; newY &lt; this.currentY )) {
		
      if ( this.isIE )this.chaserDiv.style.pixelTop = newY
      else this.chaserDiv.top = newY
  }
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>396303</commentid>
    <comment_count>1</comment_count>
      <attachid>13795</attachid>
    <who name="Michael Simmons">msimmons</who>
    <bug_when>2005-12-07 03:19:15 +0000</bug_when>
    <thetext>Created attachment 13795
the javascript in its entirity</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>396304</commentid>
    <comment_count>2</comment_count>
    <who name="Maksim Orlovich">maksim</who>
    <bug_when>2005-12-07 03:24:29 +0000</bug_when>
    <thetext>LOL. That JS has no chance whatsoever of working on mozilla. And the CPU usage in konqueror? it fills the error log. There was some other bug report about it, I think I&apos;ll put in a cap</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>396306</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Simmons">msimmons</who>
    <bug_when>2005-12-07 03:41:22 +0000</bug_when>
    <thetext>I don&apos;t know enough about javascript one way or the other, I&apos;ll go ahead and close this if it isn&apos;t of any help.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>396307</commentid>
    <comment_count>4</comment_count>
    <who name="Maksim Orlovich">maksim</who>
    <bug_when>2005-12-07 03:45:23 +0000</bug_when>
    <thetext>No, this is very helpful, I am constantly bugging users in #kde that I don&apos;t have enough performance problems to fix :-). And the JavaScript on the page, and the reason for our slowness gave me a good laugh.

Thanks again for reporting this
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>396311</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Simmons">msimmons</who>
    <bug_when>2005-12-07 04:04:19 +0000</bug_when>
    <thetext>Ok, after re-reading the comments I understand what you meant by filling the error log.  I was wondering why there was all the cpu activity but the page was visually static.  I&apos;ll leave it to someone who know what they are doing to close the bug.  This is the first time I&apos;ve reported a bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>407997</commentid>
    <comment_count>6</comment_count>
    <who name="Maksim Orlovich">maksim</who>
    <bug_when>2006-01-22 03:07:59 +0000</bug_when>
    <thetext>SVN commit 501092 by orlovich:

Make this thing actually update incrementally and limit to 2K messages
Fixes #117834 (I think there was some other report, too, but I can&apos;t find it)
BUG:117834


 M  +5 -5      kjserrordlg.ui.h  


--- branches/KDE/3.5/kdelibs/khtml/kjserrordlg.ui.h #501091:501092
@@ -10,14 +10,14 @@
 
 void KJSErrorDlg::init()
 {
-    _errorText-&gt;setText(&quot;&lt;qt&gt;&quot;);
+    _errorText-&gt;setTextFormat(QTextEdit::LogText);
+    _errorText-&gt;setMaxLogLines(2048);//Limit to about 2K errors so we don&apos;t use much CPU
 }
 
 void KJSErrorDlg::addError( const QString &amp; error )
 {
-    // Argh why doesn&apos;t QText* interpret html tags unless I use setText()?
-    // This is really inefficient!
-    _errorText-&gt;setText(_errorText-&gt;text() + &quot;&lt;br&gt;\n&quot; + error);
+    
+    _errorText-&gt;append(error);
 }
 
 void KJSErrorDlg::setURL( const QString &amp; url )
@@ -28,5 +28,5 @@
 void KJSErrorDlg::clear()
 {
     _errorText-&gt;clear();
-    _errorText-&gt;insert(&quot;&lt;qt&gt;&quot;);
+    init();
 }
</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>13795</attachid>
            <date>2005-12-07 03:19:15 +0000</date>
            <delta_ts>2005-12-07 03:19:15 +0000</delta_ts>
            <desc>the javascript in its entirity</desc>
            <filename>chaser.js</filename>
            <type>text/plain</type>
            <size>3106</size>
            <attacher name="Michael Simmons">msimmons</attacher>
            
              <data encoding="base64">LyogY2hhc2VyLmpzDQogKiBieSBBYXJvbiBCb29kbWFuIHYxLjAgMDAwOTE5DQogKiBDb3B5cmln
aHQgKGMpIDIwMDAgQWFyb24gQm9vZG1hbi4gQWxsIFJpZ2h0cyBSZXNlcnZlZC4NCiAqIENyZWF0
ZWQgZm9yIEdyZWF0RXF1YWxpemVyLmNvbSAoaHR0cDovL3d3dy5ncmVhdGVxdWFsaXplci5jb20v
KSBhbmQNCiAqIGRvY3VtZW50ZWQgYXQgREhUTUwgTGFiIChodHRwOi8vd3d3LndlYnJlZmVyZW5j
ZS5jb20vZGh0bWwvKQ0KICogTGljZW5zZSB0byB1c2UgaXMgZ3JhbnRlZCBpZiBhbmQgb25seSBp
ZiB0aGlzIGVudGlyZQ0KICogY29weXJpZ2h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