<?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>22522</bug_id>
          
          <creation_ts>2013-06-30 18:46:06 +0000</creation_ts>
          <short_desc>WebIDL, error handling, and promises</short_desc>
          <delta_ts>2014-01-28 23:37:40 +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>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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Marcos Caceres">w3c</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>annevk</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>d</cc>
    
    <cc>erights</cc>
    
    <cc>jackalmage</cc>
    
    <cc>marcosscaceres</cc>
    
    <cc>mike</cc>
    
    <cc>public-script-coord</cc>
    
    <cc>w3c</cc>
    
    <cc>waldron.rick</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>90042</commentid>
    <comment_count>0</comment_count>
    <who name="Marcos Caceres">w3c</who>
    <bug_when>2013-06-30 18:46:06 +0000</bug_when>
    <thetext>When using a method that vends a promise, it&apos;s not clear to me what should happen when WebIDL says to throw a TypeError.

The WebIDL spec should include something like: &quot;If return type is Promise, and an exception has been thrown, instead return a rejected promise with that exception.&quot; 

See email thread: http://lists.w3.org/Archives/Public/public-script-coord/2013AprJun/0772.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90049</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-07-01 09:00:34 +0000</bug_when>
    <thetext>Maybe it would make sense for IDL to define promises until they&apos;re integrated into JavaScript. That way it can avoid a dependency on DOM and I&apos;ll have to do less work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90050</commentid>
    <comment_count>2</comment_count>
    <who name="Marcos Caceres">marcosscaceres</who>
    <bug_when>2013-07-01 10:41:04 +0000</bug_when>
    <thetext>That seems like a waste of time, tbh... why doesn&apos;t Promises just get housed in some TC-39 document (like with the internationalization stuff)? Then it can just be implemented whenever and doesn&apos;t need to be part of any ES version.

The WebIDL can just reference it from there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90051</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-07-01 10:48:08 +0000</bug_when>
    <thetext>Well it does depend on HTML&apos;s event loop. JavaScript doesn&apos;t define such a thing anywhere.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90055</commentid>
    <comment_count>4</comment_count>
    <who name="Marcos Caceres">w3c</who>
    <bug_when>2013-07-01 14:34:32 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Well it does depend on HTML&apos;s event loop. JavaScript doesn&apos;t define such a
&gt; thing anywhere.

That sounds like more reason to push it down the stack :) If the largest consumers of JS (Web/Node) both depend on the loop, this might encourage them to standardize it... which would be great as standardizing the event loop might provide an API to hook into it properly (instead of using setTimeout and matchMedia hacks).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90064</commentid>
    <comment_count>5</comment_count>
    <who name="Tab Atkins Jr.">jackalmage</who>
    <bug_when>2013-07-01 16:36:09 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; (In reply to comment #3)
&gt; &gt; Well it does depend on HTML&apos;s event loop. JavaScript doesn&apos;t define such a
&gt; &gt; thing anywhere.
&gt; 
&gt; That sounds like more reason to push it down the stack :) If the largest
&gt; consumers of JS (Web/Node) both depend on the loop, this might encourage
&gt; them to standardize it... which would be great as standardizing the event
&gt; loop might provide an API to hook into it properly (instead of using
&gt; setTimeout and matchMedia hacks).

TC39 is already planning to standardize the event loop in ES7, I believe.  They don&apos;t need any further encouragement from us.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90074</commentid>
    <comment_count>6</comment_count>
    <who name="Marcos Caceres">marcosscaceres</who>
    <bug_when>2013-07-01 18:32:33 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; (In reply to comment #4)
&gt; &gt; (In reply to comment #3)
&gt; &gt; &gt; Well it does depend on HTML&apos;s event loop. JavaScript doesn&apos;t define such a
&gt; &gt; &gt; thing anywhere.
&gt; &gt; 
&gt; &gt; That sounds like more reason to push it down the stack :) If the largest
&gt; &gt; consumers of JS (Web/Node) both depend on the loop, this might encourage
&gt; &gt; them to standardize it... which would be great as standardizing the event
&gt; &gt; loop might provide an API to hook into it properly (instead of using
&gt; &gt; setTimeout and matchMedia hacks).
&gt; 
&gt; TC39 is already planning to standardize the event loop in ES7, I believe. 
&gt; They don&apos;t need any further encouragement from us.

&lt;...insert Marcos + slowpoke pokemon meme here...&gt; :) 

