WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
47700
Make mime type lookup in File::create(path) thread-safe
https://bugs.webkit.org/show_bug.cgi?id=47700
Summary
Make mime type lookup in File::create(path) thread-safe
Kinuko Yasuda
Reported
2010-10-14 16:48:33 PDT
Make mime type lookup in File::create(path) thread-safe. This is dangerous when this code runs on workers. Currently when we create a File object (WebCore/fileapi/File) from a file path, it calls MIMETypeRegistry::getMIMETypeForExtension() to initialize File.type based on the given path. But this is not thread-safe on many platforms.
Attachments
Patch
(10.90 KB, patch)
2011-01-23 22:37 PST
,
Dai Mikurube
no flags
Details
Formatted Diff
Diff
Patch
(11.25 KB, patch)
2011-01-25 03:03 PST
,
Dai Mikurube
no flags
Details
Formatted Diff
Diff
Patch
(11.00 KB, patch)
2011-01-31 20:06 PST
,
Dai Mikurube
no flags
Details
Formatted Diff
Diff
Patch
(12.72 KB, patch)
2011-02-01 23:35 PST
,
Dai Mikurube
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Dai Mikurube
Comment 1
2011-01-23 22:37:57 PST
Created
attachment 79894
[details]
Patch
Dai Mikurube
Comment 2
2011-01-23 22:38:50 PST
Hi, The patch is not to be reviewed (not tested!), but what do you think about it?
Kinuko Yasuda
Comment 3
2011-01-23 23:11:47 PST
Comment on
attachment 79894
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=79894&action=review
Thanks for uploading this. You'd want to wait for David's (or someone who knows very well) comments, but I put a few minor ones:
> Source/WebCore/ChangeLog:20 > + * platform/MIMETypeRegistry.h:
It is generally encouraged to put short change summary (ideally) for each file, maybe the first two files may deserve short summary in this patch?
> Source/WebCore/platform/android/TemporaryLinkStubs.cpp:310 > + ASSERT_NOT_REACHED();
This shouldn't compile if this happens right? How about changing this to more generic check like: ASSERT(isMainThread()); without guards, or only with ENABLE(WORKERS).
Dai Mikurube
Comment 4
2011-01-25 03:03:28 PST
Created
attachment 80040
[details]
Patch
Dai Mikurube
Comment 5
2011-01-25 03:07:15 PST
Comment on
attachment 79894
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=79894&action=review
Hi Kinuko-san, Thank you for your comments.
>> Source/WebCore/ChangeLog:20 >> + * platform/MIMETypeRegistry.h: > > It is generally encouraged to put short change summary (ideally) for each file, maybe the first two files may deserve short summary in this patch?
Exactly. I've added summary.
>> Source/WebCore/platform/android/TemporaryLinkStubs.cpp:310 >> + ASSERT_NOT_REACHED(); > > This shouldn't compile if this happens right? > > How about changing this to more generic check like: > ASSERT(isMainThread()); > without guards, or only with ENABLE(WORKERS).
Changed as your advice. Thanks.
Kinuko Yasuda
Comment 6
2011-01-28 02:44:13 PST
lgtm; now you'll need a real reviewer.
Adam Barth
Comment 7
2011-01-28 11:19:10 PST
Comment on
attachment 80040
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=80040&action=review
> Source/WebCore/platform/mac/MIMETypeRegistryMac.mm:39 > +#if ENABLE(WORKERS) > + ASSERT(isMainThread()); > +#endif
Can we make these asserts even if we haven't enabled workers?
Dai Mikurube
Comment 8
2011-01-31 20:06:25 PST
Created
attachment 80710
[details]
Patch
Dai Mikurube
Comment 9
2011-01-31 20:07:46 PST
(In reply to
comment #7
) HI Adam, Thank you for your review. I've removed #if ENABLED(WORKERS).
David Levin
Comment 10
2011-02-01 08:57:40 PST
Comment on
attachment 80710
[details]
Patch This looks good. One last thing to fix up wherever you added ASSERT(isMainThread()); please make sure that the file has the following includes: #include <wtf/Assertions.h> #include <wtf/MainThread.h> I spot checked MIMETypeRegistryWinCE.cpp and MimeTypeRegistryWx.cpp and noticed they didn't have these so those builds may get broken by this change.
Dai Mikurube
Comment 11
2011-02-01 23:35:08 PST
Created
attachment 80898
[details]
Patch
Dai Mikurube
Comment 12
2011-02-01 23:36:05 PST
(In reply to
comment #10
) Hi Levin, Thank you for your review. Added the header files!
WebKit Commit Bot
Comment 13
2011-02-02 00:24:23 PST
Comment on
attachment 80898
[details]
Patch Clearing flags on attachment: 80898 Committed
r77368
: <
http://trac.webkit.org/changeset/77368
>
WebKit Commit Bot
Comment 14
2011-02-02 00:24:29 PST
All reviewed patches have been landed. Closing bug.
David Levin
Comment 15
2011-02-09 15:32:07 PST
***
Bug 35616
has been marked as a duplicate of this bug. ***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug