<?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>102848</bug_id>
          
          <creation_ts>2012-11-20 16:12:27 -0800</creation_ts>
          <short_desc>REGRESSION(r131106): magnitude-perf.js calls bind on undefined</short_desc>
          <delta_ts>2012-11-20 17:11:48 -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>Tools / Tests</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</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="Ryosuke Niwa">rniwa</reporter>
          <assigned_to name="Ryosuke Niwa">rniwa</assigned_to>
          <cc>abarth</cc>
    
    <cc>ojan</cc>
    
    <cc>simonjam</cc>
    
    <cc>tony</cc>
    
    <cc>tonyg</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>772257</commentid>
    <comment_count>0</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2012-11-20 16:12:27 -0800</bug_when>
    <thetext>http://trac.webkit.org/changeset/131106/trunk/LayoutTests/resources/magnitude-perf.js
replaced
    var nowFunction = window.performance.now || Date.now;
with
    var nowFunction = window.performance.now.bind(window.performance) || Date.now; 

Calling bind on undefined object will results in an exception being thrown and &quot;|| Date.now&quot; is useless.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>772259</commentid>
    <comment_count>1</comment_count>
      <attachid>175298</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2012-11-20 16:13:32 -0800</bug_when>
    <thetext>Created attachment 175298
Fixes the regression</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>772274</commentid>
    <comment_count>2</comment_count>
      <attachid>175298</attachid>
    <who name="Ojan Vafai">ojan</who>
    <bug_when>2012-11-20 16:34:11 -0800</bug_when>
    <thetext>Comment on attachment 175298
Fixes the regression

I don&apos;t see why we need to call bind at all. Why can&apos;t this just be:
var nowFunction = window.performance.now || Date.now;

The original patch that added the bind call doesn&apos;t explain this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>772295</commentid>
    <comment_count>3</comment_count>
    <who name="James Simonsen">simonjam</who>
    <bug_when>2012-11-20 16:50:58 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; (From update of attachment 175298 [details])
&gt; I don&apos;t see why we need to call bind at all. Why can&apos;t this just be:
&gt; var nowFunction = window.performance.now || Date.now;
&gt; 
&gt; The original patch that added the bind call doesn&apos;t explain this.

You get a TypeError: Illegal invocation without it. You can test it in the console. Try storing now in a variable and then invoke that variable.

I don&apos;t fully understand why. I think this answer might explain it:

http://stackoverflow.com/questions/1007340/javascript-function-aliasing-doesnt-seem-to-work</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>772299</commentid>
    <comment_count>4</comment_count>
    <who name="Ojan Vafai">ojan</who>
    <bug_when>2012-11-20 16:52:44 -0800</bug_when>
    <thetext>It seems wrong to me that you can alias Date.now but not window.performance.now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>772309</commentid>
    <comment_count>5</comment_count>
    <who name="James Simonsen">simonjam</who>
    <bug_when>2012-11-20 16:59:01 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; It seems wrong to me that you can alias Date.now but not window.performance.now.

performance.now() _does_ vary depending on which window you call it on. It measures the time since that window object started navigating.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>772311</commentid>
    <comment_count>6</comment_count>
    <who name="Ojan Vafai">ojan</who>
    <bug_when>2012-11-20 17:01:40 -0800</bug_when>
    <thetext>oic. Sad. I wonder if we can make aliasing of these things work. Probably not. :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>772316</commentid>
    <comment_count>7</comment_count>
      <attachid>175298</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-11-20 17:11:44 -0800</bug_when>
    <thetext>Comment on attachment 175298
Fixes the regression

Clearing flags on attachment: 175298

Committed r135335: &lt;http://trac.webkit.org/changeset/135335&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>772317</commentid>
    <comment_count>8</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-11-20 17:11:48 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>175298</attachid>
            <date>2012-11-20 16:13:32 -0800</date>
            <delta_ts>2012-11-20 17:11:44 -0800</delta_ts>
            <desc>Fixes the regression</desc>
            <filename>bug-102848-20121120161120.patch</filename>
            <type>text/plain</type>
            <size>1393</size>
            <attacher name="Ryosuke Niwa">rniwa</attacher>
            
              <data encoding="base64">SW5kZXg6IExheW91dFRlc3RzL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBMYXlvdXRUZXN0cy9D
aGFuZ2VMb2cJKHJldmlzaW9uIDEzNTMyNykKKysrIExheW91dFRlc3RzL0NoYW5nZUxvZwkod29y
a2luZyBjb3B5KQpAQCAtMSwzICsxLDE1IEBACisyMDEyLTExLTIwICBSeW9zdWtlIE5pd2EgIDxy
bml3YUB3ZWJraXQub3JnPgorCisgICAgICAgIFJFR1JFU1NJT04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uY2Uubm93LmJpbmQod2luZG93LnBlcmZvcm1hbmNlKSB8fCBEYXRlLm5vdzsKKyAgICB2YXIg
bm93RnVuY3Rpb24gPSB3aW5kb3cucGVyZm9ybWFuY2UgJiYgd2luZG93LnBlcmZvcm1hbmNlLm5v
dyA/IHdpbmRvdy5wZXJmb3JtYW5jZS5ub3cuYmluZCh3aW5kb3cucGVyZm9ybWFuY2UpIDogRGF0
ZS5ub3c7CiAgICAgdmFyIHN0YXJ0ID0gbm93RnVuY3Rpb24oKTsKICAgICB3aGlsZSAobm93RnVu
Y3Rpb24oKSAtIHN0YXJ0IDwgTWFnbml0dWRlLm1pbGxpc2Vjb25kc1Blckl0ZXJhdGlvbikgewog
ICAgICAgICB0ZXN0KG1hZ25pdHVkZSk7Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>