mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
Restore source-position-aware ambient aliases, scalar env/argv reads, candidate endpoint worker data, Chrome DOMSnapshot empty strings, and accumulated Ghidra LaunchSupport diagnostics. Align regression fixtures with declared current contracts, while preserving identity, provenance, cancellation, and cleanup checks. Assert workflow caveats independently at both established locations. Validation: original five source failures reproduced on main; 307 focused tests passed with one platform skip, 22 fixture follow-up tests and 22 workflow/MCP tests passed; full static and docs checks passed. Real public http-server CLI analyses preserve identical artifact identity, statistics, and 581-token selected output. Real Chromium confirms restored DOM form destinations; isolated real service-worker verification passes on main and the change. The complete local browser run retained an unclassified later marker timeout; current-head CI provides complete real-browser and recovery lane results. Native IDA/Ghidra execution and complete local suite execution are not claimed. Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com> Co-authored-by: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { numberValue } from "./CdpCaptureValues.js";
|
|
|
|
// DOMSnapshot interns an empty or null string as index -1 instead of a table
|
|
// entry. Chrome uses it for element node values and empty attribute values.
|
|
const CDP_EMPTY_STRING_INDEX = -1;
|
|
|
|
/** Resolve a DOMSnapshot name index, which must reference a string entry. */
|
|
export const cdpSnapshotString = (
|
|
strings: readonly (string | undefined)[],
|
|
index: unknown,
|
|
): string | undefined => {
|
|
const integer = numberValue(index);
|
|
if (integer === undefined || !Number.isSafeInteger(integer) || integer < 0)
|
|
return undefined;
|
|
return strings[integer];
|
|
};
|
|
|
|
/** Resolve a DOMSnapshot value index, where -1 is the protocol's empty string. */
|
|
export const cdpSnapshotValueString = (
|
|
strings: readonly (string | undefined)[],
|
|
index: unknown,
|
|
): string | undefined =>
|
|
numberValue(index) === CDP_EMPTY_STRING_INDEX
|
|
? ""
|
|
: cdpSnapshotString(strings, index);
|
|
|
|
/** Whether flattened name/value attribute indexes all resolve. */
|
|
export const cdpSnapshotAttributesResolve = (
|
|
strings: readonly (string | undefined)[],
|
|
attributes: readonly (number | undefined)[],
|
|
): boolean =>
|
|
attributes.length % 2 === 0 &&
|
|
attributes.every(
|
|
(attribute, offset) =>
|
|
attribute !== undefined &&
|
|
(offset % 2 === 0
|
|
? cdpSnapshotString(strings, attribute)
|
|
: cdpSnapshotValueString(strings, attribute)) !== undefined,
|
|
);
|