<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>19988</bug_id>
          
          <creation_ts>2012-11-16 23:27:51 +0000</creation_ts>
          <short_desc>add a [LenientFloat] to mean &quot;ignore IDL attribute assignment or method call if a non-finite float is passed&quot;</short_desc>
          <delta_ts>2016-10-23 00:58:06 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>WebIDL</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows 3.1</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>[v1]</status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Cameron McCormack">cam</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>d</cc>
    
    <cc>jonas</cc>
    
    <cc>me</cc>
    
    <cc>mike</cc>
    
    <cc>public-script-coord</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>78429</commentid>
    <comment_count>0</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2012-11-16 23:27:51 +0000</bug_when>
    <thetext>It sucks a bit that the various canvas APIs have to take &quot;unrestricted float&quot; and explicitly do nothing when non-finite Number values are passed/assigned to them.  We could add a [LeninentFloat] extended attribute that can be put on IDL operations that return void and have one or more float arguments (or union types that have a float in them) and writable IDL attributes of type float, which would mean that when converting the value to the IDL float, NaNs and infinities cause the invocation to return and do nothing rather than throwing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78853</commentid>
    <comment_count>1</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2012-11-26 20:04:24 +0000</bug_when>
    <thetext>What I implemented in Gecko is that a type &quot;contains restricted floats&quot; if any of the following conditions hold:

1)  It is &quot;float&quot; or &quot;double&quot;.
2)  It is a nullable type where the underlying type contains restricted floats.
3)  It&apos;s a union type where one of the union members contains restricted floats.
4)  It&apos;s a sequence type where the element type contains restricted floats.

and allowed [LenientFloat] on operations that return void and have an argument hat contains restricted floats or on writable attributes whose type contains restricted floats.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78856</commentid>
    <comment_count>2</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-11-26 20:14:38 +0000</bug_when>
    <thetext>I&apos;m really not sure that this needs to go into the WebIDL spec. It seems to me that using prose is a quite acceptable solution in this case.

What we do internally in Gecko can be something completely different of course as long as the behavior matches that of the IDL+prose</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78861</commentid>
    <comment_count>3</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2012-11-26 20:38:37 +0000</bug_when>
    <thetext>Using prose is actually a terrible solution for this in practice.  When implementing a canvas method right now, you have to end up looking at three completely different places (the IDL, the prose for the method, and a second prose location that&apos;s in a totally different place and says that all methods that don&apos;t say otherwise have a certain behavior) to figure out what the behavior should be.  And when speccing a canvas method you have to be aware of this bit of action-at-a-distance prose....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78885</commentid>
    <comment_count>4</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2012-11-27 01:39:30 +0000</bug_when>
    <thetext>One other note.  There is an observable difference between the spec as written right now and what Gecko is doing with [LenientFloat].  In particular, consider this testcase:

  ctx.moveTo(NaN, { valueOf: { throw &quot;HAHA&quot;; } });

In Gecko&apos;s current implementation, and in the obvious way of defining [LenientFloat], this call will be a no-op.  Per spec as written right now, this call will throw, because the check for NaN on the first argument is done after converting all the arguments.

I could probably change Gecko to do the thing current prose says to do in this sort of edge case, but that would make it harder to optimize calls to such methods from the JIT...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127918</commentid>
    <comment_count>5</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2016-10-22 15:56:23 +0000</bug_when>
    <thetext>In https://github.com/whatwg/html/pull/1790 we made the infinity/NaN handling for canvas methods unambiguous and explicit in HTML, with Boris&apos;s participation. Given that we don&apos;t want to do this kind of handling again, I don&apos;t think this is necessary anymore. Boris, please reopen if you disagree.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127935</commentid>
    <comment_count>6</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2016-10-23 00:58:06 +0000</bug_when>
    <thetext>That seems fine, since we changed from using action-at-a-distance prose to prose in the relevant methods.

Gecko will continue using [LenientFloat] in its IDL to save on mental overhead, but I changed its behavior to be black-box indentical to the new prose in HTML.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>