Closed
Bug 312138
Opened 20 years ago
Closed 20 years ago
Array.sort swallows JS exceptions (ecma_3/Array/15.4.4.11-01.js)
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: igor, Assigned: igor)
References
()
Details
(Keywords: verified1.8.1)
Attachments
(2 files, 2 obsolete files)
|
12.15 KB,
patch
|
brendan
:
review+
|
Details | Diff | Splinter Review |
|
12.10 KB,
patch
|
Details | Diff | Splinter Review |
Consider the following example:
var N = 0;
var array = [4,3,2,1];
try {
array.sort(function() {
throw ++N;
});
} catch (e) {
print("e="+e+" N="+N);
}
When executed in jsshell it prints "e=5 N=5" instead of expected "e=1 N=1" as
Array.prototype.sort implementation swallows all JS exceptions except the last
generated during sort execution.
A similar problem is with aborting too-long running script. Try to execute
[0,1,2].sort(function() { for (;;) continue; })
in the browser, it would ask to terminate the script exactly the number of times
the comparison function is called.
| Assignee | ||
Comment 1•20 years ago
|
||
The patch adds error propagation to HeapSort so it would return immediately
after a failed compare call.
Updated•20 years ago
|
Summary: Array.sort swallows JS execeptions → Array.sort swallows JS exceptions
Comment 2•20 years ago
|
||
Checking in 15.4.4.11-01.js;
/cvsroot/mozilla/js/tests/ecma_3/Array/15.4.4.11-01.js,v <-- 15.4.4.11-01.js
initial revision: 1.1
done
Flags: testcase+
Comment 3•20 years ago
|
||
Igor, are you willing to take this bug, request review on the patch, and get it checked in? That would be a help. The CVS trunk is open for 1.9alpha changes, and only one review stamp of approval is required for SpiderMonkey changes. Let me know if you'd rather someone else take this.
/be
| Assignee | ||
Comment 4•20 years ago
|
||
(In reply to comment #3)
> Igor, are you willing to take this bug, request review on the patch, and get it
> checked in?
I will ask for review some time next week or so.
Status: NEW → ASSIGNED
| Assignee | ||
Updated•20 years ago
|
Assignee: general → igor.bukanov
Status: ASSIGNED → NEW
| Assignee | ||
Updated•20 years ago
|
Status: NEW → ASSIGNED
| Assignee | ||
Comment 5•20 years ago
|
||
Attachment #199273 -
Attachment is obsolete: true
Attachment #201253 -
Flags: review?(brendan)
Comment 6•20 years ago
|
||
Comment on attachment 201253 [details] [diff] [review]
Updated fix to reflect trunk changes
I'll get to this by end of tomorrow for sure. Higher priority stuff in the short run, bear with me.
/be
| Assignee | ||
Comment 7•20 years ago
|
||
Attachment #201253 -
Attachment is obsolete: true
Attachment #203129 -
Flags: review?(brendan)
Attachment #201253 -
Flags: review?(brendan)
Comment 8•20 years ago
|
||
Comment on attachment 203129 [details] [diff] [review]
Updated fix to reflect trunk changes
No need for goto done and goto quit if those labels are affixed to return statements -- just return true or false at the goto site. r=me with that change.
/be
Attachment #203129 -
Flags: review?(brendan) → review+
| Assignee | ||
Comment 9•20 years ago
|
||
Patch with goto->return changes to reflect above comment.
| Assignee | ||
Comment 10•20 years ago
|
||
I committed the last patch
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Comment 11•20 years ago
|
||
verified fixed cvs trunk builds 2005-11-23 windows/linux
Status: RESOLVED → VERIFIED
Updated•19 years ago
|
Summary: Array.sort swallows JS exceptions → Array.sort swallows JS exceptions (ecma_3/Array/15.4.4.11-01.js)
Comment 12•19 years ago
|
||
fixed by Bug 336373 on the 1.8.1 branch.
verified fixed 1.8.1 with windows/macppc/linux 20060707
Keywords: verified1.8.1
You need to log in
before you can comment on or make changes to this bug.
Description
•