[dart:html] Add webkitSpeechRecognition to SpeechRecognition class

In Safari, the prototype of a SpeechRecognition object returns a
webkitSpeechRecognition prototype. This name is different than the
one in the @Native annotation, so dart2js fails to recognize it. We
should it to the annotation so we properly intercept it.

CoreLibraryReviewExempt: Changing bindings of dart:html, no change to API.
Change-Id: Ic533e1208dd28e521403998e43009e0f651e2dfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291961
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
This commit is contained in:
Srujan Gaddam 2023-03-31 17:32:54 +00:00 committed by Commit Queue
parent d259edfa28
commit 8ebed3d806
3 changed files with 15 additions and 2 deletions

View file

@ -28544,7 +28544,7 @@ class SpeechGrammarList extends JavaScriptObject
// BSD-style license that can be found in the LICENSE file.
@SupportedBrowser(SupportedBrowser.CHROME, '25')
@Native("SpeechRecognition")
@Native("SpeechRecognition,webkitSpeechRecognition")
class SpeechRecognition extends EventTarget {
// To suppress missing implicit constructor warnings.
factory SpeechRecognition._() {

View file

@ -342,6 +342,8 @@ _dart2js_dom_custom_native_specs = monitored.Dict(
'RTCDataChannel,DataChannel',
'ScriptProcessorNode':
'ScriptProcessorNode,JavaScriptAudioNode',
'SpeechRecognition':
'SpeechRecognition,webkitSpeechRecognition',
'TransitionEvent':
'TransitionEvent,WebKitTransitionEvent',
'CSSKeyframeRule':

View file

@ -5062,6 +5062,17 @@ final Map<String, Map<String, Set<String>>> nativeTypeToDartMembers = {
'removeStream': {'removeStream'},
'removeTrack': {'removeTrack'},
'signalingState': {'signalingState'}
},
'webkitSpeechRecognition': {
'abort': {'abort'},
'audioTrack': {'audioTrack'},
'continuous': {'continuous'},
'grammars': {'grammars'},
'interimResults': {'interimResults'},
'lang': {'lang'},
'maxAlternatives': {'maxAlternatives'},
'start': {'start'},
'stop': {'stop'}
}
};
@ -9755,7 +9766,7 @@ final Map<String, Set<String>> dartTypeToNativeTypes = {
'SpanElement': {'HTMLSpanElement'},
'SpeechGrammar': {'SpeechGrammar'},
'SpeechGrammarList': {'SpeechGrammarList'},
'SpeechRecognition': {'SpeechRecognition'},
'SpeechRecognition': {'SpeechRecognition', 'webkitSpeechRecognition'},
'SpeechRecognitionAlternative': {'SpeechRecognitionAlternative'},
'SpeechRecognitionError': {'SpeechRecognitionError'},
'SpeechRecognitionEvent': {'SpeechRecognitionEvent'},