Commit Graph
251 Commits
Author SHA1 Message Date
BFlat fc1ac56efc Merge pull request #9465 from dotCooCoo/fix/indexer-receiver-data-limits
JavaScript: enforce data limits on host receivers and indexers
2026-11-27 05:21:37 +07:00
BFlat 8daacef7c2 Merge pull request #9394 from dotCooCoo/fix/promise-prototype-tag
JavaScript: define the Promise prototype string tag
2026-11-27 05:15:44 +07:00
dotCooCoo dfa6bae8eb Strengthen host indexer argument and shared-budget assertions 2026-11-26 10:27:23 -08:00
dotCooCoo 340a11c4ba Merge main into feat/js-es2015-generators 2026-11-26 10:27:02 -08:00
dotCooCoo 8a5efed496 Merge main into fix/promise-prototype-tag 2026-11-26 10:17:47 -08:00
dotCooCoo 18125e6cdb Merge main into fix/indexer-receiver-data-limits 2026-11-26 10:07:52 -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 72984fddaa Enforce data limits on host receivers and indexers 2026-11-26 09:53:08 -08:00
BFlat b9fe04f769 Merge pull request #9392 from dotCooCoo/fix/promise-combinator-iterators
JavaScript: Promise combinators consume iterable inputs
2026-11-27 00:52:25 +07:00
dotCooCoo 350fb2bdb3 Merge main into fix/realm-replaces-paused-run 2026-11-26 08:33:48 -08:00
dotCooCoo 714791d75f Merge main into fix/promise-combinator-iterators 2026-11-26 08:26:20 -08:00
dotCooCoo ef5404ad95 Merge main into fix/promise-prototype-tag 2026-11-26 08:22:26 -08:00
BFlat 5db6caf090 Merge pull request #9405 from dotCooCoo/fix/promise-rejection-sites
JavaScript: preserve Promise rejection relay locations
2026-11-26 23:18:48 +07:00
BFlat b65a0b1542 Merge pull request #9396 from dotCooCoo/fix/prepare-call-gc-roots
Scripts: keep nested apply operands alive during collection
2026-11-26 23:18:10 +07:00
dotCooCoo 0983b6dfd5 End paused JavaScript runs before compiling replacement source 2026-11-26 06:57:29 -08:00
dotCooCoo fc07f8a326 JavaScript: root the running rejection site code 2026-11-26 06:56:03 -08:00
dotCooCoo ff9bd64003 JavaScript: preserve Promise rejection relay locations 2026-11-26 06:53:49 -08:00
dotCooCoo 1b6bcd370a JavaScript: cache shared rejection reason attribution 2026-11-26 06:42:40 -08:00
dotCooCoo 75fd52fca6 Scripts: keep nested apply operands alive during collection 2026-11-26 06:40:33 -08:00
dotCooCoo 59ab0f6c03 JavaScript: define the Promise prototype string tag 2026-11-26 06:35:49 -08:00
dotCooCoo 59ddb9c3e2 JavaScript: consume iterators in Promise combinators 2026-11-26 06:28:05 -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 7b9726c71e Scripts: Promise statics refuse arrow functions and methods as this
The statics' constructor check now treats an arrow function, a method
and a function bound to one as non-constructors, as new does, so
Promise.resolve.call(() => {}, 1) throws a TypeError. The test262 line
in docs/target-app-parity.md now gives the count on current main: 440
of 538 runs.
2026-11-25 22:12:51 -08:00
dotCooCoo 6a72901192 Scripts: adding Promise to a realm leaves the language it reads as it was
Realm::add_es2015 no longer turns on Options::es2015, which now also
selects the ECMAScript 2015 syntax. A realm made without the option gets
Promise and still reads ES5.1 until set_es2015 changes it; the engine
calls set_es2015 for each run before it adds Promise.
2026-11-25 21:58:54 -08:00
dotCooCoo df3d7ab275 Scripts: stale page item lists throw from toString; unavailable members stop hasOwnProperty
- `toString()` on a page item list from a closed or replaced document throws
  "Stale document", as its other members do.
