Bug 141515

Summary: Web Inspector: images dragged from Inspector to Desktop are named "Unknown.png"
Product: WebKit Reporter: Brian Burg <burg>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, cdumez, chris, darin, esprehn+autocc, gyuyoung.kim, inspector-bugzilla-changes, joepeck, jonowells, simon.fraser, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=172678
Attachments:
Description Flags
[PATCH] Proposed Fix
wenson_hsieh: review+, buildbot: commit-queue-
Archive of layout-test-results from ews117 for mac-elcapitan none

Description Brian Burg 2015-02-12 09:33:36 PST
This is because the inspector implements those previews by creating an image and setting 'src' attribute to a data URL or object URL, destroying the original filename.

From 30 minutes of digging, I was not able to figure out an easy way to tell WebCore what filename to use in this situation. It does seem to figure out the file extensions from mime type correctly, though.

Anyone have ideas?
Comment 1 Radar WebKit Bug Importer 2015-02-12 09:33:53 PST
<rdar://problem/19813188>
Comment 2 Simon Fraser (smfr) 2015-02-12 10:44:36 PST
<rdar://problem/9251308>

Please fix this!
Comment 3 Joseph Pecoraro 2017-05-26 21:50:40 PDT
Created attachment 311410 [details]
[PATCH] Proposed Fix

This patch adds a <img filename> like feature only for Web Inspector as I wasn't sure if we should go about doing this for all pages before going through a standardization process.
Comment 4 Build Bot 2017-05-26 23:25:23 PDT
Comment on attachment 311410 [details]
[PATCH] Proposed Fix

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

New failing tests:
imported/w3c/web-platform-tests/innerText/getter.html
Comment 5 Build Bot 2017-05-26 23:25:24 PDT
Created attachment 311415 [details]
Archive of layout-test-results from ews117 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews117  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 6 Wenson Hsieh 2017-05-27 20:24:08 PDT
Comment on attachment 311410 [details]
[PATCH] Proposed Fix

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

> Source/WebCore/html/HTMLAttributeNames.in:120
> +filename

Hm, it's somewhat surprising that filename wasn't present here before.

> Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:177
> +    String filename = String([response suggestedFilename]);

auto filename

> Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:179
> +        String downloadFilename = ResourceResponseBase::sanitizeSuggestedFilename(element.attributeWithoutSynchronization(HTMLNames::filenameAttr));

auto :)
Comment 7 Wenson Hsieh 2017-05-27 20:24:57 PDT
Since this is a WebKit2 change, a WebKit2 reviewer will have to r+ this.
Comment 8 Chris Dumez 2017-05-27 20:29:03 PDT
Comment on attachment 311410 [details]
[PATCH] Proposed Fix

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

>> Source/WebCore/html/HTMLAttributeNames.in:120
>> +filename
> 
> Hm, it's somewhat surprising that filename wasn't present here before.

Why is it surprising? It is a new attribute that Joe is introducing.
Comment 9 Wenson Hsieh 2017-05-27 20:38:29 PDT
Comment on attachment 311410 [details]
[PATCH] Proposed Fix

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

>>> Source/WebCore/html/HTMLAttributeNames.in:120
>>> +filename
>> 
>> Hm, it's somewhat surprising that filename wasn't present here before.
> 
> Why is it surprising? It is a new attribute that Joe is introducing.

Ah, never mind -- I thought we had support elsewhere for this attribute already, but I was thinking of the download attribute for links.
Comment 10 Joseph Pecoraro 2017-05-30 16:41:06 PDT
<https://trac.webkit.org/r217584>
Comment 11 BJ Burg 2018-05-30 09:15:32 PDT
*** Bug 145984 has been marked as a duplicate of this bug. ***