Follow-up to the review of #9147 (script palettes):
- A waiting click or change that can no longer run (its control was
disabled, hidden or removed by an earlier handler) is dropped before
the open edit is settled, so it no longer commits or cancels a drag
in the active document with no handler run.
- A palette title or other getter that hides or closes the palette
while the palette is being described no longer sends that
description to the host: the host keeps the controls the palette had
when it was hidden.
- A typed text that matches the field's stored text is still given to
the script, before a click, a close or on focus loss, when another
change of that field waits, so the handler reads the typed text and
not the waiting change.
- After a palette event's run fails to begin, the app does not retry
and ask for a frame on every pass. It tries again after the next
input in the window, another palette event, or a change to the
documents' edit state, the active document or the recovery settings.
- The print test now checks that the click's handler ran after the
print jobs were canceled, and the list test only fails when the
earlier item's text changed.
Rustdoc builds each doc test as its own crate, without the workspace's
`unsafe_code = "deny"` and without a library's `#![forbid(unsafe_code)]`,
so a doc test holding an `unsafe` block passed `cargo test --doc`.
- Every library root now carries `#![doc(test(attr(forbid(unsafe_code))))]`,
or `deny` in cad, eps and metafile, which rely on the workspace lint.
- `cargo xtask layers` reports a library whose doc tests are missing the
attribute, or use `deny` where the library forbids unsafe code.
- AGENTS.md names the rule next to the `unsafe` allowlist.
The engine test now records what the palette's getter plays only after the
handler starts, and asserts that a refresh ran after the limit with the
run's own actions. The list test turns the item's text getter back into a
plain text before it replaces the items, so only the revision check
rejects the choice.
- paletteClose with another engine's palette id no longer drops that
palette's waiting events.
- A hidden palette is not described after a run or an add, so a
throwing getter on it no longer fails the run; script.palettes and
docs/mcp.md say a hidden palette lists its controls as they were.
- A check box's click rechecks the box after reading its value, so a
getter that disables it or closes the palette stops the click.
- A list's change rechecks that the list is still enabled and visible
after its item texts are read, and is dropped when a getter disabled
or hid it.
- A waiting palette event does not start its run, or ask for frames,
while the last run's print jobs wait for their answer.
- script.palette.event's help states that a change merges only after
its palette's last waiting click or close.
`export async function f() {}` stopped with "expected a declaration after
'export'", because the module parser checked only for `var`, `function`
and lexical declarations. `export default async function` read the
function as an expression bound to the default binding, so a named one
did not bind its name in the module and was not hoisted.
Both forms now parse as async function declarations, as ECMA-262 2017
section 15.2.3 (ExportDeclaration with HoistableDeclaration) gives.
Async generators stay syntax errors here, as in a plain declaration.
The export forms were missed when #9131 added async functions.
Deciding whether a block function gets an Annex B variable compared its
name with every top-level function declaration, so a script with N
top-level functions and M block functions made N x M comparisons
(1,000,000 for 1,000 of each). The names are now gathered into a set
once, the first time a block function needs them, and each block
function makes one lookup. Hoisting results are unchanged.
The scan came in with #9131.
`new` on a class that extends `AsyncFunction` or `GeneratorFunction`
threw "this built-in cannot be subclassed", because the subclass check
listed only `Function` among the function constructors. Both now take
the subclass's prototype from `new.target`, as CreateDynamicFunction
asks (ECMA-262 2017 section 19.2.1.1.1). `AsyncFunction` also parses
its source before it reads `new.target.prototype`, as `Function` and
`GeneratorFunction` already did.
The check came in with the classes support (#9094) and `AsyncFunction`
with async functions (#9131).
A block function in eval code run from a default parameter's value no
longer replaces a parameter of the same name with its variable. The
parameters are bindings between the eval code and the function's
variable environment, so the function gets no variable (Annex B.3.2.3)
and stays in its block. A name that no parameter has still gets the
variable.
The fault came with b900ea2308, which checks the environments out to
the variable environment but not the parameters' environment that a
default parameter's eval declares into.
- update() takes a waiting palette event only when the run's file access
roots reach the same files as the event's, so a handler never runs with
less access than its palette was shown with.
- A palette event is no longer delivered to a handler after its palette
was hidden and shown again, or after a capturing listener disabled or
hid the control or a group above it.
- A limit that ends a handler update() took restores the run's own
actions before the end-of-run refresh.
- A palette refresh that fails reports no unhandled rejection.
- A refused palette field text no longer replaces text typed after it.
- The script.run, script.palette.event and docs texts describe update()
delivery, list staleness after item edits, and repeating a click or
close dropped with an oversized text.
CI's test-lint step failed on with_e4x_async_before_a_double_colon_is_a_qualified_name:
both of its assertions only checked is_ok. The test now runs x.async::b with async
bound to a Namespace and asserts that it selects the namespaced child.
- AsyncFunction.prototype has Symbol.toStringTag "AsyncFunction",
configurable only.
- await checks the room for the awaited promise's reaction or job and
the suspended frame's bytes before it attaches the reaction, so a
suspension stays within the heap limit.
- An async function's return pops its frame before resolving its
promise, so a then getter on the returned value runs without it.
Returning the function's own promise rejects it at the return.
- Block functions whose variable was not declared are kept in a hash
set, so each block function's lookup takes constant time.
- A shorthand await in an object pattern of an async arrow function's
head is a syntax error, and the head accepts patterns with defaults
such as async ({a = 1}) => a. async({a = 1}) without an arrow is
still a syntax error.
- docs: .jsx files and source strings run with module: true have
Promise and the async syntax; await is an identifier only in script
code.
Object.defineProperties, Object.create, seal and freeze read an ordinary
object's own names in ECMAScript order (array indices ascending first) in
an ES2015 run, through proxies without an ownKeys trap too; without the
option they keep the order for-in visits.
concat reads Symbol.isConcatSpreadable and with scopes read
Symbol.unscopables only in an ES2015 run, so a Symbol set by an earlier
run does not change code run without the option.
Tests: the host-function proxy refusal checks the throw and that neither
the host function nor the trap ran; the bound-constructor test sets the
custom prototype before constructing.
A getPrototypeOf trap may return the same proxy again. Its second visit
replaced the positions the first visit recorded, so a name only the first
ownKeys call returned was never visited. Each visit now adds its new
positions to the proxy's record, each pair counted once against the heap
limit, and the records are sorted and compacted once after the walk.
A for-in loop asks only the proxies whose ownKeys trap listed a name for
its descriptor. When a getPrototypeOf trap returned a new proxy of the
same target on each call, the proxy met before each name was not the one
that listed it, so the name was skipped. The loop now records, for each
proxy, the proxy its prototype lookup returned, and a new proxy of that
same target in its place answers for it. Proxies that list nothing are
recorded too, so another proxy of their target does not answer for them,
and the listing proxies stay rooted until the iterator holds them.
Follows #10185.
- A `with` scope reads `Symbol.unscopables` after it finds a name, through
a proxy's `get` trap, and skips the binding when that object's property
for the name is truthy.
- `concat` reads `Symbol.isConcatSpreadable`, through proxy traps; a
defined value decides whether the object is spread.
- `Object.keys` and `Object.getOwnPropertyNames` keep the target's order
through empty-handler proxies.
- `%TypedArray%.from` and `of` construct through a proxy constructor and
check that the result is a typed array long enough.
- `reflect.find` reads the reflection object and its lists with ordinary
[[GetOwnProperty]], so a proxy receiver throws a TypeError without its
getOwnPropertyDescriptor trap running.
- `JSON.stringify` charges each distinct name a replacer array keeps for
the length of the call, instead of reserving bytes for the whole length,
so a long sparse replacer list no longer hits the heap limit.
- A test checks that an outer proxy reads an inner proxy target's
descriptors in its trap's combined order of names and Symbols.