<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>178013</bug_id>
          
          <creation_ts>2017-10-06 09:42:38 -0700</creation_ts>
          <short_desc>Regression(r220210?) Crash at com.apple.WebCore: WebCore::JSMutationCallback::handleEvent + 419</short_desc>
          <delta_ts>2017-10-06 09:43:37 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Bindings</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>174140</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Dumez">cdumez</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>cdumez</cc>
    
    <cc>sam</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1357622</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-10-06 09:42:38 -0700</bug_when>
    <thetext>Crash at com.apple.WebCore: WebCore::JSMutationCallback::handleEvent + 419:
Thread[0] EXC_BAD_ACCESS (SIGSEGV) (KERN_INVALID_ADDRESS at 0x0000000000000000)
[  0] 0x000000010f3242d5 WebCore`WebCore::JSCallbackData::invokeCallback(WebCore::JSDOMGlobalObject&amp;, JSC::JSObject*, JSC::JSValue, JSC::MarkedArgumentBuffer&amp;, WebCore::JSCallbackData::CallbackType, JSC::PropertyName, WTF::NakedPtr&lt;JSC::Exception&gt;&amp;) [inlined] JSC::JSCell::structure(JSC::VM&amp;) const at JSCellInlines.h:115:28

     0x000000010f3242c4:      orq $0x98, %rcx
     0x000000010f3242cb:    testb $0x8, %bl
     0x000000010f3242ce:  cmovneq %rax, %rcx
     0x000000010f3242d2:     movq (%rcx), %rax
 -&gt;  0x000000010f3242d5:     movl (%rbx), %ecx
     0x000000010f3242d7:     andl $0x7fffffff, %ecx    ; imm = 0x7FFFFFFF 
     0x000000010f3242dd:     movq 0xe8(%rax), %rax
     0x000000010f3242e4:     movq (%rax,%rcx,8), %rax
     0x000000010f3242e8:     movq 0x40(%rax), %rax

[  0] 0x000000010f3242d5 WebCore`WebCore::JSCallbackData::invokeCallback(WebCore::JSDOMGlobalObject&amp;, JSC::JSObject*, JSC::JSValue, JSC::MarkedArgumentBuffer&amp;, WebCore::JSCallbackData::CallbackType, JSC::PropertyName, WTF::NakedPtr&lt;JSC::Exception&gt;&amp;) [inlined] JSC::JSCell::methodTable(JSC::VM&amp;) const at JSCellInlines.h:259
[  0] 0x000000010f3242d5 WebCore`WebCore::JSCallbackData::invokeCallback(WebCore::JSDOMGlobalObject&amp;, JSC::JSObject*, JSC::JSValue, JSC::MarkedArgumentBuffer&amp;, WebCore::JSCallbackData::CallbackType, JSC::PropertyName, WTF::NakedPtr&lt;JSC::Exception&gt;&amp;) [inlined] JSC::JSCell::methodTable() const + 36 at JSCellInlines.h:254
[  0] 0x000000010f3242b1 WebCore`WebCore::JSCallbackData::invokeCallback(WebCore::JSDOMGlobalObject&amp;, JSC::JSObject*, JSC::JSValue, JSC::MarkedArgumentBuffer&amp;, WebCore::JSCallbackData::CallbackType, JSC::PropertyName, WTF::NakedPtr&lt;JSC::Exception&gt;&amp;) + 65 at JSCallbackData.cpp:53
       49  	    CallType callType = CallType::None;
       50  	
       51  	    if (method != CallbackType::Object) {
       52  	        function = callback;
    -&gt; 53  	        callType = callback-&gt;methodTable()-&gt;getCallData(callback, callData);
       54  	    }
       55  	    if (callType == CallType::None) {
       56  	        if (method == CallbackType::Function) {
       57  	            returnedException = JSC::Exception::create(exec-&gt;vm(), createTypeError(exec));
    
[  1] 0x000000010f59e0d2 WebCore`WebCore::JSMutationCallback::handleEvent(WebCore::MutationObserver&amp;, WTF::Vector&lt;WTF::Ref&lt;WebCore::MutationRecord&gt;, 0ul, WTF::CrashOnOverflow, 16ul&gt; const&amp;, WebCore::MutationObserver&amp;) [inlined] WebCore::JSCallbackDataWeak::invokeCallback(JSC::JSValue, JSC::MarkedArgumentBuffer&amp;, WebCore::JSCallbackData::CallbackType, JSC::PropertyName, WTF::NakedPtr&lt;JSC::Exception&gt;&amp;) + 88 at JSCallbackData.h:115:16
[  1] 0x000000010f59e07a WebCore`WebCore::JSMutationCallback::handleEvent(WebCore::MutationObserver&amp;, WTF::Vector&lt;WTF::Ref&lt;WebCore::MutationRecord&gt;, 0ul, WTF::CrashOnOverflow, 16ul&gt; const&amp;, WebCore::MutationObserver&amp;) + 330 at JSMutationCallback.cpp:75
[  2] 0x000000010f876be2 WebCore`WebCore::MutationObserver::deliver() + 818 at MutationObserver.cpp:235:5
[  3] 0x000000010f877347 WebCore`WebCore::MutationObserver::notifyMutationObservers() + 1719 at MutationObserver.cpp:283:17
[  4] 0x000000010f8776c8 WebCore`WebCore::MutationObserverMicrotask::run() + 8 at MutationObserver.cpp:163:9
[  5] 0x000000010f860b79 WebCore`WebCore::MicrotaskQueue::performMicrotaskCheckpoint() + 121 at Microtasks.cpp:85:27
[  6] 0x000000010f574cc5 WebCore`WebCore::JSMainThreadExecState::didLeaveScriptContext(JSC::ExecState*) + 21 at JSMainThreadExecState.cpp:40:5</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1357624</commentid>
    <comment_count>1</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-10-06 09:42:54 -0700</bug_when>
    <thetext>&lt;rdar://problem/34062022&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1357626</commentid>
    <comment_count>2</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2017-10-06 09:43:37 -0700</bug_when>
    <thetext>Looks like the MutationObserver and its MutationCallback are alive. However, the underlying callback JSObject is dead. JSCallbackDataWeak stores the callback as:
JSC::Weak&lt;JSC::JSObject&gt; m_callback;

Since it is weak, it can in theory go away. I see we have visitors code (which I do not fully understand) marking the callback.

Sam, any idea?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>