Skip to content

Commit

Permalink
Merge r228716 - Crash under MIMETypeRegistry::isSupportedJavaScriptMI…
Browse files Browse the repository at this point in the history
…METype()

https://bugs.webkit.org/show_bug.cgi?id=182927
<rdar://problem/37675748>

Reviewed by Antti Koivisto.

Make it safe to call MIMETypeRegistry::isSupportedJavaScriptMIMEType() from the non-main thread.
It is currently being called from a background thread in the following places:
- ServiceWorkerJob::didReceiveResponse()
- WorkerGlobalScope::importScripts()

These call sites on non-main threads were added recently with the support for service workers.

No new tests, already covered by existing tests that flakily experience service worker
process crashes.

* platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType):
  • Loading branch information
cdumez authored and carlosgcampos committed Feb 20, 2018
1 parent 3148dc6 commit e6c3530
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,24 @@
2018-02-19 Chris Dumez <cdumez@apple.com>

Crash under MIMETypeRegistry::isSupportedJavaScriptMIMEType()
https://bugs.webkit.org/show_bug.cgi?id=182927
<rdar://problem/37675748>

Reviewed by Antti Koivisto.

Make it safe to call MIMETypeRegistry::isSupportedJavaScriptMIMEType() from the non-main thread.
It is currently being called from a background thread in the following places:
- ServiceWorkerJob::didReceiveResponse()
- WorkerGlobalScope::importScripts()

These call sites on non-main threads were added recently with the support for service workers.

No new tests, already covered by existing tests that flakily experience service worker
process crashes.

* platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType):

2018-02-19 Dean Jackson <dino@apple.com>

SIGFPE @ int WebCore::SVGToOTFFontConverter::scaleUnitsPerEm<int> const + 45
Expand Down
9 changes: 9 additions & 0 deletions Source/WebCore/platform/MIMETypeRegistry.cpp
Expand Up @@ -492,6 +492,15 @@ bool MIMETypeRegistry::isSupportedJavaScriptMIMEType(const String& mimeType)
{
if (mimeType.isEmpty())
return false;

if (!isMainThread()) {
bool isSupported = false;
callOnMainThreadAndWait([&isSupported, mimeType = mimeType.isolatedCopy()] {
isSupported = isSupportedJavaScriptMIMEType(mimeType);
});
return isSupported;
}

if (!supportedJavaScriptMIMETypes)
initializeSupportedNonImageMimeTypes();
return supportedJavaScriptMIMETypes->contains(mimeType);
Expand Down

0 comments on commit e6c3530

Please sign in to comment.