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:
@@ -20,7 +20,7 @@ export const recordsValue = (value: unknown): readonly UnknownRecord[] =>
|
||||
})
|
||||
: [];
|
||||
|
||||
export const stringValue = (value: unknown): string | undefined =>
|
||||
export const cdpStringValue = (value: unknown): string | undefined =>
|
||||
typeof value === "string" ? value : undefined;
|
||||
|
||||
export const numberValue = (value: unknown): number | undefined =>
|
||||
@@ -49,7 +49,7 @@ export const allowedSanitizedUrl = (
|
||||
value: unknown,
|
||||
allowedOrigins: ReadonlySet<string>,
|
||||
): ReturnType<typeof sanitizeBrowserUrl> | undefined => {
|
||||
const text = stringValue(value);
|
||||
const text = cdpStringValue(value);
|
||||
if (text === undefined) return undefined;
|
||||
const sanitized = sanitizeBrowserUrl(text);
|
||||
return sanitized.origin !== null && allowedOrigins.has(sanitized.origin)
|
||||
|
||||
Reference in New Issue
Block a user