Bug 196109

Summary: Web Inspector: Timelines - Cannot export on about:blank - suggested filename containing a colon silently fails
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, hi, inspector-bugzilla-changes, joepeck, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix timothy: review+

Description Joseph Pecoraro 2019-03-21 13:15:48 PDT
Timelines - Cannot export on about:blank - suggested containing a colon silently fails

Steps to Reproduce:
1. Inspect about:blank
2. Start and stop a timeline recording
3. Click "Export"
  => Nothing happens

Notes:
- Changing the suggested filename from "about:blank-recording.json" to "about-blank-recording.json" works
Comment 1 Joseph Pecoraro 2019-03-21 13:18:21 PDT
Switching from `encodeURI(filename)` to `encodeURIComponent(filename)` does get things working however "about:blank-recording.json" becomes "about/blank-recording.json" on macOS. So maybe we should sanitize this differently to be nicer.
Comment 2 Joseph Pecoraro 2019-03-21 15:09:22 PDT
Created attachment 365623 [details]
[PATCH] Proposed Fix

Not sure if `inspectorURLForFilename` is the best name, open to suggestions.
Comment 3 Devin Rousso 2019-03-21 18:02:28 PDT
Comment on attachment 365623 [details]
[PATCH] Proposed Fix

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

> Source/WebInspectorUI/UserInterface/Debug/ProtocolTrace.js:55
> +        let url = WI.FileUtilities.inspectorURLForFilename(filename);
> +        return {url, content: JSON.stringify(this._entries)};

NIT: put this on separate lines.
```
    return {
        url: WI.FileUtilities.inspectorURLForFilename(filename),
        content: JSON.stringify(this._entries),
    };
```

> Source/WebInspectorUI/UserInterface/Views/LogContentView.js:269
> +        let url = WI.FileUtilities.inspectorURLForFilename("Console.txt");
> +        return {url, content: this._formatMessagesAsData(false), forceSaveAs: true};

Ditto (>ProtocolTrace.js:54).

> Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js:148
> +            let url = WI.FileUtilities.inspectorURLForFilename("InspectorStyleSheet.css");
> +            return {url, content: this._textEditor.string, forceSaveAs: true};

Ditto (>ProtocolTrace.js:54).
Comment 4 Devin Rousso 2019-03-21 23:24:32 PDT
Committed r243355 <https://trac.webkit.org/changeset/243355>.
Comment 5 Radar WebKit Bug Importer 2019-03-21 23:26:17 PDT
<rdar://problem/49141962>