refactor(domain): extract source-map envelope walk and disambiguate stringValue (#828)
Move the indexed sections walk shared by the browser fetcher and the artifact reader into domain/sourceMapEnvelope with the fetchers stricter offset validation as an option; both validators keep their leaf strictness. Rename the browser CDP stringValue to cdpStringValue across its 18 files, fold the fingerprint duplicate into the static helper, and rename the version-keys shadow to nonEmptyString.
This commit is contained in:
@@ -19,7 +19,7 @@ import { err, ok, type Result } from "../domain/result.js";
|
||||
import {
|
||||
numberValue,
|
||||
recordValue,
|
||||
stringValue,
|
||||
cdpStringValue,
|
||||
delayWithCancellation,
|
||||
} from "./CdpCaptureValues.js";
|
||||
import { CdpConnection, type CdpEvent } from "./CdpConnection.js";
|
||||
@@ -331,7 +331,7 @@ const ingestScript = (
|
||||
): void => {
|
||||
state.scriptsObserved += 1;
|
||||
const value = recordValue(event.params);
|
||||
const rawUrl = stringValue(value?.url);
|
||||
const rawUrl = cdpStringValue(value?.url);
|
||||
if (rawUrl === undefined || rawUrl === "") {
|
||||
state.invalidScripts += 1;
|
||||
retainEvent(state, 0);
|
||||
@@ -340,7 +340,7 @@ const ingestScript = (
|
||||
const draft: ScriptDraft = {
|
||||
rawUrl,
|
||||
executionContextKey: contextKey(value?.executionContextId),
|
||||
cdpHash: stringValue(value?.hash) ?? null,
|
||||
cdpHash: cdpStringValue(value?.hash) ?? null,
|
||||
length: nonnegativeInteger(value?.length),
|
||||
isModule: value?.isModule === true,
|
||||
};
|
||||
@@ -375,7 +375,7 @@ const ingestContext = (
|
||||
}
|
||||
const origin =
|
||||
event.method === "Runtime.executionContextCreated"
|
||||
? (stringValue(runtimeContext?.origin) ?? null)
|
||||
? (cdpStringValue(runtimeContext?.origin) ?? null)
|
||||
: null;
|
||||
const draft: ContextDraft = {
|
||||
contextKey: key,
|
||||
|
||||
Reference in New Issue
Block a user