<?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>21744</bug_id>
          
          <creation_ts>2013-04-18 19:54:39 +0000</creation_ts>
          <short_desc>Speech utterance example missing &quot;new&quot; keyword, and constructor missing return value when called as function</short_desc>
          <delta_ts>2013-09-24 16:04:57 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Speech API</product>
          <component>Speech API</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="James Craig">jcraig</reporter>
          <assigned_to name="Glen Shires">gshires</assigned_to>
          <cc>dmazzoni</cc>
    
    <cc>jcraig</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>86371</commentid>
    <comment_count>0</comment_count>
    <who name="James Craig">jcraig</who>
    <bug_when>2013-04-18 19:54:39 +0000</bug_when>
    <thetext>Originally filed 3 Apr 2013 as a mailing list comment:
http://lists.w3.org/Archives/Public/public-speech-api/2013Apr/0000.html

Speech utterance example missing &quot;new&quot; keyword.
https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#examples-synthesis

speechSynthesis.speak(SpeechSynthesisUtterance(&apos;Hello World&apos;));

should be:

speechSynthesis.speak(new SpeechSynthesisUtterance(&apos;Hello World&apos;));

As it is currently written, it will throw a ~&quot;constructor is not a function&quot; error in WebKit. 

The working group might wish to consider if you want the constructor to return a value when called without the new keyword. For example, Date() returns a string value for the current datetime, or a Date object if prefixed with the “new&quot; keyword. 

&gt; Date()
&quot;Wed Apr 03 2013 16:40:46 GMT-0700 (PDT)&quot;
&gt; new Date()
Wed Apr 03 2013 16:40:46 GMT-0700 (PDT)

&gt; typeof Date()
string
&gt; typeof new Date()
object

I&apos;d lean toward making SpeechSynthesisUtteranceConstructor, when called as a function, return a SpeechSynthesisUtterance instance (effectively making the new keyword optional) but I don’t believe the current spec allows this. I may be wrong.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86740</commentid>
    <comment_count>1</comment_count>
    <who name="Dominic Mazzoni">dmazzoni</who>
    <bug_when>2013-04-24 22:06:01 +0000</bug_when>
    <thetext>Let&apos;s change the example to have &quot;new&quot; before SpeechSynthesisUtterance().

I have no strong opinion on whether we should allow &quot;new&quot; to be optional, but at first glance, it doesn&apos;t feel right to me - &quot;new&quot; is still required for things like XMLHttpRequest, and Date() is more of an exceptional case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93230</commentid>
    <comment_count>2</comment_count>
    <who name="Glen Shires">gshires</who>
    <bug_when>2013-09-11 08:31:56 +0000</bug_when>
    <thetext>I propose the following errata.
If there&apos;s no disagreement, I&apos;ll add this to the errata page on Sept 24.

Section 6.2 Example 1:
&quot;speechSynthesis.speak(SpeechSynthesisUtterance(&apos;Hello World&apos;));&quot; should be
&quot;speechSynthesis.speak(new SpeechSynthesisUtterance(&apos;Hello World&apos;));&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93736</commentid>
    <comment_count>3</comment_count>
    <who name="Glen Shires">gshires</who>
    <bug_when>2013-09-24 16:04:57 +0000</bug_when>
    <thetext>I&apos;ve updated the errata (E09) with the above change:
https://dvcs.w3.org/hg/speech-api/rev/819c4810d8dc

As always, the current errata is at:
http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi-errata.html</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>