<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[179481] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/179481">179481</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2015-02-02 11:47:06 -0800 (Mon, 02 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS] ASSERTION FAILED: m_scriptExecutionContext-&gt;isContextThread() in ContextDestructionObserver::observeContext
https://bugs.webkit.org/show_bug.cgi?id=141057
&lt;rdar://problem/19068790&gt;

Reviewed by Alexey Proskuryakov.

Source/JavaScriptCore:

* inspector/remote/RemoteInspector.mm:
(Inspector::RemoteInspector::receivedIndicateMessage): Modified to call WTF::callOnWebThreadOrDispatchAsyncOnMainThread().
(Inspector::dispatchAsyncOnQueueSafeForAnyDebuggable): Deleted; moved logic to common helper function,
WTF::callOnWebThreadOrDispatchAsyncOnMainThread() so that it can be called from both RemoteInspector::receivedIndicateMessage()
and CryptoKeyRSA::generatePair().

Source/WebCore:

Fixes an issue where we would create-/delete- the RSA crypto keys and dispatch callbacks on the wrong
thread in WebKit1 for iOS. In iOS WebKit1 we should perform such operations on thread WebThread.

This change is covered by existing layout tests.

* crypto/mac/CryptoKeyRSAMac.cpp:
(WebCore::CryptoKeyRSA::generatePair):

Source/WTF:

* wtf/MainThread.h:
* wtf/mac/MainThreadMac.mm:
(WTF::callOnWebThreadOrDispatchAsyncOnMainThread): Added.

LayoutTests:

Un-skip crypto tests. Also, group skip entries for tests crypto/subtle/{rsa-indexeddb, rsa-indexeddb-non-exportable}.html
with other skipped IndexedDB tests.

