Bug 223532

Summary: Uncaught Exception: RangeError: Array size is not a small enough positive integer.
Product: WebKit Reporter: BJ Burg <bburg>
Component: Web InspectorAssignee: BJ Burg <bburg>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, ews-watchlist, hi, inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
URL: favorites://
Attachments:
Description Flags
Patch v1.0 hi: review+

Description BJ Burg 2021-03-19 12:34:34 PDT
Uncaught Exception in Web Inspector.

Steps to Reproduce:
1. Timelines Tab > Start Recording
2. Export / Save Recording
3. Load saved recording
4. Select CPU instrument

=> uncaught exception

Uncaught Exceptions:
-----------------------
 - RangeError: Array size is not a small enough positive integer. (at CPUTimelineView.js:1274:32)
    _computeStatisticsData @ CPUTimelineView.js:1274:32
    layout @ CPUTimelineView.js:459:59
    _layoutSubtree @ View.js:293:20
    updateLayout @ View.js:159:28
    showTimelineViewForTimeline @ TimelineRecordingContentView.js:153:37
    _timelineSelected @ TimelineRecordingContentView.js:799:45
    dispatch @ Object.js:129:35
    dispatchEventToListeners @ Object.js:137:17
    _timelinesTreeSelectionDidChange @ TimelineOverview.js:896:38
    dispatch @ Object.js:129:35
    dispatchEventToListeners @ Object.js:137:17
    _dispatchSelectionDidChangeEvent @ TreeOutline.js:1083:38
    selectionControllerSelectionDidChange @ TreeOutline.js:755:46
    _updateSelectedItems @ SelectionController.js:458:65
    selectItem @ SelectionController.js:155:34
    handleItemMouseDown @ SelectionController.js:322:28
    _handleMouseDown @ TreeOutline.js:1067:54
    _handleMouseDown @ [native code]
-----------------------

Notes:
Inspected URL:        favorites://
Loading completed:    true
Frontend User Agent:  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)
Comment 1 BJ Burg 2021-03-19 12:39:02 PDT
Relevant code: 

        let millisecondStartTime = Math.round(startTime * 1000);
        let millisecondEndTime = Math.round(endTime * 1000);
        let millisecondDuration = millisecondEndTime - millisecondStartTime;

        let samples = new Array(millisecondDuration);

For some reason `endTime` is 0 here, so the overall duration is negative and the Array constructor throws.
Comment 2 Radar WebKit Bug Importer 2021-03-19 13:55:19 PDT
<rdar://problem/75635080>
Comment 3 BJ Burg 2021-03-19 14:12:03 PDT
Created attachment 423776 [details]
Patch v1.0
Comment 4 Devin Rousso 2021-03-19 14:14:44 PDT
Comment on attachment 423776 [details]
Patch v1.0

rs=me
Comment 5 BJ Burg 2021-03-19 14:22:17 PDT
Committed r274737 (235555@main): <https://commits.webkit.org/235555@main>