<?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>11749</bug_id>
          
          <creation_ts>2011-01-13 19:55:45 +0000</creation_ts>
          <short_desc>Do we really want values to wrap instead of clamping?</short_desc>
          <delta_ts>2011-05-24 22:26:15 +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>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</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="Aryeh Gregor">ayg</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>mike</cc>
    
    <cc>Ms2ger</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>44331</commentid>
    <comment_count>0</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-01-13 19:55:45 +0000</bug_when>
    <thetext>The algorithm to convert ECMAScript values to various IDL types (octet, short, etc.) specifies that they wrap if they&apos;re out of range, by saying that they&apos;re taken mod 2^8 or 2^16 or whatever.  Is this behavior really necessary?  Clamping to the nearest allowed value is much nicer behavior, if it&apos;s compatible with how browsers behave.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44333</commentid>
    <comment_count>1</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-01-13 20:57:13 +0000</bug_when>
    <thetext>Is it compatible?

(Note that generally wrapping is faster to do, so unless there&apos;s a good reason to expect that people will need to rely on the clamping it&apos;s easier to not support it.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48754</commentid>
    <comment_count>2</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2011-05-24 22:26:15 +0000</bug_when>
    <thetext>I don&apos;t know about compatibility with content.  I&apos;m inclined to leave it as is, for the reason Boris states, and that the wrapping is what the ES5 spec uses when builtin functions need to convert a value to an integer.

FWIW,

data:text/html,&lt;script&gt;a=document.createElement(&quot;input&quot;);a.size=4294967297;alert(a.size)&lt;/script&gt;

alerts &quot;1&quot; (4294967297 being 2^32+1) in Firefox, Safari, Chrome and IE.  In Opera it alerts &quot;-2147483648&quot;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>