- Document.exportForScreens throws a TypeError for null in place of the
options, itemToExport or fileNamePrefix, as exportFile does for null
options, instead of taking the defaults.
- The script checker counts a variable read just before the `}` that
closes a function body (`function get() { return $.global['local'] }`)
as read in that body, so a later literal's saveAs is no longer exempt.
The script checker kept a replacement of a variable's methods
(`give(local)`, `local.saveAs = w`) for the body that had declared the
name so far in the text. A `var` statement declares the name for the
whole body, and a parameter is the function's own variable, so the
replacement could count for the wrong variable:
- A function whose own later `var local` or parameter `local` declares
the name no longer ends the exemption of an outer `local`'s own
`saveAs` (`function h(a, local) { return local; }`).
- A replacement now counts for the innermost body around it that
declares the name anywhere in the body, found once every body's
names are known.
- When a body past the nesting limit or out of room for its names is
around the replacement, the declaring body is not known, and the
replacement counts for a variable of that name in every body.
- The call site looks the replacement up for the body that declares
the receiver, walking outward from the innermost body.
The declarations pass recorded a function body or loop replacing a
variable's document write method only for `local.saveAs = ...` and
`local['saveAs'] = ...`. A hoisted function or a later loop pass could
still change the method through a compound or update operator
(`local.saveAs += w`, `local['saveAs']++`), or hold the object under
another name (`var y = local; y.saveAs = w`, `give(local)`), and an
earlier `local.saveAs(f)` kept its exemption.
The pass now reads these the way the main pass reads them: any compound
or update operator on a write method, `++local.saveAs`, a key in brackets
that is not one string or number literal, `delete local`, and the
variable used as a value. Each recorded replacement is kept by the body
that declares the variable, so a function's own variable of the same name
keeps its exemption.
- A loop that assigns `local.saveAs` or `local['saveAs']` marks `local` as assigned in that
loop, so a call earlier in the loop writes a file.
- A function body that replaces a variable's write method, declared anywhere in the file,
ends the exemption for that variable's calls. A variable the innermost body declares
itself is left alone, and a key whose escapes do not decode counts as a write method.
- `$.global.local`, `this.local` and `globalThis.local` used as a value forget the variable's
methods as `$.global['local']` does. A variable of the same name that the function body
declares keeps its own.
- The test with two `a.saveAs(f)` calls puts them on separate lines and checks both.
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.
`var alias = $.global['local']` or `f(this['local'])` may share the
global variable's object, so a later literal's saveAs is no longer the
script's own and its calls are reported as file writes. Adds tests for
that case and for `$.global.local.saveAs = ...` under a parameter named
`local`.
The gate's fmt step failed on a9c8f363: the use lists in analyze.rs and
analyze/features.rs grew past rustfmt's max_width of 150 and were left on
one line. They are now wrapped as cargo fmt writes them.
The script checker stored a bracketed global key such as $.global['name']
cut to 256 characters, so a longer key forgot a different variable and a
later own saveAs call on the real one was not reported. Keys are now
decoded in full. A key whose escape does not decode to one exact name
(\u{63}, a short \x or \u, a lone surrogate) forgets every variable's
own methods instead of one name.
The checker treated `$.global.local.saveAs = …` as replacing the
variable's own saveAs, but missed the bracket forms
`$.global['local'].saveAs = …`, `this['local'].saveAs = …`,
`globalThis['local']['saveAs'] = …` and `$.global.local['saveAs'] = …`,
so a script could rebind a document write method that way and its
later writes were not reported. These forms now end the variable's
own saveAs, including when a function body declares a variable of
the same name.
A property assignment in a loop (`$.global.local = d`, `o['local'] = d`)
may give the global variable `local` another value on the next pass, so a
call of its own `saveAs` earlier in the same loop may save a document. The
check now treats such an assignment as a rebinding of the global variable
in that loop. A key with an escape may name any variable, so every call in
a loop is checked after one.
A function that assigns `$.global.local.saveAs`, `globalThis.local.saveAs`
or `this.local.saveAs` replaces the method of the global variable `local`,
also when the function declares its own `local`, so a later call of
`local.saveAs` is reported. A `global` property of another object
(`holder.global.local`) is not the global object.
Tests whose all() passed on an empty list now check the list's length or
that it is not empty:
- huge_circles_bridge_with_finite_anchors_or_are_refused (pathops bridge)
- smooth_rounds_corners (pathops ops): the four corners stay, smoothed
- a_held_rotation_turns_the_art_around_its_pin (tools ARAP): one point
per mesh vertex
- the_eraser_drag_area_matches_the_release_when_pressure_or_a_mode_starts_during_the_drag
(tools gesture): one released point per press
- every_effect_casts_a_shadow, inflate_cells_across_a_hole_edge_are_cut_to_the_shape,
a_plane_has_only_a_front_and_a_hollow_solid_none and
perspective_runs_0_to_160_degrees_with_the_eye_outside_the_object (three-d)
- a_file_two_branches_include_is_followed_from_the_shallower_one
(scriptcheck): one row per include line
- pens_pick_colors_and_widths (cad HP-GL): four widths
- junk_pressure_brushes_draw_finite_art (brush): all 12 cases draw
Round trips that hold by construction (parse finds the id in ALL) are
replaced with one saved name that must parse and one that must not:
follow_names_parse (pathops shared edge), the shape kinds (pathops
shapes), surfaces_parse_from_their_ids (three-d), the Quick Pen actions
(tools), names_parse_and_serialize_as_names (plugins) and the brush
variation modes, which also compare the serde names with the ids.
crop_keeps_an_instance_whose_art_reaches_the_region (cad) names the
entities written instead of checking that some were.
the_saved_engine_preference_is_found (app) pins the GPU choices the
preferences offer to the three the app reads.
timing_unite_1000_circles (pathops) gets an ignore reason and checks
that Unite gives one shape.
Each changed assertion fails when the code under test is broken (an id
renamed, a list emptied, a flush or instance dropped) and passes when it
is restored.
A function body that assigns `$.global.name`, `globalThis.name` or
`$.global['name']` may run after a later literal gives `name` its methods,
as `this.name` already did. The assignment now records the name as
reassigned later, so the literal's later calls keep reporting the write.
An assignment in the global code runs once and still leaves a later
literal's methods the script's own.
The shadowing test is split so the named-global case and the computed-key
case each check their own line.
`var app = new File(p); app.open('w');` was reported as an application
open (file.read). A receiver that holds a File now takes the File open
mode rules, so the check reports file.write and filesWritten.
A save job now takes its path naming from whether the plan was given a
path, so a refused multi-file save without a path names its files by
their file names for every caller of `save_job`, as `document.save`
already did. Merging the save, export and open branch had left the job
naming full paths unless `save` set the field, which failed
`refused_multi_file_save_never_calls_the_writer`.
A multi-file save or export into a folder that may not be read no
longer fails with "automation path rejected: cannot resolve": a path
whose real path cannot be found is compared as written, and its write
reports READ_ONLY_LOCATION as other saves there do.
The print tests remove their folders when an assertion fails, and Check
Script has a test for printing the document `app['open']` returns.
Check Script now counts print on a document as a file write when the
document is reached with member names as string literals in brackets
(app['activeDocument'].print(o), app["documents"][0].print(o),
app.documents['getByName']('Draft').print(o)), also through a
variable, parentheses, a closed function or catch scope, and included
files. A string key on a collection stays an item lookup by name
(app.documents['Draft']) unless it names one of the collection's
documented members or an Object.prototype member. The report still
shows each chain as written.
Takes #9052's File and Folder design: a File keeps its path in
Class::FsEntry, which now also holds the native slots this branch keeps
out of a File's own properties. Hosts give File and Folder values with
file_ref and folder_ref, so the separate File ref writer is removed.
The save, export and open warnings keep the full method name as their
prefix (Document.saveAs:, Document.exportFile:, app.open:,
Document.close:). A script command's read stops at the smaller of the
script read limit and a scoped read limit, so app.open's limit no
longer skips the script read limit. PageMarksTypes is defined once.
- document.open refuses page, cropTo, pages and crop when a named importer reads the file (linkPages
still uses the built-in reader).
- exportFile with explicit null options throws a TypeError for GIF, PNG8 and TIFF too.
- close(SaveOptions.SAVECHANGES) saves a modern .ai or .ait file and an SVG file with Preserve
Editing whatever range was remembered; a range the save refuses still refuses.
- The script checker keeps a try statement's catch and finally, and an else after a nested
do-while, inside the loop body; a line break after a label does not start a new statement; a
this assignment in a function that hides a global clears the global's saved methods; and
holder.d['saveAs'] = ... no longer counts as a write to d.
- docs/mcp.md describes which files keep every artboard on close.
- document.open with an explicit PDFCROPBOX crop opens on the crop box
of a file with editing data; the default keeps the trim box and bleed.
- Closing with save changes keeps an EPS document's artboard range, since
the EPS file holds the whole document.
- The script checker treats a writer receiver captured from an outer
scope as able to change before each call, and finds the loop that holds
a call with a binary search instead of a scan of every loop.