fix(browser): advertise zero-based units for runtime source coordinates (#1085)
* fix(browser): advertise zero-based units for runtime source coordinates inspect_web_event_listeners and observe_web_execution return CDP callsite, listener and resource_start line_number/column_number values unchanged: zero-based lines and UTF-16 columns. Neither the advertised output schema nor docs/web-runtime.md said so. trace_web_source_location takes one-based lines, so a caller chaining a listener location into it lands one line early. Describe the units on the shared schema fields, which reach both tools' advertised output schemas, and document the conversion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(browser): describe runtime positions relative to the enclosing resource For an inline <script>, CDP reports listener and callsite positions relative to the HTML document, and resource_start is where the script text starts in that document. A real headless Chromium 155 page showed this: a listener on HTML line 6 came back as line_number 5, with resource_start {3, 8}. Describe all positions as relative to the enclosing resource. Document that inline-script positions must have resource_start subtracted, plus one added to the line, before trace_web_source_location. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(browser): clarify runtime-to-source coordinate conversion --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: N0zoM1z0 <1705004398@qq.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
N0zoM1z0
parent
23862af1b5
commit
6218d289e2
+3
-1
@@ -20,7 +20,9 @@ Results retain:
|
||||
- The selected target, frame and document loader identity; local armed/end timestamps and separate backend monotonic coverage timestamps.
|
||||
- Every admitted producer function/block range, exclusive end offset and execution count in UTF-16 code units, with verified bounds when exact text is available. Nested/overlapping counts are preserved and must not be summed.
|
||||
- Main-document script inventory, exact session script IDs, resource start coordinates, sourceURL/source-map declarations, producer hash and independently computed UTF-8 text digest.
|
||||
- Armed-window requests from the selected main frame and selected origins, complete reported initiator objects (including stack hierarchy/descriptions), derived callsites, exact script-ID associations and unresolved async parent IDs. Source association does not establish UI causality.
|
||||
- Armed-window requests from the selected main frame and selected origins, complete reported initiator objects (including stack hierarchy/descriptions), derived callsites, exact script-ID associations and unresolved async parent IDs. Source association does not establish UI causality. Callsite and listener `line_number`/`column_number` values are CDP's zero-based lines and UTF-16 columns in the script's enclosing resource: the script file for an external script, or the HTML document for an inline script. `resource_start` is where the script text starts in that resource. `trace_web_source_location` takes one-based, script-relative lines and zero-based UTF-16 columns.
|
||||
|
||||
For an external script, use `line = line_number + 1` and keep `column = column_number`. For an inline script, use `line = line_number - resource_start.line_number + 1`. Subtract `resource_start.column_number` from `column_number` only when `line_number === resource_start.line_number`; keep the reported column on later lines. Columns remain zero-based. This conversion requires known source-start and column coordinates; preserve unavailable coordinates as unknown.
|
||||
|
||||
The coverage counter interval starts at backend acceptance before the armed receipt and ends at the resetting sample after the local timer. Counts may include execution during these command intervals; request events are restricted to the locally armed window. The result retains both backend timestamps and the distinct local clock.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user