* platform/ios-simulator/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorremoteRemoteInspectormm">trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfMainThreadh">trunk/Source/WTF/wtf/MainThread.h</a></li>
<li><a href="#trunkSourceWTFwtfmacMainThreadMacmm">trunk/Source/WTF/wtf/mac/MainThreadMac.mm</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoKeyRSAMaccpp">trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (179480 => 179481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-02-02 19:40:57 UTC (rev 179480)
+++ trunk/LayoutTests/ChangeLog        2015-02-02 19:47:06 UTC (rev 179481)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-02-02  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        [iOS] ASSERTION FAILED: m_scriptExecutionContext-&gt;isContextThread() in ContextDestructionObserver::observeContext
+        https://bugs.webkit.org/show_bug.cgi?id=141057
+        &lt;rdar://problem/19068790&gt;
+
+        Reviewed by Alexey Proskuryakov.
+
+        Un-skip crypto tests. Also, group skip entries for tests crypto/subtle/{rsa-indexeddb, rsa-indexeddb-non-exportable}.html
+        with other skipped IndexedDB tests.
+
+        * platform/ios-simulator/TestExpectations:
+
</ins><span class="cx"> 2015-02-01  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r179467 and r179470.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (179480 => 179481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2015-02-02 19:40:57 UTC (rev 179480)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2015-02-02 19:47:06 UTC (rev 179481)
</span><span class="lines">@@ -70,6 +70,8 @@
</span><span class="cx"> # IndexedDB is not supported on iOS
</span><span class="cx"> storage/indexeddb
</span><span class="cx"> inspector-protocol/indexeddb/basics.html
</span><ins>+crypto/subtle/rsa-indexeddb-non-exportable.html
+crypto/subtle/rsa-indexeddb.html
</ins><span class="cx"> 
</span><span class="cx"> # Quota API is not supported on iOS
</span><span class="cx"> storage/domstorage/quota.html
</span><span class="lines">@@ -287,21 +289,9 @@
</span><span class="cx"> # Canvas tests that have stderr:
</span><span class="cx"> canvas/philip/tests/2d.canvas.readonly.html [ Skip ]
</span><span class="cx"> 
</span><del>-# &lt;rdar://problem/19068790&gt; ASSERTION FAILED: m_scriptExecutionContext-&gt;isContextThread() in ContextDestructionObserver::observeContext
-crypto/subtle/rsa-oaep-generate-non-extractable-key.html [ Skip ]
-crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html [ Skip ]
-crypto/subtle/rsa-oaep-key-manipulation.html [ Skip ]
</del><ins>+# HTTP tests that time out:
</ins><span class="cx"> http/tests/security/XFrameOptions/x-frame-options-deny-delete-frame-in-load-event.html
</span><span class="cx"> 
</span><del>-# &lt;rdar://problem/19068796&gt; ASSERTION FAILED: crypto/subtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html fails ASSERT(m_scriptExecutionContext-&gt;isContextThread())
-crypto/subtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html [ Skip ]
-
-# Crypto tests that time out:
-crypto/subtle/rsa-indexeddb-non-exportable.html
-crypto/subtle/rsa-indexeddb.html
-crypto/subtle/rsa-oaep-plaintext-length.html [ Skip ] # Timeout, Pass
-crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html [ Skip ]
-
</del><span class="cx"> # Compositing tests that fail:
</span><span class="cx"> compositing/regions/abs-transformed-dynamic-update.html [ ImageOnlyFailure ]
</span><span class="cx"> compositing/regions/fixed-in-diff-named-flows-zIndex.html [ ImageOnlyFailure ]
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (179480 => 179481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-02-02 19:40:57 UTC (rev 179480)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-02-02 19:47:06 UTC (rev 179481)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-02-02  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        [iOS] ASSERTION FAILED: m_scriptExecutionContext-&gt;isContextThread() in ContextDestructionObserver::observeContext
+        https://bugs.webkit.org/show_bug.cgi?id=141057
+        &lt;rdar://problem/19068790&gt;
+
+        Reviewed by Alexey Proskuryakov.
+
+        * inspector/remote/RemoteInspector.mm:
+        (Inspector::RemoteInspector::receivedIndicateMessage): Modified to call WTF::callOnWebThreadOrDispatchAsyncOnMainThread().
+        (Inspector::dispatchAsyncOnQueueSafeForAnyDebuggable): Deleted; moved logic to common helper function,
+        WTF::callOnWebThreadOrDispatchAsyncOnMainThread() so that it can be called from both RemoteInspector::receivedIndicateMessage()
+        and CryptoKeyRSA::generatePair().
+
</ins><span class="cx"> 2015-02-02  Saam Barati  &lt;saambarati1@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Create tests for JSC's Control Flow Profiler
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorremoteRemoteInspectormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm (179480 => 179481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm        2015-02-02 19:40:57 UTC (rev 179480)
+++ trunk/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm        2015-02-02 19:47:06 UTC (rev 179481)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #import &lt;dispatch/dispatch.h&gt;
</span><span class="cx"> #import &lt;notify.h&gt;
</span><span class="cx"> #import &lt;wtf/Assertions.h&gt;
</span><ins>+#import &lt;wtf/MainThread.h&gt;
</ins><span class="cx"> #import &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> #import &lt;wtf/spi/darwin/XPCSPI.h&gt;
</span><span class="cx"> #import &lt;wtf/text/WTFString.h&gt;
</span><span class="lines">@@ -51,10 +52,6 @@
</span><span class="cx"> extern &quot;C&quot; int sandbox_check(pid_t, const char *operation, enum sandbox_filter_type, ...);
</span><span class="cx"> extern &quot;C&quot; const enum sandbox_filter_type SANDBOX_CHECK_NO_REPORT;
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
-#import &lt;wtf/ios/WebCoreThread.h&gt;
-#endif
-
</del><span class="cx"> namespace Inspector {
</span><span class="cx"> 
</span><span class="cx"> static bool canAccessWebInspectorMachPort()
</span><span class="lines">@@ -73,18 +70,6 @@
</span><span class="cx">     return automaticInspectionEnabled == 1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void dispatchAsyncOnQueueSafeForAnyDebuggable(void (^block)())
-{
-#if PLATFORM(IOS)
-    if (WebCoreWebThreadIsEnabled &amp;&amp; WebCoreWebThreadIsEnabled()) {
-        WebCoreWebThreadRun(block);
-        return;
-    }
-#endif
-
-    dispatch_async(dispatch_get_main_queue(), block);
-}
-
</del><span class="cx"> bool RemoteInspector::startEnabled = true;
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::startDisabled()
</span><span class="lines">@@ -643,7 +628,7 @@
</span><span class="cx">     unsigned identifier = [pageId unsignedIntValue];
</span><span class="cx">     BOOL indicateEnabled = [[userInfo objectForKey:WIRIndicateEnabledKey] boolValue];
</span><span class="cx"> 
</span><del>-    dispatchAsyncOnQueueSafeForAnyDebuggable(^{
</del><ins>+    callOnWebThreadOrDispatchAsyncOnMainThread(^{
</ins><span class="cx">         RemoteInspectorDebuggable* debuggable = nullptr;
</span><span class="cx">         {
</span><span class="cx">             std::lock_guard&lt;std::mutex&gt; lock(m_mutex);
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (179480 => 179481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-02-02 19:40:57 UTC (rev 179480)
+++ trunk/Source/WTF/ChangeLog        2015-02-02 19:47:06 UTC (rev 179481)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-02-02  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        [iOS] ASSERTION FAILED: m_scriptExecutionContext-&gt;isContextThread() in ContextDestructionObserver::observeContext
+        https://bugs.webkit.org/show_bug.cgi?id=141057
+        &lt;rdar://problem/19068790&gt;
+
+        Reviewed by Alexey Proskuryakov.
+
+        * wtf/MainThread.h:
+        * wtf/mac/MainThreadMac.mm:
+        (WTF::callOnWebThreadOrDispatchAsyncOnMainThread): Added.
+
</ins><span class="cx"> 2015-01-31  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove even more Mountain Lion support
</span></span></pre></div>
<a id="trunkSourceWTFwtfMainThreadh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/MainThread.h (179480 => 179481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/MainThread.h        2015-02-02 19:40:57 UTC (rev 179480)
+++ trunk/Source/WTF/wtf/MainThread.h        2015-02-02 19:47:06 UTC (rev 179481)
</span><span class="lines">@@ -46,6 +46,10 @@
</span><span class="cx"> 
</span><span class="cx"> WTF_EXPORT_PRIVATE void callOnMainThread(std::function&lt;void ()&gt;);
</span><span class="cx"> 
</span><ins>+#if PLATFORM(COCOA)
+WTF_EXPORT_PRIVATE void callOnWebThreadOrDispatchAsyncOnMainThread(void (^block)());
+#endif
+
</ins><span class="cx"> WTF_EXPORT_PRIVATE void setMainThreadCallbacksPaused(bool paused);
</span><span class="cx"> 
</span><span class="cx"> WTF_EXPORT_PRIVATE bool isMainThread();
</span><span class="lines">@@ -94,6 +98,9 @@
</span><span class="cx"> 
</span><span class="cx"> using WTF::callOnMainThread;
</span><span class="cx"> using WTF::cancelCallOnMainThread;
</span><ins>+#if PLATFORM(COCOA)
+using WTF::callOnWebThreadOrDispatchAsyncOnMainThread;
+#endif
</ins><span class="cx"> using WTF::setMainThreadCallbacksPaused;
</span><span class="cx"> using WTF::isMainThread;
</span><span class="cx"> using WTF::isMainThreadOrGCThread;
</span></span></pre></div>
<a id="trunkSourceWTFwtfmacMainThreadMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/mac/MainThreadMac.mm (179480 => 179481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/mac/MainThreadMac.mm        2015-02-02 19:40:57 UTC (rev 179480)
+++ trunk/Source/WTF/wtf/mac/MainThreadMac.mm        2015-02-02 19:47:06 UTC (rev 179481)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> 
</span><span class="cx"> #import &lt;CoreFoundation/CoreFoundation.h&gt;
</span><span class="cx"> #import &lt;Foundation/NSThread.h&gt;
</span><ins>+#import &lt;dispatch/dispatch.h&gt;
</ins><span class="cx"> #import &lt;stdio.h&gt;
</span><span class="cx"> #import &lt;wtf/Assertions.h&gt;
</span><span class="cx"> #import &lt;wtf/HashSet.h&gt;
</span><span class="lines">@@ -142,7 +143,18 @@
</span><span class="cx">     [staticMainThreadCaller performSelector:@selector(call) onThread:mainThreadNSThread withObject:nil waitUntilDone:NO];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void callOnWebThreadOrDispatchAsyncOnMainThread(void (^block)())
+{
</ins><span class="cx"> #if USE(WEB_THREAD)
</span><ins>+    if (WebCoreWebThreadIsEnabled &amp;&amp; WebCoreWebThreadIsEnabled()) {
+        WebCoreWebThreadRun(block);
+        return;
+    }
+#endif
+    dispatch_async(dispatch_get_main_queue(), block);
+}
+
+#if USE(WEB_THREAD)
</ins><span class="cx"> static bool webThreadIsUninitializedOrLockedOrDisabled()
</span><span class="cx"> {
</span><span class="cx">     return !WebCoreWebThreadIsLockedOrDisabled || WebCoreWebThreadIsLockedOrDisabled();
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (179480 => 179481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-02 19:40:57 UTC (rev 179480)
+++ trunk/Source/WebCore/ChangeLog        2015-02-02 19:47:06 UTC (rev 179481)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-02-02  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        [iOS] ASSERTION FAILED: m_scriptExecutionContext-&gt;isContextThread() in ContextDestructionObserver::observeContext
+        https://bugs.webkit.org/show_bug.cgi?id=141057
+        &lt;rdar://problem/19068790&gt;
+
+        Reviewed by Alexey Proskuryakov.
+
+        Fixes an issue where we would create-/delete- the RSA crypto keys and dispatch callbacks on the wrong
+        thread in WebKit1 for iOS. In iOS WebKit1 we should perform such operations on thread WebThread.
+
+        This change is covered by existing layout tests.
+
+        * crypto/mac/CryptoKeyRSAMac.cpp:
+        (WebCore::CryptoKeyRSA::generatePair):
+
</ins><span class="cx"> 2015-02-02  Jeremy Jones  &lt;jeremyj@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Prevent crash when accessing WebAVPlayerController.delegate.
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoKeyRSAMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp (179480 => 179481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp        2015-02-02 19:40:57 UTC (rev 179480)
+++ trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp        2015-02-02 19:47:06 UTC (rev 179481)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include &quot;CryptoAlgorithmRegistry.h&quot;
</span><span class="cx"> #include &quot;CryptoKeyDataRSAComponents.h&quot;
</span><span class="cx"> #include &quot;CryptoKeyPair.h&quot;
</span><ins>+#include &lt;wtf/MainThread.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -258,13 +259,13 @@
</span><span class="cx">         CCCryptorStatus status = CCRSACryptorGeneratePair(modulusLength, e, &amp;ccPublicKey, &amp;ccPrivateKey);
</span><span class="cx">         if (status) {
</span><span class="cx">             WTFLogAlways(&quot;Could not generate a key pair, status %d&quot;, status);
</span><del>-            dispatch_async(dispatch_get_main_queue(), ^{
</del><ins>+            callOnWebThreadOrDispatchAsyncOnMainThread(^{
</ins><span class="cx">                 (*localFailureCallback)();
</span><span class="cx">                 delete localFailureCallback;
</span><span class="cx">             });
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        dispatch_async(dispatch_get_main_queue(), ^{
</del><ins>+        callOnWebThreadOrDispatchAsyncOnMainThread(^{
</ins><span class="cx">             RefPtr&lt;CryptoKeyRSA&gt; publicKey = CryptoKeyRSA::create(algorithm, CryptoKeyType::Public, ccPublicKey, true, usage);
</span><span class="cx">             RefPtr&lt;CryptoKeyRSA&gt; privateKey = CryptoKeyRSA::create(algorithm, CryptoKeyType::Private, ccPrivateKey, extractable, usage);
</span><span class="cx">             (*localCallback)(CryptoKeyPair::create(publicKey.release(), privateKey.release()));
</span></span></pre>
</div>
</div>

</body>
</html>