Bug 196109 - Web Inspector: Timelines - Cannot export on about:blank - suggested filename containing a colon silently fails
Summary: Web Inspector: Timelines - Cannot export on about:blank - suggested filename ...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
Keywords: InRadar
Depends on:
Reported: 2019-03-21 13:15 PDT by Joseph Pecoraro
Modified: 2019-03-21 23:26 PDT (History)
6 users (show)

See Also:

[PATCH] Proposed Fix (21.21 KB, patch)
2019-03-21 15:09 PDT, Joseph Pecoraro
timothy: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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

- 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