[Webkit-unassigned] [Bug 257677] New: Implementation error in ForStatement with LexicalDeclaration

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Jun 3 04:19:17 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=257677

            Bug ID: 257677
           Summary: Implementation error in ForStatement with
                    LexicalDeclaration
           Product: WebKit
           Version: Safari 16
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: webkit at hertz.moe

The POC

let cb;
for (let i = (cb = (() => i), 0); i<10;) {
  i++;
}
console.log(cb());

In chrome(V8) and engine262 we got output "0", but WebKit(JSC) we got "1", which is unexpected and completely wrong.
The spec(https://tc39.es/ecma262/#sec-forbodyevaluation) require to call CreatePerIterationEnvironment in every loop iteration, so the i++ in the loop body cannot effect the variable captured from the LexicalDeclaration, it seems jsc reuse the env in the first iteration.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230603/a1e0bb32/attachment-0001.htm>


More information about the webkit-unassigned mailing list