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?
<rdar://problem/19813188>
<rdar://problem/9251308> Please fix this!
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 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
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 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 :)
Since this is a WebKit2 change, a WebKit2 reviewer will have to r+ this.
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 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.
<https://trac.webkit.org/r217584>
*** Bug 145984 has been marked as a duplicate of this bug. ***