Anyway, sorry for dragging the bug off topic.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90084</commentid>
    <comment_count>7</comment_count>
    <who name="Rick Waldron">waldron.rick</who>
    <bug_when>2013-07-01 21:12:54 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; (In reply to comment #4)
&gt; &gt; (In reply to comment #3)
&gt; &gt; &gt; Well it does depend on HTML&apos;s event loop. JavaScript doesn&apos;t define such a
&gt; &gt; &gt; thing anywhere.
&gt; &gt; 
&gt; &gt; That sounds like more reason to push it down the stack :) If the largest
&gt; &gt; consumers of JS (Web/Node) both depend on the loop, this might encourage
&gt; &gt; them to standardize it... which would be great as standardizing the event
&gt; &gt; loop might provide an API to hook into it properly (instead of using
&gt; &gt; setTimeout and matchMedia hacks).
&gt; 
&gt; TC39 is already planning to standardize the event loop in ES7, I believe. 
&gt; They don&apos;t need any further encouragement from us.


The event loop will be specified as part of ES6.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90092</commentid>
    <comment_count>8</comment_count>
    <who name="Mark S. Miller">erights</who>
    <bug_when>2013-07-01 22:20:45 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; (In reply to comment #5)
&gt; &gt; (In reply to comment #4)
&gt; &gt; &gt; (In reply to comment #3)
&gt; &gt; &gt; &gt; Well it does depend on HTML&apos;s event loop. JavaScript doesn&apos;t define such a
&gt; &gt; &gt; &gt; thing anywhere.
&gt; &gt; &gt; 
&gt; &gt; &gt; That sounds like more reason to push it down the stack :) If the largest
&gt; &gt; &gt; consumers of JS (Web/Node) both depend on the loop, this might encourage
&gt; &gt; &gt; them to standardize it... which would be great as standardizing the event
&gt; &gt; &gt; loop might provide an API to hook into it properly (instead of using
&gt; &gt; &gt; setTimeout and matchMedia hacks).
&gt; &gt; 
&gt; &gt; TC39 is already planning to standardize the event loop in ES7, I believe. 
&gt; &gt; They don&apos;t need any further encouragement from us.

Encouragement is always appreciated ;).


&gt; 
&gt; 
&gt; The event loop will be specified as part of ES6.

ES6 is likely only to specify the minimal placeholder of an event loop as necessary to specify module loaders. The full event loop spec is indeed likely to be in ES7.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97288</commentid>
    <comment_count>9</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2013-12-08 07:33:14 +0000</bug_when>
    <thetext>So, we need to fix WebIDL so that whenever an error is implicitly thrown (e.g. in the overload resolution algorithm, or maybe other places) by a Promise-returning function, it needs to automatically translate that to rejecting the returned promise. E.g. if I do

Promise doSomethingAsync(DOMString arg) // non-optional

var p = doSomethingAsync();

then p should be a Promise rejected with a TypeError, and a TypeError should not have been thrown.

Should we use this bug for tracking that?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97324</commentid>
    <comment_count>10</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-12-09 14:38:45 +0000</bug_when>
    <thetext>I was expecting that to happen as part of bug 21422. When promises are made available as something you can use in IDL.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97325</commentid>
    <comment_count>11</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-12-09 14:40:00 +0000</bug_when>
    <thetext>Also, this bug reads remarkably like bug 21740.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99365</commentid>
    <comment_count>12</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2014-01-28 23:05:56 +0000</bug_when>
    <thetext>(In reply to Anne from comment #10)
&gt; I was expecting that to happen as part of bug 21422. When promises are made
&gt; available as something you can use in IDL.

I&apos;ve indeed done that as part of bug 21422.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>