Wrong behavior regarding ECMAScript-6 generators

RESOLVED DUPLICATE of bug 1147371

Status

()

Core
JavaScript Engine
RESOLVED DUPLICATE of bug 1147371
3 years ago
3 years ago

People

(Reporter: Ralf, Unassigned)

Tracking

(Blocks: 1 bug)

37 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/41.0.2272.76 Chrome/41.0.2272.76 Safari/537.36

Steps to reproduce:

Firefox Version 37.0.2
On LinuxMint 17.1 (64-bit)
For information: Same issue with "Node v0.12.2" with harmony flag enabled and Chromium 41 browser.

Hello everybody,

I think (or at least I hope) the following programm should behave different than currently been done in Firefox (for example Traceur does it right, or in slightly different syntax also Gorillascript and PHP 5.6):

=======
Program
=======

var generator = function* () {
    console.log("Open resource");
    
    try {
        yield 1;
        yield 2;
        yield 3;
        yield 4;
        yield 5;
     } finally {
        console.log("Close resource");
    }
}

for (var item of generator()) {
    console.log(item);

   if (item === 3) break;
}



Actual results:

[Incorrect output]
"Open resource"
1
2
3



Expected results:

[Correct output]
"Open resource"
1
2
3
"Close resource"
(Reporter)

Updated

3 years ago
Version: 33 Branch → 37 Branch
Blocks: 694100
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Flags: needinfo?(jorendorff)
Sorry for the delay. This is definitely a real bug, but it happens to already be on file.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 years ago
Flags: needinfo?(jorendorff)
Resolution: --- → DUPLICATE
Duplicate of bug: 1147371
You need to log in before you can comment on or make changes to this bug.