Commit Graph
66 Commits
Author SHA1 Message Date
dotCooCoo b3def332ff Merge main into feat/scripts-print-printer 2026-11-30 11:40:16 -08:00
dotCooCoo 60c1eb34af Merge main into feat/scripts-print-printer 2026-11-29 14:36:49 -08:00
dotCooCoo fda48b02d0 Merge main into feat/scripts-app-select-tool 2026-11-29 10:25:17 -08:00
dotCooCoo ea99ddfa63 Merge main into fix/scriptcheck-linear-steps 2026-11-28 22:20:45 -08:00
dotCooCoo a3ccd60b5b Script check: a script whose only finding is unsure names is scanned once
A script without includes whose declarations give names values the analysis
does not read came back from its first scan with `Known::unsure` set and no
names. `settle` counted that as something known and scanned the script again,
which found the same and doubled the scan's steps. The proptest
`any_bytes_are_checked_in_linear_work` shrank one such input to 104 bytes that
took 550 steps, over its bound of 536.

`settle` now keeps the first scan when it found no bound names and no File
objects: the flag comes from the script's own declarations, which the first
scan already read.
2026-11-28 20:55:33 -08:00
dotCooCoo 30d22d07c8 Scripts: the checker scans a script that binds no name once
A script whose only finding about its variables was that a name in
brackets is not one literal (o[k]) was scanned a second time. That
finding comes from the names the script declares, which the first scan
has already read, so the second scan gave the same report and added up
to three steps a byte. A 104-byte input of single-character tokens took
550 steps against the 536 the property test allows.

The check now repeats a scan only when a variable holds a member chain
or a File or Folder object. The property tests take their bound from
the number of scans: five steps a byte for a script scanned once, and
seventeen for one scanned up to five times.
2026-11-28 20:50:13 -08:00
dotCooCoo c70974d6bd Merge main into feat/scripts-print-printer 2026-11-28 18:21:29 -08:00
dotCooCoo e449a91380 Merge main into feat/scripts-app-select-tool
# Conflicts:
#	crates/engine/src/script/dom.rs
#	crates/engine/src/tests/script_dom.rs
#	crates/engine/tests/it/script_host_vs_scriptcheck.rs
#	docs/mcp.md
#	docs/target-app-parity.md
2026-11-28 14:50:06 -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 f7afcaf45d Merge main into feat/scripts-app-select-tool 2026-11-27 22:27:49 -08:00
dotCooCoo 18af8a2761 Merge main into feat/scripts-print-printer 2026-11-27 22:14:06 -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 2909471ebc Merge main into feat/scripts-api-d7a-variables 2026-11-25 23:38:36 -08:00
dotCooCoo 0359cc0b93 Scripts: a document named in brackets counts for print's file write
The script check now reads a string literal in index brackets as the
member it names when the document chains list that member as a
property, so app['activeDocument'].print(o) and
app['documents'][0].print(o) report a file write. Other names in the
brackets, such as app['preferences'], keep the index and do not give a
document.
2026-11-25 15:21:27 -08:00
dotCooCoo e593f0c7cc Merge main into feat/scripts-reflection 2026-11-25 13:37:34 -08:00
dotCooCoo 6378d56beb Merge feat/scripts-api-d1a-app-documents into feat/scripts-app-select-tool
# Conflicts:
#	crates/js/src/builtins.rs
#	crates/js/src/interp.rs
#	docs/mcp.md
2026-11-25 10:25:39 -08:00
dotCooCoo ef2409fb31 Script checker: a Folder variable in parentheses is still a Folder object
`(d).write(s)` and `(d).length = 0` on a variable holding `new Folder(p)`
counted as file writes, while `d.write(s)` and `d.length = 0` did not.
Grouping parentheses now keep what the variable holds, so a Folder
variable in them is left out the same way. A variable that may hold a
File object still counts, and a grouped assignment (`x = (d)`) still
gives `x` a value that may be a File object.
2026-11-25 09:49:18 -08:00
dotCooCoo 77f4ec9739 Merge main into feat/scripts-app-select-tool 2026-11-25 09:28:58 -08:00
dotCooCoo 8b05d98951 Scripts: every script reads E4X and has the XML objects
The script host ran its realm with E4X off, so XML literals were syntax
errors and XML, XMLList, Namespace, QName, isXMLName and
setDefaultXMLNamespace were missing from every script, although
vectorcraft-js has them. script.run and File › Scripts now turn E4X on
for .js and .jsx files, script text, #include files, $.evalFile, eval
and Function, and for a #targetengine engine.

