<?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>50218</bug_id>
          
          <creation_ts>2010-11-30 02:53:39 -0800</creation_ts>
          <short_desc>chrome.dll!WebCore::canHaveChildrenForEditing ReadAV@NULL (4c335fdc0441ae912c5dd65199668a34)</short_desc>
          <delta_ts>2017-07-18 08:26:00 -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>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc>http://code.google.com/p/chromium/issues/detail?id=64749</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>HasReduction</keywords>
          <priority>P1</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Berend-Jan Wever">skylined</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>enrica</cc>
    
    <cc>eric</cc>
    
    <cc>kalman</cc>
    
    <cc>rniwa</cc>
    
    <cc>tony</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>314923</commentid>
    <comment_count>0</comment_count>
      <attachid>75119</attachid>
    <who name="Berend-Jan Wever">skylined</who>
    <bug_when>2010-11-30 02:53:39 -0800</bug_when>
    <thetext>Created attachment 75119
Repro

Repro:
&lt;body&gt;&lt;script&gt;
  with(window.getSelection()) {
    addRange(document.createRange());
    collapseToStart();
  }
  document.designMode = &quot;on&quot;;
  document.write(&apos;&lt;video&gt;&apos;);
  document.execCommand(&quot;indent&quot;);
&lt;/script&gt;

id:             chrome.dll!WebCore::canHaveChildrenForEditing ReadAV@NULL (4c335fdc0441ae912c5dd65199668a34)
description:    Attempt to read from unallocated NULL pointer+0x24 in chrome.dll!WebCore::canHaveChildrenForEditing
application:    Chromium 9.0.596.0
stack:          chrome.dll!WebCore::canHaveChildrenForEditing
                chrome.dll!WebCore::CompositeEditCommand::insertNodeAt
                chrome.dll!WebCore::ApplyBlockElementCommand::formatSelection
                chrome.dll!WebCore::ApplyBlockElementCommand::doApply
                chrome.dll!WebCore::EditCommand::apply
                chrome.dll!WebCore::applyCommand
                chrome.dll!WebCore::executeIndent
                chrome.dll!WebCore::Editor::Command::execute
                chrome.dll!WebCore::Document::execCommand
                chrome.dll!WebCore::DocumentInternal::execCommandCallback
                chrome.dll!v8::internal::HandleApiCallHelper&lt;...&gt;
                chrome.dll!v8::internal::Builtin_HandleApiCall
                chrome.dll!v8::internal::Invoke
                chrome.dll!v8::internal::Execution::Call
                ...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>317207</commentid>
    <comment_count>1</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2010-12-03 18:45:33 -0800</bug_when>
    <thetext>The problem is that visible start and end of the selection is null in ApplyBlockElementCommand::doApply.  This possibly a bug in Position::isCandidate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>317325</commentid>
    <comment_count>2</comment_count>
      <attachid>75620</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2010-12-04 16:50:21 -0800</bug_when>
    <thetext>Created attachment 75620
somewhat simpler repro

I don&apos;t know how to fix this crash.  Right now, we&apos;re not allowing the first position inside body to be a candidate even if it didn&apos;t have any other candidate in the editable region at all.  One way to fix this problem is to move the special case for unsplittable element in formatSelection to doApply.  But this would only fix IndentOutdentCommand and FormatBlockCommand.  I&apos;m sure a similar problem exists for other editing commands as well.  However, allowing the said position to be a candidate breaks so may assumptions we make in editing and causes hundreds of tests to fail / crash.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>317327</commentid>
    <comment_count>3</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2010-12-04 16:53:23 -0800</bug_when>
    <thetext>After debugging for a couple of hours, I&apos;m almost convinced that Position::atEditingBoundary is broken:

// A position is considered at editing boundary if one of the following is true:
// 1. It is the first position in the node and the next visually equivalent position
//    is non editable.
// 2. It is the last position in the node and the previous visually equivalent position
//    is non editable.
// 3. It is an editable position and both the next and previous visually equivalent
//    positions are both non editable.
bool Position::atEditingBoundary() const
{
    Position nextPosition = downstream(CanCrossEditingBoundary);
    if (atFirstEditingPositionForNode() &amp;&amp; nextPosition.isNotNull() &amp;&amp; !nextPosition.node()-&gt;isContentEditable())
        return true;

    Position prevPosition = upstream(CanCrossEditingBoundary);
    if (atLastEditingPositionForNode() &amp;&amp; prevPosition.isNotNull() &amp;&amp; !prevPosition.node()-&gt;isContentEditable())
        return true;
        
    return nextPosition.isNotNull() &amp;&amp; !nextPosition.node()-&gt;isContentEditable()
        &amp;&amp; prevPosition.isNotNull() &amp;&amp; !prevPosition.node()-&gt;isContentEditable();
}

Kalman, are you familiar with this function?  This might be related to what you&apos;ve been working on.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>317424</commentid>
    <comment_count>4</comment_count>
    <who name="Benjamin (Ben) Kalman">kalman</who>
    <bug_when>2010-12-05 17:32:53 -0800</bug_when>
    <thetext>&gt; Kalman, are you familiar with this function?  This might be related to what you&apos;ve been working on.

No, not really.  I haven&apos;t run into a problem with it (yet?) but I also haven&apos;t been debugging a code path that touches it afaik.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>75119</attachid>
            <date>2010-11-30 02:53:39 -0800</date>
            <delta_ts>2010-11-30 02:53:39 -0800</delta_ts>
            <desc>Repro</desc>
            <filename>repro.html</filename>
            <type>text/html</type>
            <size>214</size>
            <attacher name="Berend-Jan Wever">skylined</attacher>
            
              <data encoding="base64">PGJvZHk+PHNjcmlwdD4KICB3aXRoKHdpbmRvdy5nZXRTZWxlY3Rpb24oKSkgewogICAgYWRkUmFu
Z2UoZG9jdW1lbnQuY3JlYXRlUmFuZ2UoKSk7CiAgICBjb2xsYXBzZVRvU3RhcnQoKTsKICB9CiAg
ZG9jdW1lbnQuZGVzaWduTW9kZSA9ICJvbiI7CiAgZG9jdW1lbnQud3JpdGUoJzx2aWRlbz4nKTsK
ICBkb2N1bWVudC5leGVjQ29tbWFuZCgiaW5kZW50Iik7Cjwvc2NyaXB0Pg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>75620</attachid>
            <date>2010-12-04 16:50:21 -0800</date>
            <delta_ts>2010-12-04 16:50:21 -0800</delta_ts>
            <desc>somewhat simpler repro</desc>
            <filename>bug50218.html</filename>
            <type>text/html</type>
            <size>181</size>
            <attacher name="Ryosuke Niwa">rniwa</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8Ym9keSBvbmxvYWQ9J2RvY3VtZW50LmV4ZWNDb21tYW5k
KCJpbmRlbnQiKTsnPjxzY3JpcHQ+Cgp3aW5kb3cuZ2V0U2VsZWN0aW9uKCkuc2VsZWN0QWxsQ2hp
bGRyZW4oZG9jdW1lbnQuYm9keSk7CmRvY3VtZW50LmRlc2lnbk1vZGUgPSAib24iOwoKPC9zY3Jp
cHQ+PHZpZGVvPg==
</data>

          </attachment>
      

    </bug>

</bugzilla>