app.redraw() changes nothing, so docs/mcp.md now describes it on its own. The undo step a run
leaves is stated for documents that were open before the run and are still open after it.
main's own indexer tests already check the receiver's and the key's limits.
In a .js script, `class B extends A { m() { return eval("super.x"); } }`
and `class B extends A { constructor() { eval("super()"); } }` threw a
SyntaxError: eval code was parsed with only `new.target` allowed, never
`super` (ECMA-262 2015 section 18.2.1.1).
Each compiled code now records what `super` and `new.target` may do in
eval code it runs: the rules of its function's body, the rules of the
code around an arrow function, or the rules the eval code itself was read
with. A direct eval parses its code with the caller's rules, so
`super.name` and `super[key]` work inside a method, accessor or class
constructor, and `super(...)` works inside a derived class's
constructor, also from an arrow function or a nested eval there. A plain
function inside a method, the top of a script, an indirect eval and a
`Function` body still give a SyntaxError. `super(...)` in eval code binds
`this` once; a second call is a ReferenceError.
Two tests in es2015_tests.rs cover the allowed and SyntaxError cases and
fail without the change; a third checks that a `Function` body reads its
own `new.target`. docs/mcp.md describes the rule. Follows #9094.
new Map, new Set, new WeakMap and new WeakSet read their argument by
index (an array, a string or an object with a length), so a generator,
a Map, a Set or any other iterable was a TypeError, and an array whose
@@iterator was replaced was still read by index. They now read it
through GetIterator and close the iterator when adding an entry throws
(ECMAScript 2015, sections 23.1.1.1, 23.2.1.1, 23.3.1.1 and 23.4.1.1).
A Map or WeakMap entry that is not an object is a TypeError.
The typed array constructors and %TypedArray%.from read a source with
an @@iterator method through its iterator to the end before mapping
it, and any other source as an array-like object (sections 22.2.1.4
and 22.2.2.1).
Map.prototype[@@iterator] is entries, Set.prototype[@@iterator] is
values, %TypedArray%.prototype[@@iterator] is values, and the Map, Set
and array iterators inherit %IteratorPrototype%, so for-of and spread
walk them.
Changed behavior: an array-like object without @@iterator passed to
new Set or new Map is now a TypeError, and Uint8Array.from([1, 1], f)
with an f that changes the array maps the values read before f ran.
In a .js script, `function F() { return eval("new.target"); } new F()`
threw a SyntaxError: eval code was always parsed as if it were at the
top of a script, where `new.target` is not allowed (ECMA-262 2015
section 18.2.1.1).
A function that calls eval now keeps its new.target in the hidden
binding arrow functions already use, also when it was compiled as ES5.1.
A direct eval looks that binding up through the caller's scopes (one
unit of fuel per scope); when it finds one, the eval code may use
`new.target` and reads that value. At the top of a script, in an arrow
function there, and through an indirect eval it stays a SyntaxError.
`super` in eval code is still not supported.
A test in es2015_tests.rs covers plain, strict, arrow, nested-eval and
class-constructor callers and the three SyntaxError cases; it fails
without the change. Follows #9094.
An `arguments` object keeps a map with one entry per argument, which the heap estimate left out
at allocation and at collection, so a script that kept many of them could grow past the heap
limit. The object now reserves and charges the map, the collector counts it, and the call's
up-front reservation includes it (arrow functions, which make no `arguments` object, reserve
none). Same accounting as #9928 gave host object handles.
Each object of a host class keeps its handle twice, once in its slot and
once in the realm's index of the objects scripts hold, but creating one
reserved only the object's own bytes, and the collector's live-byte total
left the handle out. A host value with a long handle could therefore grow
the heap past the script's limit.
The object now reserves its handle's bytes before it is made, and the
collector counts them for every live object. Tests cover a handle larger
than the remaining budget and the bytes 100 retained objects add.
- Adding a control or an item, and removing items, builds both arrays
before the first write, so a run that ends at the heap limit leaves the
lists and the dialog's counts as they were.
- A listener registered after an event started does not hear it in a later
phase, a capturing container's re-registration included.
- show() reads the dialog again when a getter changes a list item's text
after the item was read.
- Enter and Escape skip an OK or Cancel button inside a hidden or disabled
container.
- A resource string of a name and a type without braces throws a
SyntaxError, and a \u escape pair of surrogates reads as one character.
- In the app, queued events wait while another dialog is open over the
script's dialog, and the run's own questions wait while a popup, such as
an open drop-down list, is over it. ui.dialog.confirm and
ui.dialog.cancel take only the dialog, ui.dialog.set needs a field or an
action and answers with the dialog it set, and OK is refused while a
dialog open over it waits. A cancel after typed text clicks the cancel
button the dialog has when its turn comes, and an immediate cancel the
run refuses is an error.
- A click on a list box row gives the list the keyboard focus.
- The vc hint test names BridgeTalk, since Window now exists; the params
text and docs/mcp.md say that a show() in a handler notify runs throws
only in the app, and define_script_ui says when end is not called.
`[super.x] = [1]`, `({ a: super.a } = o)` and `for (super.x of xs)` were
syntax errors. The branch made super properties assignment targets in
`check_target`, but destructuring and for-of check their targets with
`check_simple_target` (from main's destructuring), which still rejected
them. The compiler already writes to super properties on both paths.
A host class registered with construct: None still has a constructor
function that throws when called, so Promise.resolve and the other
statics accepted it as a constructor. The class entry now records
whether a construct function was supplied, and the statics check that.
`new` on such a class still throws its existing TypeError.
Enter and Escape found OK and Cancel by their own enabled and visible flags only, so an OK button inside a disabled or hidden group could become the default element and the usable OK button after it could not. A control is now usable only when every container that holds it is enabled and shown.
While a question such as the one quitting asks was open over the ScriptUI dialog, each frame still gave the run the dialog's queued events, so a queued click on OK could close the dialog before the question was answered. The events now wait until the dialog is on top again.
In a realm with the ES2015 option, the `find` function of a reflection
had configurable `length` and `name` properties, so Object.isFrozen gave
false and a script could delete or redefine them. Both are now
non-writable and non-configurable, as the reflection's other parts are.