Bug 54454 - Web Inspector: wrong filename when saving resource from ResourceImageContentView
Summary: Web Inspector: wrong filename when saving resource from ResourceImageContentView
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-02-15 06:24 PST by Ilya Tikhonovsky
Modified: 2017-03-17 20:49 PDT (History)
7 users (show)

See Also:


Attachments
Patch (2.74 KB, patch)
2017-03-16 14:41 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (2.57 KB, patch)
2017-03-16 15:00 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (3.51 KB, patch)
2017-03-16 15:42 PDT, Devin Rousso
joepeck: review+
Details | Formatted Diff | Diff
Patch (3.20 KB, patch)
2017-03-17 20:08 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ilya Tikhonovsky 2011-02-15 06:24:16 PST
2. When I download something from the Resources layout under Developer Tools
   the filename of the image (or anything I download) is changed to the generic
   term "download.jpg" or other type of extension. The previous version of
   Google Chrome downloaded items with their original file name.
Comment 1 Brian Burg 2014-01-25 14:52:34 PST
Migrating to new component.

On Nightly Safari, it saves the resource with the name "Unknown".
Comment 2 Radar WebKit Bug Importer 2014-01-25 14:52:42 PST
<rdar://problem/15909852>
Comment 3 Devin Rousso 2017-03-16 14:41:54 PDT
Created attachment 304697 [details]
Patch
Comment 4 Joseph Pecoraro 2017-03-16 14:46:38 PDT
Comment on attachment 304697 [details]
Patch

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

Seems like this could save the wrong content. That doesn't seem correct to me. Maybe leave the TextResourceContentView's saveData?

> Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js:74
> +    get saveData()
> +    {
> +        return {url: this.resource.url, content: this.resource.content};
> +    }
> +

This saves the resources's content.

> Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js:-137
> -    get saveData()
> -    {
> -        return {url: this.resource.url, content: this._textEditor.string};
> -    }

This would have saved the current text in the editor.
Comment 5 Devin Rousso 2017-03-16 15:00:35 PDT
Comment on attachment 304697 [details]
Patch

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

>> Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js:-137
>> -    }
> 
> This would have saved the current text in the editor.

I dunno why, but I completely misread how the `this._textEditor.readOnly` works.  Thought it was backwards.
Comment 6 Devin Rousso 2017-03-16 15:00:54 PDT
Created attachment 304700 [details]
Patch
Comment 7 Joseph Pecoraro 2017-03-16 15:03:20 PDT
Comment on attachment 304700 [details]
Patch

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

> Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js:73
> +    get supportsSave()
> +    {
> +        return true;
> +    }
> +
> +    get saveData()
> +    {
> +        return {url: this.resource.url, content: this.resource.content};
> +    }

Should this wait until the resource has content? What happens if you trigger the save during the spinner / downloading screen?
Comment 8 Devin Rousso 2017-03-16 15:42:35 PDT
Created attachment 304708 [details]
Patch
Comment 9 Joseph Pecoraro 2017-03-17 11:08:11 PDT
Comment on attachment 304708 [details]
Patch

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

r=me

> Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js:72
> +        return {url: this.resource.url, content: this.resource.content};

Nit: I'd have made these this._resource instead of going through the public accessor.
Comment 10 Devin Rousso 2017-03-17 20:08:53 PDT
Created attachment 304852 [details]
Patch
Comment 11 WebKit Commit Bot 2017-03-17 20:49:53 PDT
Comment on attachment 304852 [details]
Patch

Clearing flags on attachment: 304852

Committed r214133: <http://trac.webkit.org/changeset/214133>
Comment 12 WebKit Commit Bot 2017-03-17 20:49:59 PDT
All reviewed patches have been landed.  Closing bug.