2.1.16 [ECMA-262/7] Section 13.7.5.12 Runtime Semantics: ForIn/OfHeadEvaluation ( TDZnames, expr, iterationKind)

V0208: ForIn/OfHeadEvaluation does not return an AbruptCompletion when exprValue.[[value]] is null or undefined

The specification states:

 13.7.5.12 Runtime Semantics: ForIn/OfHeadEvaluation ( TDZnames, expr, iterationKind)
  
     The abstract operation ForIn/OfHeadEvaluation is called with arguments TDZnames, 
     expr, and iterationKind. The value of iterationKind is either enumerate, iterate, or 
     async-iterate [prior to 2018, "enumerate or iterate"].
         ...
         6.  If iterationKind is enumerate, then
             a. If exprValue [prior to 2018, "exprValue.[[value]]"] is undefined or null, 
             then
                i.   Return Completion{[[type]]: break, [[value]]: empty, [[target]]: 
                empty}.
             b. Let obj be ! ToObject(exprValue).
             c. Return ? EnumerateObjectProperties(obj).
         7.  Else,
             a.  Assert: iterationKind is iterate.
             ...
             ... Return ? GetIterator(exprValue, ...).

EdgeHTML Mode

Logic in the If branch is also executed in the Else branch:

    7.  Else,

        -. If  exprValue [prior to 2018, "exprValue.[[value]]"] is undefined or null, then

           i.   Return Completion{[[type]]: break, [[value]]: empty, [[target]]: empty}.

        a.  Assert: iterationKind is iterate.

        ... Return ? GetIterator(exprValue).

Therefore ForIn/OfHeadEvaluation does not return an abrupt completion for iterationKind is iterate when exprValue {prior to 2018, exprvalue.[[value]] is null or undefined. For example, the following statements do not throw errors:

    for (let x of null) {}

    for (let x of undefined) {}