Finally block can change context.result's value resulting in wrong behavior with returns in functions

RESOLVED FIXED

Status

Other Applications
Narcissus
--
major
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Amjad Masad, Unassigned)

Tracking

Trunk
x86_64
Mac OS X

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
Examples:

(function () {
  try {
    return 1;
  } finally {
    2; 
  }
})(); // expected: 1, actual: 2

(function () {
  try {
    throw 'x';
  } catch (e) {
    return 'error';
  } finally {
    'no just kidding';
  }
})(); // expected 'error', actual: 'no just kidding'.

I'll be sending a simple fix (maybe considered hack, but it works!) pull request on github.
https://github.com/mozilla/narcissus/commit/fac0ed5a07c8565c80d0b91ea05c8faa49921da7
Status: UNCONFIRMED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.