You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 772feca
Browse filesBrowse the repository at this point in the historyBrowse files
fix(javascript): spell an escaped directive safe for an inline script
- A directive printed as spelled skipped the escaping `inline_script`
gives every other string, so `"x\x20</script>"` could end the script
element it sits in; it now gets the same `<\/script`, `\x3c!--` and
`--\x3e`, each reading as what it replaces.
- The JavaScript sweep asks only for the expectations a narrowed run can
reach: a fixture or preset left out no longer reads as stale.
- Say the parser's relations parse under a build's options, and drop the
`EXPECTED_ANY` the test option objects did not need.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011CuRTB8fAv8PE7di49qDL4
Copy file name to clipboardExpand all lines: tooling/COMPARE_TOOLS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,6 @@
16
16
4. Parser, `slices`: the bytes between a node's offsets, parsed alone, give the node back. **A slice is parsed in a context keeping its meaning, never at top level** (`yield x` is an identifier outside a generator; a lone `<td>x</td>` is dropped and its text foster-parented): CSS wraps a declaration in a rule and a value in a declaration; JS tries a ladder of function and class-method contexts under the source's own `ecmaVersion` (`function*(){}` can't open a statement; an ES6-pinned case can't parse `async function*`); HTML runs the fragment parsing algorithm on the enclosing tag, as browsers do for `innerHTML`. A node no context parses is counted, not reported. Left out (§13.2 again): an element the parser inserted or cloned (no tag to slice), and one whose end is still its start tag's (its range doesn't hold its children). **Two limits keep it to seconds**: one shape is one question (a bundle's millionth `Identifier[0,3)` is skipped — CSS went 30s → 4.6s), and each source may spend at most four times its bytes on reparsing, leaves first; both skip counts are reported, as unread coverage. The JS sweep also reads `fixtures/acorn-corpus.json` under each case's options, reaching productions no fixture writes; sources the parser refuses are counted, not reported (those cases assert the refusal).
17
17
5. Parser, `purity`: rereading the same bytes in one process gives the same answer. **Every source is read once before any is read again**, so every other source sits between a source's two readings — catching a cache keyed on the last input. **The digest holds what the parse derived, not only offsets** (`parseHtml` interns tag and attribute names as slices of the document first spelling them and drops those on the next parse, so a stale name keeps correct offsets): HTML tag/attribute names and values, CSS derived names, and every primitive on a JS node, read off the node's own keys so new productions are covered; CSS and HTML also digest the printed bytes. Refusals are digested too, except running out of stack (its position depends on the surrounding call depth). A disagreeing source is read a third time back to back, telling leaked state from a non-repeatable parse.
18
18
6. Parser, `acorn` (JS): every fixture's tree equals acorn's under a build's options, every key positions included — the comparator `test262-parser.spectest.js`, `js-fuzz.spectest.js` and the parser's unit tests import from `compare-js-tools.js`. acorn's own corpus is left out (`WebpackParser.unittest.js` replays its trees), and a source acorn refuses is left to the test262 suites.
19
-
- Relations 3–6 are the parser's and run under no option set. A parser that also prints is held to both halves. These catch what a comparison can't: being a few bytes off one's own best isn't being worse than another tool.
19
+
- Relations 3–6 are the parser's and skip the printer's option sets; each source is parsed under the options a build reads it with. A parser that also prints is held to both halves. These catch what a comparison can't: being a few bytes off one's own best isn't being worse than another tool.
20
20
- A divergence the printer owes nothing for goes in the script's `EXPECTED` table with its reason, never suppressed by a passing gate; an entry that stops matching is itself a finding, so a fix retires it.
21
21
- The HTML sweep adds a third option set, `embedded` (the aggressive one + `builtinEmbeddedRenderer`) — what a build runs, so inline `<style>` and `style=""` reach the CSS minifier and both printers are checked as one. It caught a recovered CSS string keeping the quote its source opened with, which `.css` suites can't reach (a css module ends declarations with a newline, making an open string a bad-string).
0 commit comments