New issue
Advanced search Search tips
Starred by 4 users

Issue metadata

Status: Duplicate
Merged: issue 2529
Owner: ----
Closed: Feb 2013
HW: ----
NextAction: ----
OS: ----
Priority: ----
Type: ----

Sign in to add a comment

Issue 2446: try-finally should return try's completion value if finally returned normally

Reported by, Dec 6 2012

Issue description

Steps to reproduce:

Test case:
try{ "try-value" }finally{ "finally-value" }

Expected results:

Per [ES5.1, 12.14 The try Statement], the code should return "try-value", but V8, JSC, IE and Spidermonkey return "finally-value". Opera does return "try-value".

Comment 1 by, Feb 6 2013

Note also that the letter of ES5.1 12.14 suggests that if the finally block returns non-normally, it is the result of the finally block that should be returned. So:

while(true) { try{ "try-value" } finally { "finally-value" ; break } }

... should return "finally-value". V8 and SpiderMonkey return "finally-value" here, while Opera returns "try-value".

Comment 2 by, Feb 6 2013

Opera apparently never returns a completion value from a finally block, that's why they return "try-value" in the first example. Maybe [1] will bring more consistent results across browsers in the future. More tests can be found at [2].


Comment 3 by, Feb 8 2013

Mergedinto: 2529
Status: Duplicate

Sign in to add a comment