Bug 172332 - JavaScript debugger also warns about errors in try..catch blocks.
Summary: JavaScript debugger also warns about errors in try..catch blocks.
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: kjs (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-07 14:13 UTC by Diederik van der Boor
Modified: 2021-03-21 14:30 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Diederik van der Boor 2008-10-07 14:13:15 UTC
Version:           4.1.2 (KDE 4.1.2) "release 44.2" (using 4.1.2 (KDE 4.1.2) "release 44.2", KDE:KDE4:Factory:Desktop / openSUSE_10.3)
Compiler:          gcc
OS:                Linux (i686) release 2.6.22.18-0.2-default

The JavaScript debugger is activated with every JavaScript exception, even if this code is put inside a try..catch block.

This is imho a bug, the JavaScript debugger shouldn't warn with every error. For example, most ajax sites have code like try { x = new ActiveXObject(..) } which triggers the JavaScript debugger in Konqueror each time now.

Example code:

<p>test</p>
<script type="text/javascript">

try { var x = new BlaObject(); document.write("try.."); }
catch(e) { document.write("catch!"); }
</script>
<p>Done</p>

I wouldn't mind having another option to "catch all errors" somewhere, but off by default. Firebug has this option somewhere, and it has proven to be useful in the past for me. (e.g. rewrite bad code where the coder abused try..catch blocks to hide his mistakes).
Comment 1 Maksim Orlovich 2008-10-07 15:32:23 UTC
Yeah... I picked the current behavior based on my experience dealing with bug reports on websites, since it's not uncommon for them to hide problems in try/catch, but I can see how it'd be annoying in properly written code... Thanks for the feedback.
Comment 2 Diederik van der Boor 2009-05-28 22:26:22 UTC
Do you have any update on this bug?

I still experience it with KDE 4.2.3 and it's quite annoying because just about every site reports errors with "Iterator" or CreateObject().

When I disable the checkbox to report in excepions it will be on again when konqueror restarts.
Comment 3 Ricardo Graça 2010-11-12 15:03:31 UTC
This is a problem that's still present today (November 2010) on the current version which is 4.5.3. This seems to be causing an error in some javascript libraries, namely mootools 1.3. Basically it means that konqueror can't run mootools 1.3 code properly which will probably mean that some sites will start to break. It's no longer a question of reporting too many bugs, but of halting JS execution altogether.
Here is one of such problems: https://mootools.lighthouseapp.com/projects/2706/tickets/1082-error-loading-mootools-13-on-konqueror#ticket-1082-7
Comment 4 Maksim Orlovich 2010-11-12 15:26:15 UTC
Do you have an actual testcase? The debugger reporting that the exception happened has nothing to do with normal execution.
Comment 5 Maksim Orlovich 2010-11-12 16:07:48 UTC
OK, never mind that --- the actual mootools problem appears to be a regression from #239957, which is rather weird since that follows the behavior of 
the spec --- 3rd edition, 8.6.2.2, #4 ("the attributes of the property are not changed")

Simple testcase would be:
o = []; for (a in Array.prototype) o.push(a); o.join(",")
Array.prototype.slice = 42
o = []; for (a in Array.prototype) o.push(a); o.join(",")

(this shows up in the mootools 'force' method stuff, which does things like propagate Array.prototype.slice -> Array.slice)

Perhaps the DontEnum flag is excluded? I should check the 5th edition, I guess.
Comment 6 Maksim Orlovich 2010-11-12 17:01:30 UTC
Actually, never mind that. That's a Chrome bug; that doesn't happen in FF. 
The reason it works *there* is that you can delete things from Array.prototype 
(plus Array.slice is already included anyway).

Here is a good diagnostic testcase (it may be of some use to forward this info to mootools people, as the initial diagnosis is completely wrong!):
<script>
function doLog(msg) {
    var b = document.createElement("div");
    b.appendChild(document.createTextNode(msg));
    document.getElementById("log").appendChild(b);
}

function props(o) {
    var p = [];
    for (pn in o)
	p.push(pn);
    return p.join(",")
}

function test() {
    doLog("Array.slice:" + Array.slice);
    doLog("Array.prototype.slice:" + Array.prototype.slice);
    doLog("Initial array.prototype properties:" +  props(Array.prototype));
    Array.prototype.slice = 42;
    doLog("Enumerable after setting a method:" + props(Array.prototype));    
    doLog("Array.prototype.slice:" + Array.prototype.slice);    
    delete Array.prototype.slice;
    doLog("After delete:" + Array.prototype.slice);
    Array.prototype.slice = 42;
    doLog("Enumerable after adding a 42:" + props(Array.prototype));    
}

</script>
<body onload="test()">
<div id="log">

And here is output, with my notes (based on 3rd edition, 5th edition might change stuff):

--------------------
Our output (and the same for QtWebKit 4.7 --- odd!):
--------------------
Array.slice:undefined
Array.prototype.slice: function slice() { [native code] } 
Initial array.prototype properties:
Enumerable after setting a method:
Array.prototype.slice:42
After delete: function slice() { [native code] } <-- ** bug? (but hard to fix)**
Enumerable after adding a 42: <-- ** due to above **

--------------------
Output from Chrome 5:
--------------------
Array.slice:undefined
Array.prototype.slice:function slice() { [native code] }
Initial array.prototype properties:
Enumerable after setting a method:slice <-- ** bug, which helps mootools **
Array.prototype.slice:42
After delete:function slice() { [native code] } <-- ** bug **
Enumerable after adding a 42:slice


--------------------
Output from FF4 beta:
--------------------
Array.slice:function slice() { [native code] } <-- ** extension? ***
Array.prototype.slice:function slice() { [native code] }
Initial array.prototype properties:
Enumerable after setting a method:
Array.prototype.slice:42
After delete:undefined
Enumerable after adding a 42:slice
Comment 7 Justin Zobel 2021-03-21 00:24:50 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 10 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.
Comment 8 Diederik van der Boor 2021-03-21 14:30:14 UTC
I've stopped using KDE long ago (on a mac here), but I doubt the issue is still present, given how long it's ago.