Bug 56118 - [EL] [testcase] assignment to location.href onunload fails
Summary: [EL] [testcase] assignment to location.href onunload fails
Status: RESOLVED WORKSFORME
Alias: None
Product: konqueror
Classification: Applications
Component: khtml ecma (show other bugs)
Version: 3.1
Platform: Mandrake RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 105873 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-03-19 02:12 UTC by Jon Gabrielson
Modified: 2009-06-05 17:57 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Testcase attached (345 bytes, text/html)
2005-07-05 11:18 UTC, Tommi Tervo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Gabrielson 2003-03-19 02:12:26 UTC
Version:            (using KDE KDE 3.1)
Installed from:    Mandrake RPMs
OS:          Linux

The following javascript causes an endless string on javascript alerts which quickly crashes konqueror.
This is probably actually 2 bugs.  One being the infinite alerts that keep stealing focus so you can't
close the window (maybe limit the max number of alerts).  The second is that location.href is not updated
correctly onunload, so instead of going to the new location as intended, it just instantly refreshes.

<html>
<head>
<script>
        var url = 'http://www.yahoo.com';

function setNewUrl(){
    window.location.href = url;
    //window.location.replace(url);
    alert(window.location.href);
}
</script>
</head>
<body onunload="setNewUrl();">
<a href="#" onclick="url='http://www.yahoo.com/';return false;">update url</a>
Comment 1 Tommi Tervo 2005-07-05 11:18:17 UTC
Created attachment 11680 [details]
Testcase attached

Cannot reproduce (trunk 431768 and 3.4.1)
Comment 2 Tommi Tervo 2005-07-05 11:27:32 UTC
Argh, actually it's easy to reproduce.

#6  0x00000040 in ?? ()
#7  0x043348c9 in QApplication::internalNotify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#8  0x04334a5a in QApplication::notify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#9  0x0097e12c in KApplication::notify (this=0xbff38a80, receiver=0x9a07810, 
    event=0xbff369c0) at kapplication.cpp:549
#10 0x04328c3e in QEventLoop::activateTimers ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#11 0x042e4c1e in QEventLoop::processEvents ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#12 0x04349ef5 in QEventLoop::enterLoop ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#13 0x04333af1 in QApplication::enter_loop ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#14 0x04514170 in QDialog::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#15 0x00f0bb5c in KMessageBox::createKMessageBox (dialog=0x9a076e8, 
    icon=<incomplete type>, text=@0xbff36f80, strlist=@0xbff36e40, 
    ask=@0x47f1780, checkboxReturn=0x0, options=1, details=@0x47f1780, 
    notifyType=Critical) at kmessagebox.cpp:309
#16 0x00f0b2c9 in KMessageBox::createKMessageBox (dialog=0x9a076e8, 
    icon=Critical, text=@0xbff36f80, strlist=@0xbff36e40, ask=@0x47f1780, 
    checkboxReturn=0x0, options=1, details=@0x47f1780) at kmessagebox.cpp:145
#17 0x00f0d356 in KMessageBox::errorListWId (parent_id=44078782, 
    text=@0xbff36f80, strlist=@0xbff36e40, caption=@0xbff36fe0, options=1)
    at kmessagebox.cpp:772
#18 0x00f0d0fb in KMessageBox::error (parent=0x9a67678, text=@0xbff36f80, 
    caption=@0xbff36fe0, options=1) at kmessagebox.cpp:737
#19 0x07b9a49f in KJS::WindowFunc::tryCall (this=0x978bc58, exec=0xbff373c0, 
    thisObj=@0xbff37190, args=@0xbff371e0) at kjs_window.cpp:1504
#20 0x07b43671 in KJS::DOMFunction::call (this=0x978bc58, exec=0xbff373c0, 
    thisObj=@0xbff37190, args=@0xbff371e0) at kjs_binding.cpp:107
#21 0x0733f24c in KJS::Object::call (this=0xbff371c0, exec=0xbff373c0, 
    thisObj=@0xbff37190, args=@0xbff371e0) at object.cpp:70
#22 0x07303934 in KJS::FunctionCallNode::evaluate (this=0x956e128, 
    exec=0xbff373c0) at nodes.cpp:870
#23 0x07308f4e in KJS::ExprStatementNode::execute (this=0x9534748, 
    exec=0xbff373c0) at nodes.cpp:1969
#24 0x0730f4dc in KJS::SourceElementsNode::execute (this=0x956d780, 
    exec=0xbff373c0) at nodes.cpp:3091
#25 0x07308da6 in KJS::BlockNode::execute (this=0x9a11ae0, exec=0xbff373c0)
    at nodes.cpp:1931
Comment 3 Maksim Orlovich 2005-11-13 18:40:31 UTC
The refresh is because we handled href="#" improperly. Now we fixed that, and do The Right Thing(tm) --- nothing. however, reload does trigger the chain of alerts. fun
Comment 4 Maksim Orlovich 2005-11-13 18:52:42 UTC
OK, I mostly understand what's happening, but it'll be very hard to fix :-(. might be a 4.0 item and not 3.5.1 :-(
Comment 5 Maksim Orlovich 2005-11-13 19:25:06 UTC
bug #74569 is partly underlied by the same issue
Comment 6 Maksim Orlovich 2005-11-13 21:38:18 UTC
*** Bug 105873 has been marked as a duplicate of this bug. ***
Comment 7 Michael Leupold 2008-04-06 06:14:39 UTC
Confirmed in trunk r793971. At least parts of this bug are still present. Maybe it should be renamed to make it match the problem behaviour?
Comment 8 George Goldberg 2008-04-06 06:51:41 UTC
can reproduce with svn trunk r793457.
Comment 9 Dario Andres 2009-01-04 22:04:13 UTC
Here using:

Qt: 4.4.3 + qt-copy-patches-889120
KDE: 4.1.87 (KDE 4.1.87 (KDE 4.2 >= 20090101))
kdelibs svn rev. 905636 / kdebase svn rev. 905636
on ArchLinux x86_64 - Kernel 2.6.27.10

The behaviour is the same in Konq4.2 as in Firefox3, clicking in the link does nothing (no redirection, no location bar changes, no unlimited alerts). Anyone else can confirm this ?
Comment 10 Jonas Vejlin 2009-04-25 13:56:42 UTC
Yes I can confirm the same thing as #9 running kde 3.5 in debian lenny
Comment 11 Jonas Vejlin 2009-04-25 14:06:03 UTC
and it is  kde 3.5.9/3.5.10
Comment 12 Dario Andres 2009-06-05 15:10:34 UTC
Updating status:

Qt: 4.5.1 (qt-copy  971295)
KDE: 4.2.88 (KDE 4.2.88 (KDE 4.3 >= 20090527))
kdelibs svn rev. 975695 / kdebase svn rev. 975695
on ArchLinux i686 - Kernel 2.6.29.4

Behaviour is still the same as comment 9.
Comment 13 Anselmo L. S. Melo (anselmolsm) 2009-06-05 16:28:36 UTC
Same behavior of comment #9 here. 

KDE Version: 4.2.88 (KDE 4.2.88 (KDE 4.3 >= 20090527))
Qt Version: 4.5.1
Gentoo Linux 2.6.29-tuxonice-r1 i686
Comment 14 Dario Andres 2009-06-05 17:57:16 UTC
Marking as WORKSFORME