Bug 178188 - Web Inspector: Canvas tab: recordings should have a unique name
Summary: Web Inspector: Canvas tab: recordings should have a unique name
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Matt Baker
URL:
Keywords: InRadar
Depends on:
Blocks: WebInspectorCanvasRecording WebInspectorCanvasTab
  Show dependency treegraph
 
Reported: 2017-10-11 15:26 PDT by Matt Baker
Modified: 2017-12-04 17:40 PST (History)
6 users (show)

See Also:


Attachments
Patch (12.58 KB, patch)
2017-10-11 15:37 PDT, Matt Baker
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-elcapitan (990.80 KB, application/zip)
2017-10-11 16:42 PDT, Build Bot
no flags Details
Patch (12.58 KB, patch)
2017-10-11 17:55 PDT, Matt Baker
no flags Details | Formatted Diff | Diff
Patch (13.31 KB, patch)
2017-10-13 18:55 PDT, Matt Baker
no flags Details | Formatted Diff | Diff
Patch (13.39 KB, patch)
2017-10-13 20:23 PDT, Matt Baker
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Baker 2017-10-11 15:26:19 PDT
Summary:
Recordings should have a unique name. New recordings should get an auto-incrememnted name like Recording 1, Recording 2, etc. Imported recordings should use the filename with the extension removed. Resolve conflicts by appending a suffix: "My Recording", "My Recording (2)", etc.

Note:
Recording names only need to be unique per-canvas. This is needed for the Canvas tab, which lists recordings per-canvas.
Comment 1 Radar WebKit Bug Importer 2017-10-11 15:29:54 PDT
<rdar://problem/34943364>
Comment 2 Matt Baker 2017-10-11 15:37:41 PDT
Created attachment 323472 [details]
Patch
Comment 3 Build Bot 2017-10-11 16:42:36 PDT
Comment on attachment 323472 [details]
Patch

Attachment 323472 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/4829132

New failing tests:
imported/w3c/web-platform-tests/XMLHttpRequest/open-url-worker-origin.htm
Comment 4 Build Bot 2017-10-11 16:42:38 PDT
Created attachment 323486 [details]
Archive of layout-test-results from ews101 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 5 Matt Baker 2017-10-11 17:55:24 PDT
Created attachment 323498 [details]
Patch
Comment 6 Devin Rousso 2017-10-12 14:48:23 PDT
Comment on attachment 323498 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=323498&action=review

This looks fine to me, but I'd like to either discuss WI.Recording.setUniqueName or see it changed to non-static before r+.

> Source/WebInspectorUI/UserInterface/Models/Recording.js:68
> +    static setUniqueName(recording, suggestedName)

Having this as static seems a bit weird.  I would imagine that you could redo this akin to WI.Canvas.prototype.displayName.  I understand that it uses static objects on WI.Recording (e.g. `_importedRecordingNames`), but I think we are fine to use those in non-static functions too.

> Source/WebInspectorUI/UserInterface/Models/Recording.js:70
> +        let recordingNames;

NIT: I'd rename this as `recordingNameSet`, as `recordingNames` suggests to me that it's an array.

> Source/WebInspectorUI/UserInterface/Models/Recording.js:75
> +                recordingNames = new Set;
> +                recording.source[WI.Recording.CanvasRecordingNamesSymbol] = recordingNames;

I usually put all of these on one line.

    recordingNames = recording.source[WI.Recording.CanvasRecordingNamesSymbol] = new Set;

> Source/WebInspectorUI/UserInterface/Models/Recording.js:197
> +    get name() { return this._name; }

Please add `this._name` to the constructor with some default value.
Comment 7 Matt Baker 2017-10-12 15:54:08 PDT
Comment on attachment 323498 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=323498&action=review

>> Source/WebInspectorUI/UserInterface/Models/Recording.js:68
>> +    static setUniqueName(recording, suggestedName)
> 
> Having this as static seems a bit weird.  I would imagine that you could redo this akin to WI.Canvas.prototype.displayName.  I understand that it uses static objects on WI.Recording (e.g. `_importedRecordingNames`), but I think we are fine to use those in non-static functions too.

Since it takes an optional suggested name, which might not even be used, this wouldn't make sense as a setter. A non-static method would be okay.
Comment 8 Matt Baker 2017-10-13 18:55:03 PDT
Created attachment 323788 [details]
Patch
Comment 9 Matt Baker 2017-10-13 20:23:57 PDT
Created attachment 323793 [details]
Patch
Comment 10 Devin Rousso 2017-10-14 11:37:07 PDT
Comment on attachment 323793 [details]
Patch

r=me
Comment 11 WebKit Commit Bot 2017-10-14 12:05:19 PDT
Comment on attachment 323793 [details]
Patch

Clearing flags on attachment: 323793

Committed r223322: <https://trac.webkit.org/changeset/223322>
Comment 12 WebKit Commit Bot 2017-10-14 12:05:21 PDT
All reviewed patches have been landed.  Closing bug.