<?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>21422</bug_id>
          
          <creation_ts>2013-03-28 16:08:18 +0000</creation_ts>
          <short_desc>Generic Promise type notation</short_desc>
          <delta_ts>2014-01-28 23:04:37 +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="Anne">annevk</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>bruant.d</cc>
    
    <cc>mike</cc>
    
    <cc>mounir</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>85097</commentid>
    <comment_count>0</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-03-28 16:08:18 +0000</bug_when>
    <thetext>Now we have http://dom.spec.whatwg.org/#futures we should introduce friendly IDL syntax for them. In particular, the result of a Future should appear in the IDL without hacks. E.g.

Future&lt;Blob&gt; toBlob();</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87445</commentid>
    <comment_count>1</comment_count>
    <who name="Mounir Lamouri">mounir</who>
    <bug_when>2013-05-08 17:52:21 +0000</bug_when>
    <thetext>I think it would be good to add the type of the error object in addition of the type of the succes object. Maybe this could have a default value in which case it would not be needed?

http://lists.w3.org/Archives/Public/www-dom/2013AprJun/0095.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89941</commentid>
    <comment_count>2</comment_count>
    <who name="David Bruant">bruant.d</who>
    <bug_when>2013-06-27 09:49:42 +0000</bug_when>
    <thetext>It&apos;s with a smile of happiness in my face that I noticed the following this morning [1]

interface SubtleCrypto {
  // ...

  Promise&lt;any&gt; generateKey(AlgorithmIdentifier algorithm,
                          bool extractable = false,
                          KeyUsage[] keyUsages = []);

  // ...
}

IMO the most complete version should be &quot;Promise&lt;resultT, errorT&gt;&quot; where both the result and error type can be specified. Sweetened versions:
* Promise&lt;resultT&gt; =&gt; Promise&lt;resultT, Error&gt;
* Promise =&gt; Promise&lt;any, Error&gt;

(not sure whether that should be Error or DOMError)

Thoughts?

[1] http://www.w3.org/TR/2013/WD-WebCryptoAPI-20130625/#dfn-SubtleCrypto</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89943</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-06-27 10:15:17 +0000</bug_when>
    <thetext>Error does not work. Sometimes we forward exceptions to reject.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89944</commentid>
    <comment_count>4</comment_count>
    <who name="David Bruant">bruant.d</who>
    <bug_when>2013-06-27 10:21:45 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Error does not work. Sometimes we forward exceptions to reject.

Hmm... Does that means success and errors are asymmetrical? Is that a desired property?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89945</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-06-27 10:23:07 +0000</bug_when>
    <thetext>I don&apos;t think it&apos;s necessary for reject to have a consistent type. It&apos;s for debugging.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99364</commentid>
    <comment_count>6</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2014-01-28 23:04:37 +0000</bug_when>
    <thetext>Although I plan to make Error and DOMException the names of real types and not just exceptions, I&apos;m not sure how useful it is to identify the rejection type and to type check it.  So for the moment I don&apos;t coerce it (well, I convert it to &quot;any&quot; which is the &quot;don&apos;t do anything really&quot; conversion from JS to IDL values).

https://github.com/heycam/webidl/commit/61403d1705384ed4bb9e15fd4dda319b96faf08a</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>