script.check lists the e4x and xml features under the language need
instead of hostOnly, since VectorCraft runs them.
2026-11-25 04:23:32 -08:00
dotCooCoo a5ab214898 Merge main into feat/scripts-print-printer 2026-11-25 04:15:11 -08:00
dotCooCoo e7eefa569c Script checker: File-only calls on a Folder object are not file reads, writes or dialogs
script.check counted write(), writeln(), copy(), createAlias(), open(),
read(), readch(), readln(), openDlg() and saveDlg() as file reads,
writes or dialogs on any object that may hold a File or Folder object.
A Folder object has none of these functions, so on new Folder(...), a
Folder place such as Folder.temp (other than Folder.current), or a
variable that only ever holds one, the call fails without reaching the
file system. The check now leaves those calls out, using the same rule
that already leaves out setting length, hidden or readonly on such an
object. Folder(...) without new and Folder.current may hold a File
object, so calls on them still count, and the Folder object's own
create(), remove(), rename(), getFiles() and selectDlg() still count
on every object.

Folder object functions:
https://extendscript.docsforadobe.dev/file-system-access/folder-object/
File object functions:
https://extendscript.docsforadobe.dev/file-system-access/file-object/

docs/mcp.md and the progress line in docs/target-app-parity.md state
the rule.
2026-11-25 01:01:43 -08:00
dotCooCoo 5709055a97 Scripts: the checker finds print on documents.index() and open through a variable that holds app
`documents.index()` and `app.documents.index()` now count as chains that give a
document, so `app.documents.index(0).print(o)` is listed as a file write. A
document method named in brackets (`app.documents['index'](0)`) gives a document
as its dotted form does.

`app.open(f)` is found from the member chain, so `var a = app; a.open(f)` reads a
file, while `x.app.open(f)` and an `app` the script declares still do not.

