Files from drag and file <input> should use getMIMETypeForExtension to determine...
authordcheng@chromium.org <dcheng@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Jul 2012 18:17:44 +0000 (18:17 +0000)
committerdcheng@chromium.org <dcheng@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Jul 2012 18:17:44 +0000 (18:17 +0000)
commitd5485afc0dfcca541f7a528a2c923fd08f3be424
treeb8f8b54efa41bfc31efda71a978d0ba990108de6
parent4dff737c1a6748cb84dd85523ae8f74bb2380083
Files from drag and file <input> should use getMIMETypeForExtension to determine content type.
https://bugs.webkit.org/show_bug.cgi?id=91702

Reviewed by Jian Li.

Awhile back, we changed File to only use getWellKnownMIMETypeForExtension to prevent web
pages from being able to detect what applications a user has installed indirectly through
the MIME types. However, some sites like YouTube's drag and drop uploader use MIME types
that aren't in WebKit's internal list, so we relax the restriction for Files that originate
from an user action.

* fileapi/File.cpp:
(WebCore::getContentTypeFromFileName):
(WebCore::createBlobDataForFile):
(WebCore::createBlobDataForFileWithName):
(WebCore::createBlobDataForFileWithMetadata):
(WebCore::File::createWithRelativePath):
(WebCore::File::File):
* fileapi/File.h:
(File):
(WebCore::File::create):
(WebCore::File::createWithName):
* html/FileInputType.cpp:
(WebCore::FileInputType::createFileList):
* platform/chromium/ChromiumDataObject.cpp:
(WebCore::ChromiumDataObject::addFilename):
* platform/gtk/ClipboardGtk.cpp:
(WebCore::ClipboardGtk::files):
* platform/mac/ClipboardMac.mm:
(WebCore::ClipboardMac::files):
* platform/qt/ClipboardQt.cpp:
(WebCore::ClipboardQt::files):
* platform/win/ClipboardWin.cpp:
(WebCore::ClipboardWin::files):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123495 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/fileapi/File.cpp
Source/WebCore/fileapi/File.h
Source/WebCore/html/FileInputType.cpp
Source/WebCore/platform/chromium/ChromiumDataObject.cpp
Source/WebCore/platform/gtk/ClipboardGtk.cpp
Source/WebCore/platform/mac/ClipboardMac.mm
Source/WebCore/platform/qt/ClipboardQt.cpp
Source/WebCore/platform/win/ClipboardWin.cpp