<?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>175923</bug_id>
          
          <creation_ts>2017-08-23 20:17:07 -0700</creation_ts>
          <short_desc>[iOS WK2] editing/execCommand/forward-delete-read-write-canvas.html hits a debug assertion in Position::Position</short_desc>
          <delta_ts>2017-08-26 15:18:05 -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>HTML Editing</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=175939</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Wenson Hsieh">wenson_hsieh</reporter>
          <assigned_to name="Wenson Hsieh">wenson_hsieh</assigned_to>
          <cc>ryanhaddad</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1341950</commentid>
    <comment_count>0</comment_count>
    <who name="Wenson Hsieh">wenson_hsieh</who>
    <bug_when>2017-08-23 20:17:07 -0700</bug_when>
    <thetext>Test case: load the following HTML:

```
&lt;code style=&quot;color: green&quot;&gt;PASS&lt;/code&gt;
&lt;canvas style=&quot;-webkit-user-modify: read-write&quot;&gt;&lt;input id=&quot;input&quot;&gt;&lt;/canvas&gt;
&lt;script&gt;
if (window.testRunner)
    testRunner.dumpAsText();
input.focus();
input.remove();
document.execCommand(&quot;ForwardDelete&quot;);
&lt;/script&gt;
```

...and observe an assertion like this:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.JavaScriptCore      	0x0000000109518c27 WTFCrash + 39 (Assertions.cpp:278)
1   com.apple.WebCore             	0x0000000112e51747 WebCore::Position::Position(WebCore::Node*, int, WebCore::Position::AnchorType) + 183 (Position.cpp:130)
2   com.apple.WebCore             	0x0000000112e51819 WebCore::Position::Position(WebCore::Node*, int, WebCore::Position::AnchorType) + 41 (Position.cpp:133)
3   com.apple.WebCore             	0x0000000110cd62bc WebCore::positionInParentBeforeNode(WebCore::Node const*) + 124 (Position.h:266)
4   com.apple.WebCore             	0x0000000111570f2e WebCore::updatePositionForNodeRemoval(WebCore::Position&amp;, WebCore::Node&amp;) + 270 (Editing.cpp:960)
5   com.apple.WebCore             	0x00000001117f9dba WebCore::FrameSelection::respondToNodeModification(WebCore::Node&amp;, bool, bool, bool, bool) + 170 (FrameSelection.cpp:472)
6   com.apple.WebCore             	0x00000001117f9cdd WebCore::FrameSelection::nodeWillBeRemoved(WebCore::Node&amp;) + 349 (FrameSelection.cpp:458)
7   com.apple.WebCore             	0x000000011141b3a8 WebCore::Document::nodeWillBeRemoved(WebCore::Node&amp;) + 584 (Document.cpp:4075)
8   com.apple.WebCore             	0x000000011103ece8 WebCore::ContainerNode::removeChild(WebCore::Node&amp;) + 456 (ContainerNode.cpp:544)
9   com.apple.WebCore             	0x0000000112d2a4ad WebCore::Node::remove() + 109 (Node.cpp:565)
10  com.apple.WebCore             	0x000000011215a0cd WebCore::jsElementPrototypeFunctionRemoveBody(JSC::ExecState*, WebCore::JSElement*, JSC::ThrowScope&amp;) + 77 (JSElement.cpp:2641)
11  com.apple.WebCore             	0x0000000112152717 long long WebCore::IDLOperation&lt;WebCore::JSElement&gt;::call&lt;&amp;(WebCore::jsElementPrototypeFunctionRemoveBody(JSC::ExecState*, WebCore::JSElement*, JSC::ThrowScope&amp;)), (WebCore::CastedThisErrorBehavior)0&gt;(JSC::ExecState&amp;, char const*) + 615 (JSDOMOperation.h:53)
12  com.apple.WebCore             	0x000000011214595c WebCore::jsElementPrototypeFunctionRemove(JSC::ExecState*) + 28 (JSElement.cpp:2647)
13  ???                           	0x00005c9ab8001028 0 + 101819581730856
14  com.apple.JavaScriptCore      	0x00000001090853d6 llint_entry + 31248
15  com.apple.JavaScriptCore      	0x000000010907d7a7 vmEntryToJavaScript + 343
16  com.apple.JavaScriptCore      	0x0000000108e4bc21 JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) + 353 (JITCode.cpp:81)
17  com.apple.JavaScriptCore      	0x0000000108df8853 JSC::Interpreter::executeProgram(JSC::SourceCode const&amp;, JSC::ExecState*, JSC::JSObject*) + 5283 (Interpreter.cpp:912)
18  com.apple.JavaScriptCore      	0x0000000108648368 JSC::evaluate(JSC::ExecState*, JSC::SourceCode const&amp;, JSC::JSValue, WTF::NakedPtr&lt;JSC::Exception&gt;&amp;) + 472 (Completion.cpp:102)
19  com.apple.JavaScriptCore      	0x00000001086484b0 JSC::profiledEvaluate(JSC::ExecState*, JSC::ProfilingReason, JSC::SourceCode const&amp;, JSC::JSValue, WTF::NakedPtr&lt;JSC::Exception&gt;&amp;) + 80 (Completion.cpp:117)


Discovered while writing a test case for https://bugs.webkit.org/show_bug.cgi?id=175914.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1342063</commentid>
    <comment_count>1</comment_count>
    <who name="Wenson Hsieh">wenson_hsieh</who>
    <bug_when>2017-08-24 09:33:23 -0700</bug_when>
    <thetext>Retitling and repurposing -- looks like WK2 iOS hits a debug assertion when creating a Position anyways in platform-specific code. This looks related to the assertion seen in the original test case below.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1342670</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2017-08-26 15:16:48 -0700</bug_when>
    <thetext>*** Bug 175939 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1342671</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2017-08-26 15:18:05 -0700</bug_when>
    <thetext>Ryan skipped the test in https://trac.webkit.org/r221140

ASSERTION FAILED: !((anchorType == PositionIsBeforeChildren || anchorType == PositionIsAfterChildren) &amp;&amp; (is&lt;Text&gt;(*m_anchorNode) || editingIgnoresContent(*m_anchorNode)))</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>