Bug 182927 - Crash under MIMETypeRegistry::isSupportedJavaScriptMIMEType()
Summary: Crash under MIMETypeRegistry::isSupportedJavaScriptMIMEType()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Service Workers (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-02-19 10:19 PST by Chris Dumez
Modified: 2018-02-19 16:21 PST (History)
6 users (show)

See Also:


Attachments
Patch (2.10 KB, patch)
2018-02-19 14:04 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2018-02-19 10:19:21 PST
Crash under MIMETypeRegistry::isSupportedJavaScriptMIMEType():
Thread 6 Crashed:: WebCore: Worker
0   com.apple.WebCore             	0x00007fff565cbfc0 unsigned int WTF::StringHasher::computeHashAndMaskTop8Bits<unsigned short, WTF::ASCIICaseInsensitiveHash::FoldCase<unsigned short> >(unsigned short const*, unsigned int) + 32
1   com.apple.WebCore             	0x00007fff5662929e WTF::String* WTF::HashTable<WTF::String, WTF::String, WTF::IdentityExtractor, WTF::ASCIICaseInsensitiveHash, WTF::HashTraits<WTF::String>, WTF::HashTraits<WTF::String> >::lookup<WTF::IdentityHashTranslator<WTF::HashTraits<WTF::String>, WTF::ASCIICaseInsensitiveHash>, WTF::String>(WTF::String const&) + 46
2   com.apple.WebCore             	0x00007fff564409cd WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType(WTF::String const&) + 61
3   com.apple.WebCore             	0x00007fff577f6bc6 WebCore::ServiceWorkerJob::didReceiveResponse(unsigned long, WebCore::ResourceResponse const&) + 134
4   com.apple.WebCore             	0x00007fff577e508b WebCore::WorkerScriptLoader::didReceiveResponse(unsigned long, WebCore::ResourceResponse const&) + 539
5   com.apple.WebCore             	0x00007fff57302480 WTF::Function<void (WebCore::ScriptExecutionContext&)>::CallableWrapper<WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveResponse(unsigned long, WebCore::ResourceResponse const&)::$_9>::call(WebCore::ScriptExecutionContext&) + 80
6   com.apple.WebCore             	0x00007fff577e3cf0 WebCore::WorkerRunLoop::runInMode(WebCore::WorkerGlobalScope*, WebCore::ModePredicate const&, WebCore::WorkerRunLoop::WaitMode) + 416
7   com.apple.WebCore             	0x00007fff577e3af0 WebCore::WorkerRunLoop::run(WebCore::WorkerGlobalScope*) + 96
8   com.apple.WebCore             	0x00007fff577e6096 WebCore::WorkerThread::workerThread() + 1030
9   com.apple.JavaScriptCore      	0x00007fff4c99eeb4 WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 228
10  com.apple.JavaScriptCore      	0x00007fff4bdb49c9 WTF::wtfThreadEntryPoint(void*) + 9
11  libsystem_pthread.dylib       	0x00007fff714f36c1 _pthread_body + 340
12  libsystem_pthread.dylib       	0x00007fff714f356d _pthread_start + 377
13  libsystem_pthread.dylib       	0x00007fff714f2c5d thread_start + 13
Comment 1 Radar WebKit Bug Importer 2018-02-19 10:19:58 PST
<rdar://problem/37675748>
Comment 2 Chris Dumez 2018-02-19 14:04:34 PST
Created attachment 334185 [details]
Patch
Comment 3 Antti Koivisto 2018-02-19 14:09:45 PST
Comment on attachment 334185 [details]
Patch

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

> Source/WebCore/platform/MIMETypeRegistry.cpp:502
> +    if (!isMainThread()) {
> +        bool isSupported = false;
> +        callOnMainThreadAndWait([&isSupported, mimeType = mimeType.isolatedCopy()] {
> +            isSupported = isSupportedJavaScriptMIMEType(mimeType);
> +        });
> +        return isSupported;
> +    }

It would be nice to make MIMETypeRegistry thread safe in a way that does not involve blocking on main thread.
Comment 4 WebKit Commit Bot 2018-02-19 16:20:58 PST
Comment on attachment 334185 [details]
Patch

Clearing flags on attachment: 334185

Committed r228716: <https://trac.webkit.org/changeset/228716>
Comment 5 WebKit Commit Bot 2018-02-19 16:21:00 PST
All reviewed patches have been landed.  Closing bug.