<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Calling then on promise in Workers may crash in Debug builds"
   href="https://bugs.webkit.org/show_bug.cgi?id=156737#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Calling then on promise in Workers may crash in Debug builds"
   href="https://bugs.webkit.org/show_bug.cgi?id=156737">bug 156737</a>
              from <span class="vcard"><a class="email" href="mailto:youennf&#64;gmail.com" title="youenn fablet &lt;youennf&#64;gmail.com&gt;"> <span class="fn">youenn fablet</span></a>
</span></b>
        <pre>
The following test sample crashes sometimes (not very often) on Mac and GTK when run through rwt with the following options &quot;--debug -f --iterations=1000&quot;

&lt;!DOCTYPE html&gt;
&lt;meta charset=&quot;utf-8&quot;&gt;
&lt;div id=&quot;title&quot;&gt;Testing promise chaining in workers. This test passes if not crashing.&lt;/div&gt;
&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
&lt;script&gt;
    var worker = new Worker(window.URL.createObjectURL(new Blob(
        [&quot;Promise.resolve().then();\n&quot;,
         &quot;postMessage('done');&quot;],
        { &quot;type&quot; : &quot;text\/javascript&quot; })));
    worker.onmessage = function() {
        document.getElementById(&quot;log&quot;).innerHTML = &quot;PASS&quot;
        if (window.testRunner)
            testRunner.notifyDone();
    };

    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
    }
&lt;/script&gt;

The log is similar to the one in <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - imported/w3c/web-platform-tests/streams-api/readable-streams/garbage-collection-1.html is a flaky crash on Mac debug"
   href="show_bug.cgi?id=153781">bug 153781</a>:
For GTK:
STDERR: ASSERTION FAILED: !exec-&gt;hadException()
STDERR: ../../Source/WebCore/bindings/js/JSDOMGlobalObjectTask.cpp(67) : void WebCore::JSGlobalObjectCallback::call()
STDERR: 1   0x7f2202ca87ad /localHome/youenn/WebKit/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(WTFCrash+0x1e) [0x7f2202ca87ad]
STDERR: 2   0x7f22094c8e4d /localHome/youenn/WebKit/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::JSGlobalObjectCallback::call()+0x143) [0x7f22094c8e4d]
STDERR: 3   0x7f22094c8680 /localHome/youenn/WebKit/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(+0x5680680) [0x7f22094c8680]
STDERR: 4   0x7f22094c89b4 /localHome/youenn/WebKit/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(+0x56809b4) [0x7f22094c89b4]
STDERR: 5   0x7f22093e5c27 /localHome/youenn/WebKit/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(std::function&lt;void (WebCore::ScriptExecutionContext&amp;)&gt;::operator()(WebCore::ScriptExecutionContext&amp;) const+0x49) [0x7f22093e5c27]
STDERR: 6   0x7f22093e5b6f /localHome/youenn/WebKit/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::ScriptExecutionContext::Task::performTask(WebCore::ScriptExecutionContext&amp;)+0x23) [0x7f22093e5b6f]
STDERR: 7   0x7f220a61b3fb /localHome/youenn/WebKit/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebCore::WorkerRunLoop::Task::performTask(WebCore::WorkerRunLoop const&amp;, WebCore::WorkerGlobalScope*)+0x6d) [0x7f220a61b3fb]

For MAC:
ASSERTION FAILED: !exec-&gt;hadException()
/Users/youenn/Documents/WebKit/Source/WebCore/bindings/js/JSDOMGlobalObjectTask.cpp(91) : void WebCore::JSGlobalObjectCallback::call()
1   0x11209c821 WTFCrash
2   0x1189d27ac WebCore::JSGlobalObjectCallback::call()
3   0x1189cef71 WebCore::JSGlobalObjectTask::JSGlobalObjectTask(WebCore::JSDOMGlobalObject*, WTF::PassRefPtr&lt;JSC::Microtask&gt;)::$_0::operator()(WebCore::ScriptExecutionContext&amp;) const
4   0x1189cef3d _ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN7WebCore18JSGlobalObjectTaskC1EPNS3_17JSDOMGlobalObjectEN3WTF10PassRefPtrIN3JSC9MicrotaskEEEE3$_0RNS3_22ScriptExecutionContextEEEEvDpOT_
5   0x1189ceda9 std::__1::__function::__func&lt;WebCore::JSGlobalObjectTask::JSGlobalObjectTask(WebCore::JSDOMGlobalObject*, WTF::PassRefPtr&lt;JSC::Microtask&gt;)::$_0, std::__1::allocator&lt;WebCore::JSGlobalObjectTask::JSGlobalObjectTask(WebCore::JSDOMGlobalObject*, WTF::PassRefPtr&lt;JSC::Microtask&gt;)::$_0&gt;, void (WebCore::ScriptExecutionContext&amp;)&gt;::operator()(WebCore::ScriptExecutionContext&amp;)
6   0x116f98b08 std::__1::function&lt;void (WebCore::ScriptExecutionContext&amp;)&gt;::operator()(WebCore::ScriptExecutionContext&amp;) const</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>