Bug 247790

Summary: Using async function to Symbol.iterator results in infinite loop
Product: WebKit Reporter: Kanguk Lee <p51lee>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: mark.lam, webkit-bug-importer, yijia_huang, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   

Description Kanguk Lee 2022-11-11 01:24:35 PST
// input.js
var obj = {
  [ Symbol . iterator ]: async ( ) => {
      await 0 ;
      while ( true ) ;
  }
}

for ( { } of obj );
______________________________

Hello,

Executing the input.js using JSC, it throws TypeError but never terminates.

Running the input.js with JSC results in:

---
$ jsc input.js
Exception: TypeError: undefined is not a function (near '...{ } of obj...')
global code@input.js:8:10

// infinite loop

---


WebKit version: 615.1.10
Comment 1 Radar WebKit Bug Importer 2022-11-14 08:15:52 PST
<rdar://problem/102321717>
Comment 2 Yusuke Suzuki 2022-11-14 08:48:32 PST
This is expected. The first microtask throws an error. But it does not matter to the second microtask.