Bug 113181

Summary: khtml javascript freeze in Django admin screens with calendars - regression
Product: [Applications] konqueror Reporter: Luke Plant <L.Plant.98>
Component: khtmlAssignee: Maksim Orlovich <maksim>
Status: RESOLVED FIXED    
Severity: crash CC: faden, maksim
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Test page - KHTML freezes on loading
patch

Description Luke Plant 2005-09-24 02:16:33 UTC
Version:            (using KDE KDE 3.4.90)
Installed from:    Debian testing/unstable Packages
OS:                Linux

KDE 3.4.91, from Kubuntu Hoary packages.

KHTML freezes on loading the attached page, which is part of a 'Django' admin screen.  Konqueror popped up with the 'KHTML is freezed, Abort/Continue' dialog after about 5 seconds, and if I pressed Continue, Konqueror would immediately unfreeze, which I thought strange.  Since then, I checked the "Don't ask again" and pressed "Continue" and now when I load the page it freezes permanently, and I have to kill Konqueror.  

I also can't work out how to undo the "Don't ask again" option (so it does ask me again), which is rather annoying, but another story!  

This definitely worked in KDE 3.4.0

I have tried to cut out as much irrelevant stuff from the code as possible, but have run out of energy and expertise.  So far I have traced the freeze to:
addEvent() -> DateTimeShortcuts.init() -> DateTimeShortcuts.addCalendar() -> DateTimeShortcuts.calendars[num].drawCurrent()

This makes it impossible to use the admin screens of the new web framework 'Django', wherever the admin screens have datetime fields and calendars (other screens still work fine). 

Cheers.
Comment 1 Luke Plant 2005-09-24 02:17:31 UTC
Created attachment 12680 [details]
Test page - KHTML freezes on loading
Comment 2 Luke Plant 2005-10-07 22:55:31 UTC
As an interim measure, can anyone please tell me how to get Konqueror's automatic detection of KHTML freezing to turned back on?  It would make my life much better at the moment...  I've searched and grepped to no avail.

Thanks!
Comment 3 Luke Plant 2005-10-08 00:00:07 UTC
Google+KDE SVN+KDE docs and I eventually found the answer to my last query, no  need to answer it:

In ~/.kde/share/config/konquerorrc, under [Notification Messages], set
kjscupguard_alarmhandler=yes
Comment 4 Luke Plant 2005-10-08 00:22:07 UTC
Updated report on the original bug:  if you have javascript error reporting turned on, the behaviour reported doesn't occur.  Instead, I get a few seconds of 100% CPU activity, followed by a series of error message like this:

An error occurred while attempting to run a script on this page.

file:///home/luke/Desktop/django_konq_freeze.html line 210:
Error: Error

Also errors on line 283 and 264.
Comment 5 Maksim Orlovich 2005-11-14 17:48:51 UTC
the regression is my fault,so I better fix it...
Comment 6 Maksim Orlovich 2005-11-14 17:58:34 UTC
testcase:
<script type="text/javascript">
function freeze() {
    tableRow = document.createElement("tr");
    // Draw blanks after end of month (optional, but makes for valid code)
    while (tableRow.childNodes.length < 7) {
        child = document.createElement('td');
        tableRow.appendChild(child);
    }

}
</script>
</head>

<body onload="freeze()">
</body>
</html>
Comment 7 Maksim Orlovich 2005-11-14 18:12:13 UTC
Created attachment 13451 [details]
patch
Comment 8 Maksim Orlovich 2005-11-30 22:31:02 UTC
SVN commit 484463 by orlovich:

Don't forget to invalidate iteration caches when non-visible elements get
shuffled. Fixes #113181
BUG:113181


 M  +1 -0      dom_nodeimpl.cpp  


--- branches/KDE/3.5/kdelibs/khtml/xml/dom_nodeimpl.cpp #484462:484463
@@ -624,6 +624,7 @@
 void NodeImpl::dispatchSubtreeModifiedEvent()
 {
     childrenChanged();
+    getDocument()->incDOMTreeVersion();
     if (!getDocument()->hasListenerType(DocumentImpl::DOMSUBTREEMODIFIED_LISTENER))
         return;
     int exceptioncode = 0;
Comment 9 Maksim Orlovich 2005-11-30 22:31:54 UTC
SVN commit 484464 by orlovich:

Regression test for 113181
CCBUG:113181


 A             baseline/dom/113181.html-dom  
 A             baseline/dom/113181.html-render  
 A             tests/dom/113181.html  
Comment 10 Maksim Orlovich 2006-01-02 00:53:44 UTC
*** Bug 119347 has been marked as a duplicate of this bug. ***