17 Error Handling and Language Extensions
An implementation must report most errors at the time the relevant ECMAScript language construct is evaluated. An early error is an error that can be detected and reported prior to the evaluation of any construct in the
eval is called and prevent evaluation of the eval code. All errors that are not
An implementation must report as an
An implementation shall not treat other kinds of errors as
An implementation shall report all errors as specified, except for the following:
Except as restricted in
17.1, a hostor implementation may extend Scriptsyntax, Modulesyntax, and regular expression pattern or flag syntax. To permit this, all operations (such as calling
eval, using a regular expression literal, or using the Function or RegExp
constructor) that are allowed to throw SyntaxErrorare permitted to exhibit host-definedbehaviour instead of throwing SyntaxErrorwhen they encounter a host-definedextension to the script syntax or regular expression pattern or flag syntax.
Except as restricted in
17.1, a hostor implementation may provide additional types, values, objects, properties, and functions beyond those described in this specification. This may cause constructs (such as looking up a variable in the global scope) to have host-definedbehaviour instead of throwing an error (such as ReferenceError).
17.1 Forbidden Extensions
An implementation must not extend this specification in the following ways:
function objectsdefined using syntactic constructorsin strict mode codemust not be created with own properties named "caller"or "arguments". Such own properties also must not be created for function objectsdefined using an ArrowFunction, MethodDefinition, GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or AsyncArrowFunctionregardless of whether the definition is contained in strict mode code. Built-in functions, strict functionscreated using the Function constructor, generator functions created using the Generator constructor, async functions created using the AsyncFunction constructor, and functions created using the
bindmethod also must not be created with such own properties.
If an implementation extends any
function objectwith an own property named "caller"the value of that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict functionobject. If it is an accessor property, the function that is the value of the property's [[Get]] attribute must never return a strict functionwhen called.
Neither mapped nor unmapped arguments objects may be created with an own property named
The behaviour of built-in methods which are specified in ECMA-402, such as those named
toLocaleString, must not be extended except as specified in ECMA-402.
The RegExp pattern grammars in
22.2.1and B.1.2must not be extended to recognize any of the source characters A-Z or a-z as IdentityEscapewhen the [UnicodeMode] grammar parameter is present. [+UnicodeMode]
The Syntactic Grammar must not be extended in any manner that allows the token
:to immediately follow source text that is matched by the
strict mode code, an implementation must not relax the early errorrules of 22.214.171.124.
TemplateEscapeSequencemust not be extended to include LegacyOctalEscapeSequenceor NonOctalDecimalEscapeSequenceas defined in 12.9.4.
strict mode code, the extensions defined in B.3.1, B.3.2, B.3.3, and B.3.5must not be supported.
When parsing for the
Module goal symbol, the lexical grammar extensions defined in B.1.1must not be supported.
ImportCallmust not be extended.