Bug 80513

Summary: Speech JavaScript API: SpeechRecognitionEvent
Product: WebKit Reporter: Hans Wennborg <hans>
Component: New BugsAssignee: Hans Wennborg <hans>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, haraken, japhet, ojan, satish, steveblock, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 80424    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch abarth: review+, abarth: commit-queue-

Hans Wennborg
Reported 2012-03-07 07:43:55 PST
Speech JavaScript API: SpeechRecognitionEvent
Attachments
Patch (13.35 KB, patch)
2012-03-07 07:48 PST, Hans Wennborg
no flags
Patch (13.36 KB, patch)
2012-03-08 06:33 PST, Hans Wennborg
no flags
Patch (27.32 KB, patch)
2012-03-09 10:24 PST, Hans Wennborg
abarth: review+
abarth: commit-queue-
Hans Wennborg
Comment 1 2012-03-07 07:48:11 PST
Hans Wennborg
Comment 2 2012-03-08 06:33:33 PST
Created attachment 130818 [details] Patch Rebase, const-qualify readonly attribute getters, return raw pointers.
Adam Barth
Comment 3 2012-03-08 14:16:03 PST
Comment on attachment 130818 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=130818&action=review > Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl:29 > + interface [ > + Conditional=SCRIPTED_SPEECH > + ] SpeechRecognitionEvent : Event { Please use the ConstructorTemplate=Event and InitializedByEventConstructor: https://trac.webkit.org/wiki/WebKitIDL#ConstructorTemplate This will generate DOM4-style event constructors.
Adam Barth
Comment 4 2012-03-08 14:16:35 PST
+haraken because of ConstructorTemplate=Event
Adam Barth
Comment 5 2012-03-08 14:17:27 PST
Comment on attachment 130818 [details] Patch Once you have a DOM4-style event constructor, you can write tests that exercise this class. Note: you should also be able to exercise it with document.createEvent.
Kentaro Hara
Comment 6 2012-03-08 15:43:40 PST
Comment on attachment 130818 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=130818&action=review >> Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl:29 >> + ] SpeechRecognitionEvent : Event { > > Please use the ConstructorTemplate=Event and InitializedByEventConstructor: > > https://trac.webkit.org/wiki/WebKitIDL#ConstructorTemplate > > This will generate DOM4-style event constructors. And please add fast/events/constructors/speech-recognition-event-constructors.html for tests.
Hans Wennborg
Comment 7 2012-03-09 10:23:49 PST
(In reply to comment #6) > (From update of attachment 130818 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=130818&action=review > Thanks very much for the input! > >> Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl:29 > >> + ] SpeechRecognitionEvent : Event { > > > > Please use the ConstructorTemplate=Event and InitializedByEventConstructor: > > > > https://trac.webkit.org/wiki/WebKitIDL#ConstructorTemplate > > > > This will generate DOM4-style event constructors. Done. > > And please add fast/events/constructors/speech-recognition-event-constructors.html for tests. Done. New patch coming up.
Hans Wennborg
Comment 8 2012-03-09 10:24:21 PST
Adam Barth
Comment 9 2012-03-09 14:45:23 PST
Comment on attachment 131057 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131057&action=review > Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp:32 > + You've got an extra blank line here. > Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp:70 > +void SpeechRecognitionEvent::initSpeechRecognitionEvent(const AtomicString& type, bool canBubble, bool cancelable, SpeechRecognitionResult* result, SpeechRecognitionError* error, short resultIndex, SpeechRecognitionResultList* resultHistory) Oh, you can skip these init functions. DOM4-style events don't need them because you can just construct the event directly. We've been removing them from the platform. > Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl:42 > + void initSpeechRecognitionEvent(in [Optional=DefaultIsUndefined] DOMString typeArg, > + in [Optional=DefaultIsUndefined] boolean canBubbleArg, > + in [Optional=DefaultIsUndefined] boolean cancelableArg, > + in [Optional=DefaultIsUndefined] SpeechRecognitionResult resultArg, > + in [Optional=DefaultIsUndefined] SpeechRecognitionError errorArg, > + in [Optional=DefaultIsUndefined] short resultIndexArg, > + in [Optional=DefaultIsUndefined] SpeechRecognitionResultList resultHistoryArg); We should skip this. Sorry I didn't notice it in your previous patch. > LayoutTests/fast/events/constructors/speech-recognition-event-constructor.html:30 > +// Test passing resultIndex in the initializer. > +shouldBe("new webkitSpeechRecognitionEvent('eventType', { resultIndex: 42 }).resultIndex", "42"); I mean, you can also test the other properties, but maybe that's not worth while.
Hans Wennborg
Comment 10 2012-03-12 04:25:56 PDT
(In reply to comment #9) > (From update of attachment 131057 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=131057&action=review Thanks very much for the review! > > Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp:32 > > + > > You've got an extra blank line here. Done. > > Source/WebCore/Modules/speech/SpeechRecognitionEvent.cpp:70 > > +void SpeechRecognitionEvent::initSpeechRecognitionEvent(const AtomicString& type, bool canBubble, bool cancelable, SpeechRecognitionResult* result, SpeechRecognitionError* error, short resultIndex, SpeechRecognitionResultList* resultHistory) > > Oh, you can skip these init functions. DOM4-style events don't need them because you can just construct the event directly. We've been removing them from the platform. Done. > > Source/WebCore/Modules/speech/SpeechRecognitionEvent.idl:42 > > + void initSpeechRecognitionEvent(in [Optional=DefaultIsUndefined] DOMString typeArg, > > + in [Optional=DefaultIsUndefined] boolean canBubbleArg, > > + in [Optional=DefaultIsUndefined] boolean cancelableArg, > > + in [Optional=DefaultIsUndefined] SpeechRecognitionResult resultArg, > > + in [Optional=DefaultIsUndefined] SpeechRecognitionError errorArg, > > + in [Optional=DefaultIsUndefined] short resultIndexArg, > > + in [Optional=DefaultIsUndefined] SpeechRecognitionResultList resultHistoryArg); > > We should skip this. Sorry I didn't notice it in your previous patch. Done. It wasn't in the first patch. I copied it from StorageEvent.idl when adding ConstructorTemplate=Event, thinking maybe it was supposed to be there too. Thanks for clarifying. > > LayoutTests/fast/events/constructors/speech-recognition-event-constructor.html:30 > > +// Test passing resultIndex in the initializer. > > +shouldBe("new webkitSpeechRecognitionEvent('eventType', { resultIndex: 42 }).resultIndex", "42"); > > I mean, you can also test the other properties, but maybe that's not worth while. The SpeechRecognitionResult, Error and ResultList don't have constructors, so there's no straightforward way of testing those properties :/ Maybe I should just add constructors for them. Also realized I forgot to add this layout test to the Skipped files for the other ports. Doing that now.
Hans Wennborg
Comment 11 2012-03-12 04:28:24 PDT
Note You need to log in before you can comment on or make changes to this bug.