- A member a host class declares unavailable is not reported by
  `hasOwnProperty` or `propertyIsEnumerable` even when a parent class has it.
- Assigning a name an object of a host class inherits from a prototype no
  longer calls the class's indexer, so a non-strict assignment is ignored
  instead of throwing.
- Assigning a selection checks repeated objects with a set instead of
  scanning the list for each object.
- The script report test throws a text that names `Window` for the case of
  an error the script wrote itself.
2026-11-25 21:50:05 -08:00
dotCooCoo ae8c902401 Merge main into feat/js-promise-job-queue 2026-11-25 21:19:42 -08:00
dotCooCoo 192a041ec8 Merge main into feat/js-es2015-generators 2026-11-25 18:09:25 -08:00
dotCooCoo 895fc362e8 JavaScript: a bound function inherits from its target's prototype
With ECMAScript 2015, Function.prototype.bind gave every bound function
Function.prototype as its prototype, so a bound generator function's
constructor was Function instead of GeneratorFunction. The bound function
now takes the target's prototype, read before length and name (ECMA-262
2020 section 9.4.1.3). Without the option it keeps Function.prototype,
as ES5 section 15.3.4.5 specifies.
2026-11-25 17:58:58 -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 18118db9c7 Merge main into feat/js-es2015-generators 2026-11-25 09:11:32 -08:00
dotCooCoo 382e40dce1 JavaScript: spread tests follow the iterator protocol
Since #9138, spread steps the array's iterator, so spreading a long
array ends at the fuel limit instead of an early RangeError. Three
tests in es2015_tests.rs still expected the by-index RangeError and
failed:

- an_index_setter_without_a_getter_does_not_delay_the_spread_s_check
- a_prototype_getter_behind_an_own_element_does_not_delay_the_spread_s_check
- looking_for_index_getters_takes_fuel_for_each_property

The setter and prototype-getter tests now check the fuel limit and that
the setter or getter did not run. The test of the index-getter scan,
which #9138 removed, is deleted.

