<?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>5409</bug_id>
          
          <creation_ts>2005-10-17 23:23:49 -0700</creation_ts>
          <short_desc>slice() testcase doesn&apos;t pass</short_desc>
          <delta_ts>2005-11-05 21:55:32 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>420+</version>
          <rep_platform>Other</rep_platform>
          <op_sys>Linux</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="George Staikos">staikos</reporter>
          <assigned_to name="Geoffrey Garen">ggaren</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>22198</commentid>
    <comment_count>0</comment_count>
    <who name="George Staikos">staikos</who>
    <bug_when>2005-10-17 23:23:49 -0700</bug_when>
    <thetext>String slice() testcases are not passing.  attached KJS patch fixes it.  It 
should be fairly easy to merge by hand.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22199</commentid>
    <comment_count>1</comment_count>
      <attachid>4394</attachid>
    <who name="George Staikos">staikos</who>
    <bug_when>2005-10-17 23:24:17 -0700</bug_when>
    <thetext>Created attachment 4394
patch to fix slice() in KJS</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22200</commentid>
    <comment_count>2</comment_count>
      <attachid>4394</attachid>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2005-10-17 23:31:53 -0700</bug_when>
    <thetext>Comment on attachment 4394
patch to fix slice() in KJS

George and I discussed how it would be safer against extreme values ot use
toInteger and leave things as double until after the range check, but I think
it&apos;s still an improvement to merge this fix from KJS.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22220</commentid>
    <comment_count>3</comment_count>
      <attachid>4394</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2005-10-18 09:55:30 -0700</bug_when>
    <thetext>Comment on attachment 4394
patch to fix slice() in KJS

The standard is clear on this point: toUInt32 is incorrect, toInteger is
correct. But that&apos;s a bug that can be fixed separately.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22868</commentid>
    <comment_count>4</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2005-10-24 19:42:41 -0700</bug_when>
    <thetext>Filed a new bug to track using toInteger: 5490.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22870</commentid>
    <comment_count>5</comment_count>
      <attachid>4466</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2005-10-24 20:13:14 -0700</bug_when>
    <thetext>Created attachment 4466
Revised Patch

Psych. Decided to fix it myself here. Also fixed the end == undefined case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22912</commentid>
    <comment_count>6</comment_count>
      <attachid>4466</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2005-10-25 08:16:52 -0700</bug_when>
    <thetext>Comment on attachment 4466
Revised Patch

There are a few examples here of braces for single lines. That doesn&apos;t match
our coding style. Also, I prefer just doing a return to setting the value of
String. Finally, I&apos;d like test cases for what you fixed here.

But it looks good to me, so review+ anyway.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23768</commentid>
    <comment_count>7</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2005-11-05 21:55:32 -0800</bug_when>
    <thetext>I removed the single braces and added a layout test for the cases not covered by the mozilla test suite 
before landing.

I felt iffy about returning immediately rather than setting result, though. Setting result is the idiom for 
StringProtoFuncImp::callAsFunction. If we don&apos;t like that idiom, I think we should file a separate bug and 
change all cases of it in the function, rather than creating an idiosyncracy for this one case.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>4394</attachid>
            <date>2005-10-17 23:24:17 -0700</date>
            <delta_ts>2005-10-24 20:13:14 -0700</delta_ts>
            <desc>patch to fix slice() in KJS</desc>
            <filename>slice.patch</filename>
            <type>text/plain</type>
            <size>1225</size>
            <attacher name="George Staikos">staikos</attacher>
            
              <data encoding="base64">SW5kZXg6IHN0cmluZ19vYmplY3QuY3BwCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIHN0cmluZ19vYmplY3QuY3Bw
