Removing 'webkit' prefix, as most modern web browsers will accept 'RTCPeerConnection'

Fixes #38325

Change-Id: I08589781c8e8647c1e6d403baf4d6106d5308181
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116941
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Auto-Submit: Mark Zhou <markzipan@google.com>
This commit is contained in:
Mark Zhou 2019-09-24 00:04:00 +00:00 committed by commit-bot@chromium.org
parent 3edcf8f959
commit d012dfc7a6
6 changed files with 13 additions and 58 deletions

View file

@ -25457,15 +25457,7 @@ class RtcDtmfToneChangeEvent extends Event {
@Native("RTCIceCandidate,mozRTCIceCandidate")
class RtcIceCandidate extends Interceptor {
factory RtcIceCandidate(Map dictionary) {
// TODO(efortuna): Remove this check if when you can actually construct with
// the unprefixed RTCIceCandidate in Firefox (currently both are defined,
// but one can't be used as a constructor).
var constructorName = JS(
'',
'window[#]',
Device.isFirefox
? '${Device.propertyPrefix}RTCIceCandidate'
: 'RTCIceCandidate');
var constructorName = JS('', 'window[#]', 'RTCIceCandidate');
return JS('RtcIceCandidate', 'new #(#)', constructorName,
convertDartToNative_SerializedScriptValue(dictionary));
}
@ -25511,8 +25503,8 @@ class RtcLegacyStatsReport extends Interceptor {
@Native("RTCPeerConnection,webkitRTCPeerConnection,mozRTCPeerConnection")
class RtcPeerConnection extends EventTarget {
factory RtcPeerConnection(Map rtcIceServers, [Map mediaConstraints]) {
var constructorName = JS('RtcPeerConnection', 'window[#]',
'${Device.propertyPrefix}RTCPeerConnection');
var constructorName =
JS('RtcPeerConnection', 'window[#]', 'RTCPeerConnection');
if (mediaConstraints != null) {
return JS(
'RtcPeerConnection',
@ -25847,15 +25839,7 @@ class RtcRtpSender extends Interceptor {
@Native("RTCSessionDescription,mozRTCSessionDescription")
class RtcSessionDescription extends Interceptor {
factory RtcSessionDescription(Map dictionary) {
// TODO(efortuna): Remove this check if when you can actually construct with
// the unprefixed RTCIceCandidate in Firefox (currently both are defined,
// but one can't be used as a constructor).
var constructorName = JS(
'',
'window[#]',
Device.isFirefox
? '${Device.propertyPrefix}RTCSessionDescription'
: 'RTCSessionDescription');
var constructorName = JS('', 'window[#]', 'RTCSessionDescription');
return JS('RtcSessionDescription', 'new #(#)', constructorName,
convertDartToNative_SerializedScriptValue(dictionary));
}

View file

@ -25459,15 +25459,7 @@ class RtcDtmfToneChangeEvent extends Event {
@Native("RTCIceCandidate,mozRTCIceCandidate")
class RtcIceCandidate extends Interceptor {
factory RtcIceCandidate(Map dictionary) {
// TODO(efortuna): Remove this check if when you can actually construct with
// the unprefixed RTCIceCandidate in Firefox (currently both are defined,
// but one can't be used as a constructor).
var constructorName = JS(
'',
'window[#]',
Device.isFirefox
? '${Device.propertyPrefix}RTCIceCandidate'
: 'RTCIceCandidate');
var constructorName = JS('', 'window[#]', 'RTCIceCandidate');
return JS('RtcIceCandidate', 'new #(#)', constructorName,
convertDartToNative_SerializedScriptValue(dictionary));
}
@ -25513,8 +25505,8 @@ class RtcLegacyStatsReport extends Interceptor {
@Native("RTCPeerConnection,webkitRTCPeerConnection,mozRTCPeerConnection")
class RtcPeerConnection extends EventTarget {
factory RtcPeerConnection(Map rtcIceServers, [Map mediaConstraints]) {
var constructorName = JS('RtcPeerConnection', 'window[#]',
'${Device.propertyPrefix}RTCPeerConnection');
var constructorName =
JS('RtcPeerConnection', 'window[#]', 'RTCPeerConnection');
if (mediaConstraints != null) {
return JS(
'RtcPeerConnection',
@ -25849,15 +25841,7 @@ class RtcRtpSender extends Interceptor {
@Native("RTCSessionDescription,mozRTCSessionDescription")
class RtcSessionDescription extends Interceptor {
factory RtcSessionDescription(Map dictionary) {
// TODO(efortuna): Remove this check if when you can actually construct with
// the unprefixed RTCIceCandidate in Firefox (currently both are defined,
// but one can't be used as a constructor).
var constructorName = JS(
'',
'window[#]',
Device.isFirefox
? '${Device.propertyPrefix}RTCSessionDescription'
: 'RTCSessionDescription');
var constructorName = JS('', 'window[#]', 'RTCSessionDescription');
return JS('RtcSessionDescription', 'new #(#)', constructorName,
convertDartToNative_SerializedScriptValue(dictionary));
}

View file

@ -27,10 +27,7 @@ main() {
]
});
expect(pc is RtcPeerConnection, isTrue);
// TODO(efortuna): Uncomment this test when RTCPeerConnection correctly
// implements EventListener in Firefox (works correctly in nightly, so
// it's coming!).
//pc.onIceCandidate.listen((candidate) {});
pc.onIceCandidate.listen((candidate) {});
});
test('ice candidate', () {

View file

@ -6,12 +6,7 @@ part of $LIBRARYNAME;
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
factory $CLASSNAME(Map dictionary) {
// TODO(efortuna): Remove this check if when you can actually construct with
// the unprefixed RTCIceCandidate in Firefox (currently both are defined,
// but one can't be used as a constructor).
var constructorName = JS('', 'window[#]',
Device.isFirefox ? '${Device.propertyPrefix}RTCIceCandidate' :
'RTCIceCandidate');
var constructorName = JS('', 'window[#]', 'RTCIceCandidate');
return JS('RtcIceCandidate', 'new #(#)', constructorName,
convertDartToNative_SerializedScriptValue(dictionary));
}

View file

@ -6,12 +6,7 @@ part of $LIBRARYNAME;
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
factory $CLASSNAME(Map dictionary) {
// TODO(efortuna): Remove this check if when you can actually construct with
// the unprefixed RTCIceCandidate in Firefox (currently both are defined,
// but one can't be used as a constructor).
var constructorName = JS('', 'window[#]',
Device.isFirefox ? '${Device.propertyPrefix}RTCSessionDescription' :
'RTCSessionDescription');
var constructorName = JS('', 'window[#]', 'RTCSessionDescription');
return JS('RtcSessionDescription',
'new #(#)', constructorName,
convertDartToNative_SerializedScriptValue(dictionary));

View file

@ -6,8 +6,8 @@ part of $LIBRARYNAME;
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
factory $CLASSNAME(Map rtcIceServers, [Map mediaConstraints]) {
var constructorName = JS('RtcPeerConnection', 'window[#]',
'${Device.propertyPrefix}RTCPeerConnection');
var constructorName =
JS('RtcPeerConnection', 'window[#]', 'RTCPeerConnection');
if (mediaConstraints != null) {
return JS('RtcPeerConnection', 'new #(#,#)', constructorName,
convertDartToNative_SerializedScriptValue(rtcIceServers),