Skip to content

ES5 Strict mode semantics not fully implemented according to specification #403

@ThomasHickman

Description

@ThomasHickman

From https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf § 10.2.1 (page 232 in the pdf):

Eval code is strict mode code if it begins with a Directive Prologue that contains a Use Strict Directive or if the call to eval is a direct eval that is contained in strict mode code.

$ java -jar rhino-1.7.9-SNAPSHOT.jar
Rhino 1.7.9-SNAPSHOT 2018 03 10
js> (function() {"use strict"; var indirect_eval = eval;indirect_eval("with(this){}")})()
js: "eval code#1(eval)", line 1: uncaught JavaScript runtime exception: SyntaxError: with statements not allowed in strict mode

js: with(this){}
js: ....^

Function code that is supplied as the arguments to the built‑in Function, Generator, and AsyncFunction constructors is strict mode code if the last argument is a String that when processed is a FunctionBody that begins with a Directive Prologue that contains a Use Strict Directive.

$ java -jar rhino-1.7.9-SNAPSHOT.jar
Rhino 1.7.9-SNAPSHOT 2018 03 10
js> (function() {"use strict"; Function("with(this){}")()})()
js: "<eval'ed string>#1(Function)", line 1: uncaught JavaScript runtime exception: SyntaxError: with statements not allowed in strict mode

js: function anonymous() {with(this){}
js: ..........................^

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ecma IncompatibilityIssues about Rhino being incompatible with the EcmaScript specStrict ModeIssues related to non-compliance with the ES5 Strict Mode spec

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions