Commit Graph
94 Commits
Author SHA1 Message Date
dotCooCoo cac93ca107 Merge main into feat/js-es2015-modules 2026-11-28 20:44:06 -08:00
dotCooCoo 3e2a615aee Merge main into feat/js-es2015-modules 2026-11-28 19:45:10 -08:00
.CooCoo a3485952ce Merge pull request #10023 from dotCooCoo/fix/js-eval-new-target-super
Scripts: direct eval inside a method or derived constructor reads super
2026-11-28 19:38:45 -08:00
dotCooCoo 8a269c4ce8 Scripts: direct eval inside a method or derived constructor reads super
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.
2026-11-28 17:34:04 -08:00
dotCooCoo e7bf7b789f Scripts: Map, Set and typed array constructors read their argument through its iterator
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.
2026-11-28 16:51:11 -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
.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
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 31163418ed Merge main into fix/symbol-registry-budget 2026-11-28 01:38:44 -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 fb29b84fff Merge main into fix/symbol-registry-budget 2026-11-28 00:41:46 -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 48188c3b8e Merge main into fix/symbol-registry-budget 2026-11-27 23:34:11 -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 f56fcd99f6 Merge main into feat/scripts-reflection 2026-11-27 22:13:50 -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 0669a4525a Merge main into feat/scripts-xmp-objects 2026-11-26 15:20:19 -08:00
dotCooCoo 051781e23d Merge main into feat/scripts-xmp-objects
Keep XMP file buffers in native state and release them at the file run boundary. Count registered namespaces and expanded metadata against the heap limit. Reset marked readers after updates and allow failed library setup to retry.
2026-11-26 13:13:53 -08:00
dotCooCoo bb3ceb56b8 Charge Symbol registry hashing and correct key buffer reservations 2026-11-26 10:57:43 -08:00
dotCooCoo dd2e92f4ec Merge main into feat/js-es2015-generators
Promise jobs resume generator callbacks. Promise.resolve and Promise.reject reject direct and bound generator functions as constructors.
2026-11-26 09:54:27 -08:00
dotCooCoo c5f04da224 Merge main into feat/js-es2015-modules 2026-11-26 08:38:03 -08:00
BFlat 2f4cceb462 Merge pull request #9074 from dotCooCoo/feat/js-promise-job-queue
Scripts: .js scripts have Promise and run its jobs before the run ends
2026-11-26 19:32:14 +07:00
BFlat cb7bdfd0f4 Merge pull request #9306 from dotCooCoo/fix/js-global-boolean
JavaScript: scripts have the global Boolean constructor
2026-11-26 16:49:49 +07:00
dotCooCoo c8f0a77e20 Merge main into feat/js-es2015-modules 2026-11-26 00:35:53 -08:00
dotCooCoo 2909471ebc Merge main into feat/scripts-api-d7a-variables 2026-11-25 23:38:36 -08:00
dotCooCoo 9aca0e1215 Merge main into feat/js-es2015-modules 2026-11-25 22:13:03 -08:00
dotCooCoo 2fc172e69a Merge main into feat/scripts-xmp-objects 2026-11-25 22:11:49 -08:00
dotCooCoo ae8c902401 Merge main into feat/js-promise-job-queue 2026-11-25 21:19:42 -08:00
dotCooCoo 48357310ad Merge feat/scripts-scriptui-dialogs into feat/scripts-scriptui-resources 2026-11-25 20:43:55 -08:00
dotCooCoo f525279b27 Merge main into feat/scripts-scriptui-dialogs 2026-11-25 18:42:43 -08:00
dotCooCoo 192a041ec8 Merge main into feat/js-es2015-generators 2026-11-25 18:09:25 -08:00
dotCooCoo e593f0c7cc Merge main into feat/scripts-reflection 2026-11-25 13:37:34 -08:00
dotCooCoo 948ebd6adb Merge main into feat/scripts-api-d1a-app-documents 2026-11-25 10:21:51 -08:00
dotCooCoo e116212318 Merge main into fix/js-global-boolean 2026-11-25 10:17:04 -08:00
dotCooCoo 3ede7a59f4 Merge main into feat/scripts-scriptui-dialogs 2026-11-25 09:17:07 -08:00
dotCooCoo 18118db9c7 Merge main into feat/js-es2015-generators 2026-11-25 09:11:32 -08:00
.CooCoo d51c4b92fb Scripts: .js object literals take methods and __proto__, and functions get names (#9138) 2026-11-25 19:25:17 +07:00
dotCooCoo 290da5bef2 JavaScript: scripts have the global Boolean constructor
The engine built Boolean.prototype but defined no global Boolean, so
Boolean(x), new Boolean(x), x instanceof Boolean and filter(Boolean)
threw a ReferenceError. Boolean now converts a value when called and
makes a Boolean object with new (ECMA-262 5.1 sections 15.6.1 and
15.6.2), with Boolean.prototype as its prototype.

test262 no longer skips tests that name Boolean, so more of them run;
docs/target-app-parity.md has the new counts.
2026-11-25 03:38:31 -08:00
dotCooCoo 1f1c8ccf8c Merge main into feat/scripts-api-d1a-app-documents 2026-11-24 20:48:43 -08:00
dotCooCoo aa8c9b8d36 Scripts: ScriptUI builds windows and controls from resource strings
new Window() and add() threw that resource specifications were not
available yet. They now read a resource specification in place of the
type, as
https://extendscript.docsforadobe.dev/user-interface-tools/resource-specifications/
describes it: a type, then braces holding `name: value` properties,
where `name: Class { ... }` defines a control.

- `crates/js/src/scriptui_resource.rs` reads `[name:] Type { ... }`.
  A value is null, true, false, a quoted string, a number, an inline
  array or an inline object. The commas between properties may be left
  out, as in the page's own example. A malformed specification throws a
  SyntaxError. One longer than 1 MiB or nested more than 64 deep throws
  a RangeError; these limits are VectorCraft's own.
- With a resource specification, new Window() and add() read no other
  argument. `properties` gives the creation properties. Each control in
  the braces is added through add(), with its limits of 512 controls
  nested 16 deep, and set as the container's property of its name. A
  list's `items` gives its item texts, as add()'s third argument does.
  Each other value is assigned to the property of its name. Palettes and
  windows still throw that they are not available yet.
- The script.run params text, docs/mcp.md and the Scripts line in
  docs/target-app-parity.md describe resource specifications.
2026-11-24 17:29:22 -08:00
dotCooCoo 4728893389 Merge main into feat/js-es2015-modules 2026-11-24 15:28:22 -08:00
dotCooCoo a0e2aa6c19 Merge main into feat/scripts-scriptui-dialogs 2026-11-24 09:22:14 -08:00
BFlat 11a26acb0b Merge pull request #9109 from dotCooCoo/feat/js-es2020-optional-chaining-nullish
Scripts: .js scripts read optional chains and the ?? operator
2026-11-24 16:09:45 +07:00
BFlat 7696b503e6 Merge pull request #9079 from dotCooCoo/feat/js-es2015-block-arrow-template
Scripts: .js scripts run let, const, arrows, templates, default and rest parameters and spread
2026-11-24 16:06:07 +07:00
dotCooCoo 4cfa6a8434 JavaScript: module namespaces, global deletes and module loading follow ES2015
- A read or write that reaches a module namespace through a prototype
  chain checks the export's temporal dead zone and refuses the write;
  for-in over a namespace lists its keys without reading the exports.
- `delete this.x` and a delete inside `with` remove only the property,
  so a later `let x` is still a SyntaxError.
- An arrow function's `length` is configurable.
- `let [` cannot start the body of if, else, while, for or a label.
- A specifier with an unpaired surrogate parses; the loader refuses it
  before reading any file.
- Each module's code counts against the heap from when it loads, and
  export lookups use an index instead of copying export lists.
- A module reached again through another path is not read or counted
  against the 32 MiB source limit again, its relative imports are read
  from the folder the file is in, and on Windows two files whose names
  differ only in case in a case-sensitive folder stay two modules.
- `$.evalFile` in a module reads beside that module.
- `script.run` takes `module`, and a `.mjs` file picked on the web runs
  as a module.
- Without `es2015`, the compiler does not collect the block scopes that
  only Annex B block functions read.
- The test262 runner grades negative module tests by their phase and
  counts panics on their own.
2026-11-22 15:54:53 -08:00