Don't load inline data when requesting info for an attachment element backed by a file path
https://bugs.webkit.org/show_bug.cgi?id=181550
Source/WebCore:
Reviewed by Tim Horton.
When requesting data for an attachment element that is backed by a file path, we currently trigger a load in the
web process to fetch contents of the attachment data as inline data in the AttachmentInfo. This is unnecessary,
since the file path of the attachment element must have come from the UI process anyways, so it is sufficient to
simply send the file path to the UI process and have the UI process read the contents of the path as a memory-
mapped NSData.
This patch lets HTMLAttachmentElement skip over resource loading codepaths when creating an AttachmentInfo for
the client, and also teaches _WKAttachment to read a AttachmentInfo's filepath as memory-mapped data if a file
path is present, and no inline data was specified.
Covered by existing API tests.
* html/HTMLAttachmentElement.cpp:
(WebCore::HTMLAttachmentElement::requestInfo):
Source/WebKit:
Reviewed by Tim Horton
See WebCore/ChangeLog for more information.
* UIProcess/API/Cocoa/_WKAttachment.mm:
(-[_WKAttachmentInfo initWithInfo:]):
(-[_WKAttachmentInfo fileLoadingError]):
(-[_WKAttachment requestInfo:]):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226824
268f45cc-cd09-0410-ab3c-
d52691b4dbfc