docs/target-app-parity.md had two ES2015 entries after #9138. The
by-index entry is removed; the entry that describes iterator spread
stays.
2026-11-25 04:31:45 -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
.CooCoo 8e7a6142fc JavaScript: a trailing comma ends call arguments and parameter lists (#9189) 2026-11-25 00:56:02 +07:00
.CooCoo 5f35daad7b Scripts: File and Folder give their localizedName (#9185) 2026-11-25 00:54:37 +07:00
dotCooCoo 71d1600dab Scripts: an error's authored check hashes its name and message without copying them
An error the interpreter throws keeps a hash of its description, and a run compares the error's
current name and message with it to tell whether the text is the script's own. The comparison
copied the whole description first, so a rejected error whose message a script had replaced with
a long string was copied whole at the end of the run. The hash is now fed the strings' code units
a piece at a time along the rope, so nothing is copied, and a change anywhere in the message is
still seen.
2026-11-24 06:12:42 -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 cf2c4ae3f7 Merge pull request #9187 from dotCooCoo/fix/js-dollar-stack-script-frame
Scripts: $.stack starts with a line that names the running script
2026-11-24 16:08:08 +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 ff9ed631fa Scripts: an unhandled rejection's reason is read only up to the report's length
The report keeps the first 500 characters of a rejection reason. The reason string is now read up to that length along the rope, instead of being copied whole before it is cut.
2026-11-24 00:13:32 -08:00
dotCooCoo 05d45599dd JavaScript: heap stops leave no global name, and own elements hide prototype getters
- A script's global let and const names are added only after the room
  for them and the declarations is checked, so a run that stops at the
  heap limit leaves no uninitialized name behind and the same script
  runs once the limit is raised.
- Spread of an array with a length too long for an array literal throws
  RangeError at once when every prototype getter with an index name is
  hidden by an own property of the same name earlier in the chain. The
  scan takes one unit of fuel for each earlier object it looks in, and
  stops where the fuel runs out.
- A spread test now checks the heap total right after the limit stops
  the spread, before a later step could collect, and a larger limit
  lets the same spread complete.
2026-11-24 00:13:24 -08:00
dotCooCoo b7278c9b2f Scripts: test a finally callback that returns a pending promise
The result of finally() stays pending until the callback's promise settles in a later run. A fulfilled callback promise keeps the original value or reason, and a rejected one passes on its own reason.
2026-11-24 00:05:54 -08:00
dotCooCoo 6b778a4c70 Scripts: setters refuse art in a hidden or locked layer, and empty objects read zero bounds
- Assigning hidden, locked, position, left, top, width or height to an
  object in a hidden or locked layer throws Cannot edit, as opacity
  does, and changes nothing. Its name and note still change.
- An object with nothing in it, such as an empty group or a compound
  path whose paths moved out, reads its bounds, position, width and
  height as zeros, and assigning them does nothing, so reading every
  property for-in lists does not throw on it.
- Assigning selection without app. sets the active document's
  selection, and app.selection can be assigned the same way. Assigning
  activeDocument without app. activates a document, and assigning
  documents keeps its value.
- JSON.stringify writes a collection, or data that holds one, without
  reading toJSON through the collection's name lookup, which threw
  Not found.
- The docs state that Object.keys, Object.getOwnPropertyNames and
  Object.getOwnPropertyDescriptor do not report the members, that a
  value assigned to a member the class lacks is not kept, and that the
  selection order is VectorCraft's own rule.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-23 13:24:33 -08:00
dotCooCoo 9872e6b679 Scripts: page items report their own members, and lists start with the topmost object
Scripts that check a member with hasOwnProperty before using it skipped
every page item, because the members live on the class prototype. Now
hasOwnProperty and propertyIsEnumerable are true for each member of an
object's class that is available, and for-in lists its properties but
not its methods. Members that only throw "not available yet" stay false.

- An empty selection is an empty list instead of null.
- pageItems lists art topmost first, as the CMYKColor example reads the
  frontmost path as pathItems[0]
  (https://ai-scripting.docsforadobe.dev/jsobjref/CMYKColor/). A
  document's selection lists the selected objects in that order too,
  whatever order they were picked in. That selection order is
  VectorCraft's own rule.
- A collection read with a name, such as pageItems["Logo"], gives what
  getByName gives, as
  https://ai-scripting.docsforadobe.dev/scriptingJavascript/objectReferences/
  shows. A name nothing has throws Not found, and assigning to such a
  name throws the same error.
- activeDocument, documents and selection can be named without app., as
  that page describes for the application's members.
- move() with the object itself and PLACEBEFORE or PLACEAFTER leaves it
  where it is and adds no undo step.
- move() keeps a compound path whose last path moves out, so a script
  that holds it can still read it.
- Assigning opacity to an object in a hidden or locked layer throws
  Cannot edit and changes nothing.
- name takes a number or a Boolean as its text.
- String() of an object gives its class and name, such as
  [PathItem Logo].

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-23 13:24:32 -08:00
dotCooCoo f205705617 Scripts: $.stack starts with a line that names the running script
$.stack is the current stack trace
(https://extendscript.docsforadobe.dev/extendscript-tools-features/dollar-object/).
It now starts with a line holding the run's name in square brackets, such
as `[main.jsx]`, the name the console shows for the run: the `name` given
to `script.run`, else the `#script` name, else the file's name, else
`script`. The frames follow as before. Scripts that look for a bracketed
line in the trace to find their own name, for example to name a
preferences file, now find it.

The name line comes before the `…` line that stands for frames past 64.
A realm without a name (`Realm::set_script_name(None)`) writes no such
line.

Docs: docs/mcp.md ($ object table), docs/target-app-parity.md.
2026-11-23 11:17:06 -08:00
dotCooCoo 54b9504cb5 JavaScript: a function body reserves room for its arguments object
The call reserves room for the declarations and the arguments object
before the body's let and const environment takes some of it. The body
then reserved room for its declarations again, but not for the
arguments object, so making the object could take the heap estimate
past the limit until the next check. The body now reserves both, with
the arguments size from one helper that the call also uses.
2026-11-22 17:52:55 -08:00
dotCooCoo 723e52c5ec Merge #9079 into feat/js-es2020-optional-chaining-nullish 2026-11-22 17:15:41 -08:00