Member chains hold at least 64 characters while they are read, and the report
cuts the listed chains to the echo limit, so a short echo limit no longer hides
these calls.
2026-11-24 23:59:59 -08:00
dotCooCoo 24d91e2acf Script checker: app.selectTool counts as the document model, not a feature only the reference app has 2026-11-24 22:31:57 -08:00
dotCooCoo ddac94f4e7 Merge main into feat/scripts-print-printer 2026-11-24 16:52:50 -08:00
.CooCoo 8e7a6142fc JavaScript: a trailing comma ends call arguments and parameter lists (#9189) 2026-11-25 00:56:02 +07:00
dotCooCoo cf30177ba8 Merge main into feat/scripts-print-printer 2026-11-23 11:10:17 -08:00
dotCooCoo 9887590169 Merge main into feat/scripts-api-d7a-variables 2026-11-23 11:07:37 -08:00
dotCooCoo a149f93392 Script checker: code the check can't read keeps a Folder's length, hidden and readonly setters
The check leaves out `length`, `hidden` and `readonly` set on `new
Folder(...)`, a `Folder` place, or a variable holding one, but a script
can give that name a File object in ways the check does not read. Such a
setter now counts as a file write in a check whose files:

- use `with`, or name `eval`, `Function`, `evalFile` or `constructor`,
  as a word or as a string literal in brackets (`this['eval'](s)`,
  `$['evalFile'](f)`, `(function () {}).constructor(s)`)
- read, call or assign a property in brackets when the brackets hold
  anything but one string or number literal (`this[k](s)`,
  `this['ev' + 'al'](s)`, `this[('eval')](s)`, `this[0, 'eval'](s)`,
  `$[k](f)`, `g[k] = ...`), including a preprocessor line inside the
  brackets
- assign a property in brackets whose name is a string literal longer
  than 256 characters, or properties of more than 1,000 names
- assign or declare `Folder`

A variable whose name a member assignment writes (`$.global.d = ...`,
`this.d = ...`, `this['d'] = ...`) counts as one that may hold a File
object. Array literals, `o['plain']` and `a[0]` leave the Folder alone.

docs/mcp.md and the progress line in docs/target-app-parity.md state the
rule.
2026-11-23 09:54:50 -08:00
dotCooCoo a704798119 Scripts: printer jobs count pages from the art as it prints, and app['open'] gives a document
- Document.print to a printer no longer counts pages with print.preview,
  which leaves out artboard backgrounds and placed files. It passes
  file.print a new maxPages param: file.print counts the pages of the art
  it prints and composes nothing when the job has more, answering
  {pages, format}. An artboard that holds only its background now prints
  with skipBlank, and a job turned away by the sheet limit is not
  composed. When the pages follow from the artboards alone, the count is
  checked before Print as Bitmap or a flattener preset prepares the art,
  after the level and the flattener preset are checked.
- The printers a run lists keep the system's default printer when it
  comes after the first 256 (it takes the last place), and a repeated
  name keeps a later default mark without a second entry.
- The script checker reads app['open'](f) as giving a document, as
  app.open(f) does, so a print of the variable that holds it counts as a
  file write.
- The print job test checks the artwork in each prepared job, not only
  that the two jobs differ.

Docs: docs/mcp.md (maxPages, the page count, the default printer),
docs/roadmap.md M13 row.
2026-11-22 02:39:54 -08:00
dotCooCoo 619ccb2a34 Merge feat/scripts-api-d10-print-options into feat/scripts-print-printer 2026-11-22 01:08:19 -08:00
dotCooCoo a7beba792d Scripts: the script checker reports app.open as reading a file
app.open(f) and app['open'](f) now count as file.read in the checker's
features, as the script host's app.open reads the file it is given. A
document has no open method, and a property or a variable named app is
not the application object, so those calls stay unreported.
2026-11-22 00:20:44 -08:00
dotCooCoo b19d017c31 JavaScript: Map, Set, WeakMap, WeakSet and typed arrays in ES2015 realms
A realm with Options::es2015 now has Map, Set, WeakMap and WeakSet, and
ArrayBuffer, DataView and the nine typed arrays from Int8Array to
Float64Array with %TypedArray%.from, of and the prototype methods
(ECMA-262 6th edition, sections 22.2 to 24.2). A realm without the
option, the ExtendScript realm included, has none of these names.

- Map and Set compare keys with SameValueZero and keep insertion order.
  forEach and iterators skip entries deleted before they reach them and
  visit entries added during the walk; the collector removes holes and
  moves live iterators.
- WeakMap and WeakSet hold their keys weakly. The collector marks a
  WeakMap value only once its key is reachable another way and drops the
  entries of unreachable keys, also when a value refers to its key.
- Typed arrays store elements little-endian; DataView is big-endian
  unless littleEndian is true. Numeric property names are elements or
  nothing, with the element descriptors of later editions. Copies to the
  same element type keep every bit.
- An ArrayBuffer longer than 2^32 - 1 bytes or than the heap limit is a
  RangeError before anything is allocated, and every element a method
  visits takes fuel.
- Until the language has iterators, the collection constructors and
  %TypedArray%.from read an array, a string by code point or an object
  with a length, by index. A typed array constructor reads an array or
  an object with a length the same way, and converts a first argument
  that is not an object to a length.
- The %TypedArray%.prototype methods that share an Array method use the
  element count, and an Array method called on a typed array reads its
  length property. Array methods visit every element of a typed array
  longer than 4,096.
- Check Script counts new of these constructors as the language's.

test262 runs the Map, Set, WeakMap, WeakSet, ArrayBuffer, DataView,
TypedArray and TypedArrayConstructors folders in ES2015 realms.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-21 22:56:22 -08:00
dotCooCoo 141dc48e1a Scripts: addDocument and addDocumentNoUI count for print, docs name the preset base
The script checker reports `print` on a document that `documents.addDocument()`
or `documents.addDocumentNoUI()` returns, with or without `app.`, as a file
write, as it does for `documents.add()`. Both methods return a Document on the
Documents help page.

docs/mcp.md and the print module's notes say that with `printPreset` assigned,
`print` starts from the preset's settings: an assigned `artboardRange` replaces
that range, and an unassigned scale factor keeps the preset's value.
2026-11-21 22:25:50 -08:00
dotCooCoo 42409dc6ee Merge main into feat/scripts-api-d10-print-options
# Conflicts:
#	docs/mcp.md
2026-11-21 21:16:24 -08:00
dotCooCoo b2d458f667 Scripts: print lists in the host name check, applies range and print area over saved settings
- The host name check lists Document.print as a file write, and app's
  print lists, PrintOptions, its option classes and the printing
  enumerations as names that stay inside the run.
- The script checker reports a file write for print called on a
  document: app.activeDocument, app.documents[i], documents.add(),
  documents.getByName() and app.open(), or a variable that holds one.
  A print method of any other object is not reported.
- An assigned artboardRange without printAllArtboards replaces the saved
  range. An assigned printArea prints by artboard when the saved
  settings, or the preset's, ignore the artboards: the assigned range,
  or each artboard.
- The two scale factors are linked only when they are equal, as
  file.print compares them.
- The format follows the name jobOptions.file gives, also when that
  name is a link to a file with another extension.
- A print option name with a control character at either end throws.
2026-11-21 21:01:41 -08:00
dotCooCoo 8f4ecd4045 Merge main into feat/scripts-print-printer
# Conflicts:
#	docs/mcp.md
2026-11-21 20:52:42 -08:00
dotCooCoo e5005257ca Merge main into feat/scripts-api-d7a-variables
# Conflicts:
#	docs/mcp.md
2026-11-21 20:05:12 -08:00
dotCooCoo 2400aa7712 Scripts: reflect describes an object's properties and methods
Every object now has a read-only reflect property. Each read gives a new
frozen reflection with the class name, the properties and methods as
entries (name, type, dataType, defaultValue, min, max, isCollection,
arguments), and find(name).

- app, its documents, page items, layers, DocumentPreset and each class
  constructor are described from the host class registry: the installed
  members give the names and access, and the new HostClass.info gives the
  types, bounds, defaults and method arguments dom.rs declares beside
  each member. Members that are not available yet are left out. A class
  that names a member twice or describes a member it does not have is
  refused.
- Any other object is described by its own properties without running a
  getter; a JavaScript function's parameters are its arguments.
- An object with more than 10,000 members and arguments throws a
  RangeError.
- script.check counts reflection as a language feature, not host-only.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-21 18:51:26 -08:00
dotCooCoo d14830b6b7 Scripts: saveAs and exportFile refuse a file open for writing and scales under 1%
A save or export to a file that a File object holds open for writing throws "Script file is open for writing", and a command the script runs does not write such a file besides the one named (an SVG's images), so the bytes the File writes at the end of the run do not replace the output. horizontalScale and verticalScale take 1 to 776.19, since a raster export writes at least 0.01 pixels per point.

The script checker reports a document's saveAs and exportFile as file writes, and the host name check lists the save, export and open names, option classes and enumerations.
2026-11-21 17:36:55 -08:00
dotCooCoo ee7576975e Scripts: the script check counts exportVariables named in brackets as a file write
doc['exportVariables'](f) now reports file.write and filesWritten on its line, as the dot form does. Reading the method without calling it reports nothing.
2026-11-21 13:10:19 -08:00
dotCooCoo 6db0f6c1ad Scripts: visibility variables on embedded images, data sets kept after a no-op import
- variable.setBinding refuses an embedded image only for an image variable,
  so a script can bind an embedded image's visibility.
- A Dataset object stays usable after dataset.import, variable.loadLibrary
  or variable.import leaves the document's data sets as they were, or the
  import is put back; it goes stale only when the data sets change.
- script.check reports a document's exportVariables as filesWritten and
  file.write, and the script host test lists the variable and data set
  names the host adds.

Docs: docs/mcp.md.
2026-11-21 10:15:47 -08:00
dotCooCoo 992f6b3faf Script checker: setting length, hidden or readonly on new Folder(...) or a Folder place is not a file write
script.check reported file.write and filesWritten when a script set
length, hidden or readonly on a Folder object as well as on a File
object. It now leaves out only objects that are Folder objects whatever
the path names: new Folder(...), new Folder, and the Folder places such
as Folder.temp, except Folder.current, which a script can assign.
Folder(...) without new gives a File object when the path names a file,
and Folder.selectDialog() gives a File or Folder object, so setting
those still counts.

A variable counts as a Folder only when every assignment the check
reads gives it one: an assignment in another branch, in a function
body, or in an included file that gives it an object that may be a
File object keeps it counting, and a variable assigned another
variable counts as a possible File object. A File object assigned to a
function's own variable or parameter, or to a catch block's parameter,
ends with them. Calls such as remove() on a Folder object still count
as writes.

Folder object constructors and selectDialog:
https://extendscript.docsforadobe.dev/file-system-access/folder-object/
2026-11-20 21:10:50 -08:00
dotCooCoo 417ed94431 Script checker: setting a File's length, hidden or readonly counts as a file write
Setting a File object's length truncates or pads the file, and setting
readonly or hidden changes it, but script.check reported no outside
category for those assignments. It now reports file.write and
filesWritten for them: plain and compound assignment, ++ and -- before
or after, and the property name as a string literal in brackets.

A new integration test lists every global and member the script host
adds to the JavaScript engine (the own properties of the global object,
of each object or function it holds and of each function's prototype,
compared with a plain engine) and fails when one has no row. Each name
that reaches outside the document has a probe script, and the test
checks that script.check gives it the expected outside id. vc is listed
as not checked: script.check reads scripts written for the reference
app's scripting, and what vc.run does depends on the command. The test
also checks that the checker lists every preprocessor directive the
host reads, through the new DirectiveName::ALL.

File object properties:
https://extendscript.docsforadobe.dev/file-system-access/file-object/
2026-11-20 18:36:13 -08:00
dotCooCoo f388a795ce Script checker: a private name that starts with a directive's name is read to its end
Inside braces, a line such as `#include$size = 1` was taken for an `#include` line, because only the ASCII letters, digits and `_` after the `#` were compared with the directive names. The name now runs over every character a name may hold, written out or as an escape, before the comparison.
2026-11-11 22:49:43 -08:00
dotCooCoo 283e1267f6 Script checker: names with escaped characters are read as names
- A name may hold \u{...} escapes with any number of hexadecimal digits
  up to U+10FFFF. An empty, unclosed, out-of-range or surrogate escape is
  not part of a name. Each \u{...} escape read in a name is reported as
  syntax newer than ES3, with the escape as written.
- # followed by an escaped name start is one private name, also in the
  code of an XML literal, and its escapes are read in the report
  (this.#app is #app).
- A # and a name at the start of a line is a private name, not a
  directive, when the name starts with an escape, or when the line is
  inside braces and the name is not a directive's. A private name whose
  decoded name would make the line a directive is reported as written.
- The identifier test against vectorcraft-js also compares braced
  escapes.

Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-11 21:50:55 -08:00
BFlat 8719585cc6 Merge pull request #6663 from dotCooCoo/feat/script-target-engine
Scripts: #targetengine runs a script in a named engine that keeps its globals
2026-11-12 09:22:45 +07:00