Commit Graph
363 Commits
Author SHA1 Message Date
.CooCoo acec33a9f2 Merge pull request #9082 from dotCooCoo/feat/scripts-scriptui-dialogs
Scripts: build and show ScriptUI dialogs with new Window("dialog")
2026-11-28 16:51:41 -08:00
.CooCoo 27cce03a76 Merge pull request #9989 from dotCooCoo/fix/js-arguments-names-heap
Scripts: an arguments object's map of argument names counts toward the heap limit
2026-11-28 16:07:31 -08:00
dotCooCoo 2f9621bc38 Scripts: direct eval inside a function reads its new.target
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.
2026-11-28 14:47:16 -08:00
dotCooCoo 9c0945545b Merge main into feat/scripts-scriptui-dialogs
# Conflicts:
#	crates/js/src/scriptui.rs
#	crates/js/src/scriptui_tests.rs
#	crates/ui-egui/src/script_runs.rs
2026-11-28 14:23:52 -08:00
dotCooCoo 9482a5a36f Scripts: an arguments object's map of argument names counts toward the heap limit
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.
2026-11-28 13:49:29 -08:00
.CooCoo 3212703f8c Merge pull request #9471 from dotCooCoo/fix/parser-var-scope-budget
Move var declaration names between parser scopes
2026-11-28 08:06:00 -08:00
.CooCoo c2e4966407 Merge pull request #9255 from dotCooCoo/feat/scripts-scriptui-resources
Scripts: ScriptUI builds windows and controls from resource strings
2026-11-28 08:03:55 -08:00
.CooCoo b55413a834 Merge pull request #9094 from dotCooCoo/feat/js-es2015-classes
Scripts: .js scripts define classes with extends, super and new.target
2026-11-28 08:03:33 -08:00
.CooCoo bc17f26ca0 Merge pull request #9403 from dotCooCoo/fix/promise-host-constructors
JavaScript: accept host constructors in Promise statics
2026-11-28 08:02:46 -08:00
dotCooCoo 09150f35e9 Scripts: host object handles count toward the heap limit
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.
2026-11-28 06:27:56 -08:00
dotCooCoo 95442aa792 Merge main into fix/promise-host-constructors 2026-11-28 05:32:32 -08:00
dotCooCoo 30cadc9538 Merge main into feat/scripts-scriptui-dialogs 2026-11-28 05:12:02 -08:00
dotCooCoo ab6a0d44aa Merge main into feat/scripts-scriptui-resources 2026-11-28 05:12:02 -08:00
dotCooCoo 6346157a3a Merge main into feat/js-es2015-classes 2026-11-28 05:07:36 -08:00
dotCooCoo 1d3e835927 Scripts: ScriptUI review fixes for heap-limit adds and removes, listeners, list texts, Enter, the run's questions and automation requests
- 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.
2026-11-28 02:43:06 -08:00
dotCooCoo 706a1e3285 Merge main into fix/parser-var-scope-budget 2026-11-28 02:39:22 -08:00
.CooCoo ba978a77a4 Merge pull request #9470 from dotCooCoo/fix/symbol-registry-budget
Charge Symbol registry hashing and correct key buffer reservations
2026-11-28 02:20:44 -08:00
.CooCoo 61149cc007 Merge pull request #9397 from dotCooCoo/fix/test262-promise-async-markers
Test262: match Promise async markers by argument
2026-11-28 02:20:20 -08:00
dotCooCoo 9e03c309cf Merge main into fix/parser-var-scope-budget 2026-11-28 01:38:44 -08:00
dotCooCoo 31163418ed Merge main into fix/symbol-registry-budget 2026-11-28 01:38:44 -08:00
dotCooCoo 88766dea66 Scripts: super properties are destructuring and for-of targets
`[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.
2026-11-28 01:35:28 -08:00
.CooCoo d5e41e24dc Merge pull request #9467 from dotCooCoo/fix/template-cache-code-reachability
Collect unreachable tagged-template cache entries in the same collection
2026-11-28 01:06:17 -08:00
dotCooCoo 7b1885dab9 Merge main into feat/js-es2015-classes
# Conflicts:
#	crates/js/src/interp.rs
2026-11-28 01:01:45 -08:00
dotCooCoo 3c54a02fab Merge main into fix/test262-promise-async-markers 2026-11-28 00:59:20 -08:00
dotCooCoo 45785dbb1b Merge main into fix/parser-var-scope-budget 2026-11-28 00:41:46 -08:00
dotCooCoo fb29b84fff Merge main into fix/symbol-registry-budget 2026-11-28 00:41:46 -08:00
dotCooCoo c358968590 JS: Promise statics reject host classes registered without construct
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.
2026-11-28 00:39:56 -08:00
dotCooCoo 1f6ae9841b Merge main into fix/template-cache-code-reachability 2026-11-28 00:25:34 -08:00
dotCooCoo 7317159f52 Merge main into feat/scripts-reflection 2026-11-28 00:09:37 -08:00
.CooCoo bbefa3c8e3 Merge pull request #9072 from dotCooCoo/feat/js-es2015-collections-typed-arrays
JavaScript: ES2015 realms have Map, Set, WeakMap, WeakSet and typed arrays
2026-11-27 23:55:19 -08:00
dotCooCoo e75b26cffc Merge main into feat/scripts-reflection 2026-11-27 23:38:58 -08:00
dotCooCoo 4cac1da41e Scripts: a ScriptUI button in a hidden or disabled group is not the default, and a question over the dialog holds its queued events
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.
2026-11-27 23:36:35 -08:00
dotCooCoo f94034362b Scripts: a reflection's find stays frozen in an ES2015 realm
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.
2026-11-27 23:34:40 -08:00
dotCooCoo 35aca2b9cd Merge main into fix/template-cache-code-reachability 2026-11-27 23:34:38 -08:00
dotCooCoo 513ba7b488 Merge main into fix/promise-host-constructors 2026-11-27 23:34:26 -08:00
dotCooCoo 48188c3b8e Merge main into fix/symbol-registry-budget 2026-11-27 23:34:11 -08:00
dotCooCoo 90c9d0fd69 Merge main into fix/parser-var-scope-budget 2026-11-27 23:34:08 -08:00
dotCooCoo 0a46b8e849 Scripts: script tests build with main's host classes and preset checks
main added HostClass initializers in host_tests.rs without the reflect
`info` field, a second test named
assigning_undefined_to_the_selection_throws_and_keeps_it, and type and
size checks on DocumentPreset settings.

- host_tests.rs: the six new HostClass initializers give `info`.
- The selection test for an index past the end of pageItems is renamed
  assigning_an_index_past_the_end_to_the_selection_throws_and_keeps_it.
- The preset heap tests used titles of 512 KiB and an array of 20,000
  booleans as a title, which the setter now refuses. They now reach the
  run's heap with 4,092-byte titles, and compare presets holding a
  four-number documentBleedOffsetRect with presets holding an eight-byte
  title, so each array element still counts.
2026-11-27 23:29:12 -08:00
dotCooCoo 2b2ff867a5 Scripts: class and object literal methods are named, computed methods keep their home object
The merge of main left object literal methods without a `name`, since
main named them with SetFunctionName and the branch defines them through
InitMethod. Methods and accessors defined with a home object are now
named as they are defined: after their key, with `get ` or `set ` before
an accessor's name and a Symbol's description in brackets.

- A named class's constructor takes the class's name before its methods
  are defined, so a static `name` member replaces it. An anonymous class
  takes the name it is assigned to unless a static member defines `name`.
- Computed methods and accessors in object literals have the object as
  their home object (new InitMethodKey), so `super` works in them.
- Class method keys and `super[key]` keep Symbol keys instead of
  converting them to strings.
- Classes have generator methods (`*m() {}`); a generator constructor is
  a syntax error.
- docs/target-app-parity.md and docs/mcp.md describe the new behavior;
  the class line drops test262 counts measured before main added
  destructuring, generators and function names.
2026-11-27 23:02:32 -08:00
dotCooCoo 09c58a297d Merge main into feat/js-es2015-classes
# Conflicts:
#	crates/js/src/ast.rs
#	crates/js/src/bytecode.rs
#	crates/js/src/compiler.rs
#	crates/js/src/es2015_tests.rs
#	crates/js/src/interp.rs
#	crates/js/src/interp_tests.rs
#	crates/js/src/lib.rs
#	crates/js/src/parser.rs
#	crates/js/tests/test262.rs
#	docs/mcp.md
#	docs/target-app-parity.md
2026-11-27 22:40:21 -08:00
dotCooCoo a9799bfe9a Merge main into feat/scripts-scriptui-resources 2026-11-27 22:17:49 -08:00
dotCooCoo c201f59086 JavaScript: Map and Set take Symbol keys, and the test262 runners build with main's Symbol and ES2015 subset
main added `Value::Symbol`, a binary_octal argument to `string_to_number` and its own
ES2015_BUILT_INS and ES2015_FEATURES in the test262 runner.

- A Map or Set key compares a Symbol by identity, as SameValueZero does.
- CanonicalNumericIndexString reads a typed array property name with the ES2015 ToNumber.
- The collection and binary-data test262 runner uses ES2015_COLLECTION_BUILT_INS and
  ES2015_COLLECTION_FEATURES, writes its failures to `es2015-builtins-failures.txt` so it does
  not overwrite the ES2015 subset's `es2015-failures.txt`, and runs each test through `run_one`.
2026-11-27 22:17:32 -08:00
dotCooCoo f56fcd99f6 Merge main into feat/scripts-reflection 2026-11-27 22:13:50 -08:00
dotCooCoo f794e81014 Merge main into feat/scripts-scriptui-dialogs
# Conflicts:
#	crates/engine/src/tests.rs
#	crates/js/src/interp.rs
#	crates/js/src/lib.rs
#	crates/ui-egui/src/dialogs/script_run.rs
#	crates/ui-egui/src/script_runs.rs
2026-11-27 22:11:05 -08:00
dotCooCoo a063cad19b Merge main into feat/js-es2015-collections-typed-arrays
# Conflicts:
#	crates/js/src/builtins.rs
#	crates/js/src/heap.rs
#	crates/js/src/lib.rs
#	crates/js/tests/test262.rs
#	docs/mcp.md
#	docs/target-app-parity.md
2026-11-27 22:06:44 -08:00
dotCooCoo c97b5eac1e Merge main into feat/scripts-api-d7a-variables 2026-11-27 21:57:44 -08:00
dotCooCoo 4dc64055f4 Charge fuel before reading XMP property values 2026-11-26 21:02:34 -08:00
dotCooCoo 47dcb19bca Preserve localized XMP properties and optional argument positions 2026-11-26 20:43:11 -08:00
dotCooCoo c6f59b3594 Reject unsupported inherited RDF language without losing qualifiers 2026-11-26 19:28:52 -08:00
dotCooCoo cc2c5c770f Bound XMP metadata work and preserve packet boundaries 2026-11-26 19:15:16 -08:00