CShyZXZpc2lvbiA0Njk3MDIpCisrKyBzdHJpbmdfb2JqZWN0LmNwcAkod29ya2luZyBjb3B5KQpA
QCAtNDA1LDIwICs0MDUsMjMgQEAKICAgICB7CiAgICAgICAgIC8vIFRoZSBhcmcgcHJvY2Vzc2lu
ZyBpcyB2ZXJ5IG11Y2ggbGlrZSBBcnJheVByb3RvRnVuYzo6U2xpY2UKICAgICAgICAgaW50IGJl
Z2luID0gYXJnc1swXS50b1VJbnQzMihleGVjKTsKLSAgICAgICAgaWYgKGJlZ2luIDwgMCkKLSAg
ICAgICAgICBiZWdpbiA9IG1heEludChiZWdpbiArIGxlbiwgMCk7Ci0gICAgICAgIGVsc2UKLSAg
ICAgICAgICBiZWdpbiA9IG1pbkludChiZWdpbiwgbGVuKTsKICAgICAgICAgaW50IGVuZCA9IGxl
bjsKICAgICAgICAgaWYgKGFyZ3NbMV0udHlwZSgpICE9IFVuZGVmaW5lZFR5cGUpIHsKICAgICAg
ICAgICBlbmQgPSBhcmdzWzFdLnRvSW50ZWdlcihleGVjKTsKLSAgICAgICAgICBpZiAoZW5kIDwg
MCkKLSAgICAgICAgICAgIGVuZCA9IG1heEludChsZW4gKyBlbmQsIDApOwotICAgICAgICAgIGVs
c2UKLSAgICAgICAgICAgIGVuZCA9IG1pbkludChlbmQsIGxlbik7CiAgICAgICAgIH0KLSAgICAg
ICAgLy9wcmludGYoICJTbGljaW5nIGZyb20gJWQgdG8gJWQgXG4iLCBiZWdpbiwgZW5kICk7Ci0g
ICAgICAgIHJlc3VsdCA9IFN0cmluZyhzLnN1YnN0cihiZWdpbiwgZW5kLWJlZ2luKSk7CisgICAg
ICAgIGludCBmcm9tID0gYmVnaW4gPCAwID8gbGVuICsgYmVnaW4gOiBiZWdpbjsKKyAgICAgICAg
aW50IHRvID0gZW5kIDwgMCA/IGxlbiArIGVuZCA6IGVuZDsKKyAgICAgICAgaWYgKHRvID4gZnJv
bSAmJiB0byA+IDAgJiYgZnJvbSA8IGxlbikgeworICAgICAgICAgIGlmIChmcm9tIDwgMCkgewor
ICAgICAgICAgICAgZnJvbSA9IDA7CisgICAgICAgICAgfQorICAgICAgICAgIGlmICh0byA+IGxl
bikgeworICAgICAgICAgICAgdG8gPSBsZW47CisgICAgICAgICAgfQorICAgICAgICAgIHJlc3Vs
dCA9IFN0cmluZyhzLnN1YnN0cihmcm9tLCB0byAtIGZyb20pKTsKKyAgICAgICAgfSBlbHNlIHsK
KyAgICAgICAgICByZXN1bHQgPSBTdHJpbmcoIiIpOworICAgICAgICB9CiAgICAgICAgIGJyZWFr
OwogICAgIH0KICAgICBjYXNlIFNwbGl0OiB7Cg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>4466</attachid>
            <date>2005-10-24 20:13:14 -0700</date>
            <delta_ts>2005-10-25 08:16:52 -0700</delta_ts>
            <desc>Revised Patch</desc>
            <filename>patch.txt</filename>
            <type>text/plain</type>
            <size>1963</size>
            <attacher name="Geoffrey Garen">ggaren</attacher>
            
              <data encoding="base64">SW5kZXg6IGtqcy9zdHJpbmdfb2JqZWN0LmNwcAo9PT09P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1iZWdpbikpKTsKLSAgICAgICAgYnJlYWs7CisgICAg
ICAgIHJlc3VsdCA9IFN0cmluZyhzLnN1YnN0cihzdGF0aWNfY2FzdDxpbnQ+KGZyb20pLCBzdGF0
aWNfY2FzdDxpbnQ+KHRvIC0gZnJvbSkpKTsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgIHJlc3Vs
dCA9IFN0cmluZygiIik7CisgICAgICB9CisgICAgICBicmVhazsKICAgICB9CiAgICAgY2FzZSBT
cGxpdDogewogICAgIE9iamVjdEltcCAqY29uc3RydWN0b3IgPSBleGVjLT5sZXhpY2FsSW50ZXJw
cmV0ZXIoKS0+YnVpbHRpbkFycmF5KCk7Cg==
</data>
<flag name="review"
          id="774"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>