<?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>81662</bug_id>
          
          <creation_ts>2012-03-20 07:10:13 -0700</creation_ts>
          <short_desc>Web Inspector: REGRESSION Detached DOM Nodes are not highlighted</short_desc>
          <delta_ts>2012-03-21 09:48:32 -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>Web Inspector (Deprecated)</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>78411</blocked>
          <everconfirmed>0</everconfirmed>
          <reporter name="Ilya Tikhonovsky">loislo</reporter>
          <assigned_to name="Ilya Tikhonovsky">loislo</assigned_to>
          <cc>apavlov</cc>
    
    <cc>barraclough</cc>
    
    <cc>bweinstein</cc>
    
    <cc>darin</cc>
    
    <cc>ggaren</cc>
    
    <cc>joepeck</cc>
    
    <cc>keishi</cc>
    
    <cc>loislo</cc>
    
    <cc>pfeldman</cc>
    
    <cc>pmuellr</cc>
    
    <cc>rik</cc>
    
    <cc>timothy</cc>
    
    <cc>yurys</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>583034</commentid>
    <comment_count>0</comment_count>
    <who name="Ilya Tikhonovsky">loislo</who>
    <bug_when>2012-03-20 07:10:13 -0700</bug_when>
    <thetext>%subj%</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>583038</commentid>
    <comment_count>1</comment_count>
      <attachid>132822</attachid>
    <who name="Ilya Tikhonovsky">loislo</who>
    <bug_when>2012-03-20 07:14:27 -0700</bug_when>
    <thetext>Created attachment 132822
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>583042</commentid>
    <comment_count>2</comment_count>
      <attachid>132822</attachid>
    <who name="Yury Semikhatsky">yurys</who>
    <bug_when>2012-03-20 07:17:50 -0700</bug_when>
    <thetext>Comment on attachment 132822
Patch

Can we test this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>583043</commentid>
    <comment_count>3</comment_count>
      <attachid>132822</attachid>
    <who name="Yury Semikhatsky">yurys</who>
    <bug_when>2012-03-20 07:18:28 -0700</bug_when>
    <thetext>Comment on attachment 132822
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=132822&amp;action=review

&gt; Source/WebCore/inspector/front-end/HeapSnapshot.js:646
&gt; +        return this.className.substr(0, length) === detachedDOMTree;

I&apos;d rather use indexOf(detachedDOMTree) === 0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>583059</commentid>
    <comment_count>4</comment_count>
    <who name="Ilya Tikhonovsky">loislo</who>
    <bug_when>2012-03-20 07:39:01 -0700</bug_when>
    <thetext>Committed r111392: &lt;http://trac.webkit.org/changeset/111392&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>583607</commentid>
    <comment_count>5</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2012-03-20 16:36:57 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; (From update of attachment 132822 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=132822&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/inspector/front-end/HeapSnapshot.js:646
&gt; &gt; +        return this.className.substr(0, length) === detachedDOMTree;
&gt; 
&gt; I&apos;d rather use indexOf(detachedDOMTree) === 0

Why? That does a search for the string, not a prefix check.

Is indexOf == 0 a good design pattern? Maybe the JavaScript engines special-case it?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>583848</commentid>
    <comment_count>6</comment_count>
      <attachid>132822</attachid>
    <who name="Yury Semikhatsky">yurys</who>
    <bug_when>2012-03-20 23:38:11 -0700</bug_when>
    <thetext>Comment on attachment 132822
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=132822&amp;action=review

&gt;&gt;&gt; Source/WebCore/inspector/front-end/HeapSnapshot.js:646
&gt;&gt;&gt; +        return this.className.substr(0, length) === detachedDOMTree;
&gt;&gt; 
&gt;&gt; I&apos;d rather use indexOf(detachedDOMTree) === 0
&gt; 
&gt; Why? That does a search for the string, not a prefix check.
&gt; 
&gt; Is indexOf == 0 a good design pattern? Maybe the JavaScript engines special-case it?

indexOf === 0 is just a common way for string prefix check in the inspector front-end code. Only heap profiler uses this substr approach. My point was that we should be consistent here. As for the performance, they should be equally fast given that we don&apos;t check for a prefix in strings much longer than the prefix itself.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>583885</commentid>
    <comment_count>7</comment_count>
    <who name="Ilya Tikhonovsky">loislo</who>
    <bug_when>2012-03-21 01:21:35 -0700</bug_when>
    <thetext>Looks like we have no special-case for this.
I&apos;ve made an investigation and got the next results.

aString =
&quot;012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890&quot;

function test()
{
    for (var j = 0; j &lt; 1000000; ++j)
         doCompare(aString);
}

// time: V8:641ms, JSC:799
// produces garbage
function doCompare(name)
{
	return aString.substr(0, 6) === &quot;Window&quot;;
}

// time: V8:643ms, JSC:799ms
// produces garbage
function doCompare(name)
{
	return aString.slice(0, 6) === &quot;Window&quot;;
}

// time: V8:928ms, JSC:866ms
// no garbage
function doCompare(name)
{
	return aString.indexOf(&quot;Window&quot;) === 0;
}

// time: V8:565ms, JSC:890ms
// no garbage
function doCompare(name)
{
    const t = &quot;Window&quot;;
    const l = t.length;
    for (var i = 0; i &lt; l; ++i)
        if (name[i] !== t[i])
            return false;
    return true;
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>584240</commentid>
    <comment_count>8</comment_count>
    <who name="Ilya Tikhonovsky">loislo</who>
    <bug_when>2012-03-21 09:48:32 -0700</bug_when>
    <thetext>looks like I have to change this code to RegExp version
http://jsperf.com/careful-with-that-indexof-eugene</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>132822</attachid>
            <date>2012-03-20 07:14:27 -0700</date>
            <delta_ts>2012-03-20 23:38:11 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-81662-20120320151425.patch</filename>
            <type>text/plain</type>
            <size>1411</size>
            <attacher name="Ilya Tikhonovsky">loislo</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTExMzg5CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggYTdjMWU0YThhYWI5Y2Qw
YzZhZDljYWZlOTJmY2M1MjlmMDZjODBkMS4uM2I5MTZmZWU3MWRkYjVjNzRiZWE4YWQwMDI4NTZj
ODFkNTE5ZGNjYSAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDEzIEBACisyMDEyLTAzLTIwICBJbHlh
IFRpa2hvbm92c2t5ICA8bG9pc2xvQGNocm9taXVtLm9yZz4KKworICAgICAgICBXZWIgSW5zcGVj
dG9yOiBSRUdSRVNTSU9OIERldGFjaGVkIERPTSBOb2RlcyBhcmUgbm90IGhpZ2hsaWdodGVkCisg
ICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD04MTY2MgorCisg
ICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAg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Ro
OworICAgICAgICByZXR1cm4gdGhpcy5jbGFzc05hbWUuc3Vic3RyKDAsIGxlbmd0aCkgPT09IGRl
dGFjaGVkRE9NVHJlZTsKICAgICB9LAogCiAgICAgZ2V0IGlzUm9vdCgpCg==
</data>
<flag name="review"
          id="136593"
          type_id="1"
          status="+"
          setter="yurys"
    />
          </attachment>
      

    </bug>

</bugzilla>