Title: [228716] trunk/Source/WebCore
Revision
228716
Author
cdu...@apple.com
Date
2018-02-19 16:20:53 -0800 (Mon, 19 Feb 2018)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (228715 => 228716)


--- trunk/Source/WebCore/ChangeLog	2018-02-20 00:04:40 UTC (rev 228715)
+++ trunk/Source/WebCore/ChangeLog	2018-02-20 00:20:53 UTC (rev 228716)
@@ -1,3 +1,24 @@
+2018-02-19  Chris Dumez  <cdu...@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  <d...@apple.com>
 
         SIGFPE @ int WebCore::SVGToOTFFontConverter::scaleUnitsPerEm<int> const + 45

Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.cpp (228715 => 228716)


--- trunk/Source/WebCore/platform/MIMETypeRegistry.cpp	2018-02-20 00:04:40 UTC (rev 228715)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.cpp	2018-02-20 00:20:53 UTC (rev 228716)
@@ -492,6 +492,15 @@
 {
     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);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to