Skip to content

Commit d012dfc

Browse files
Markzipancommit-bot@chromium.org
authored andcommitted
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 <[email protected]> Commit-Queue: Mark Zhou <[email protected]> Auto-Submit: Mark Zhou <[email protected]>
1 parent 3edcf8f commit d012dfc

File tree

6 files changed

+13
-58
lines changed

6 files changed

+13
-58
lines changed

sdk/lib/html/dart2js/html_dart2js.dart

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25457,15 +25457,7 @@ class RtcDtmfToneChangeEvent extends Event {
2545725457
@Native("RTCIceCandidate,mozRTCIceCandidate")
2545825458
class RtcIceCandidate extends Interceptor {
2545925459
factory RtcIceCandidate(Map dictionary) {
25460-
// TODO(efortuna): Remove this check if when you can actually construct with
25461-
// the unprefixed RTCIceCandidate in Firefox (currently both are defined,
25462-
// but one can't be used as a constructor).
25463-
var constructorName = JS(
25464-
'',
25465-
'window[#]',
25466-
Device.isFirefox
25467-
? '${Device.propertyPrefix}RTCIceCandidate'
25468-
: 'RTCIceCandidate');
25460+
var constructorName = JS('', 'window[#]', 'RTCIceCandidate');
2546925461
return JS('RtcIceCandidate', 'new #(#)', constructorName,
2547025462
convertDartToNative_SerializedScriptValue(dictionary));
2547125463
}
@@ -25511,8 +25503,8 @@ class RtcLegacyStatsReport extends Interceptor {
2551125503
@Native("RTCPeerConnection,webkitRTCPeerConnection,mozRTCPeerConnection")
2551225504
class RtcPeerConnection extends EventTarget {
2551325505
factory RtcPeerConnection(Map rtcIceServers, [Map mediaConstraints]) {
25514-
var constructorName = JS('RtcPeerConnection', 'window[#]',
25515-
'${Device.propertyPrefix}RTCPeerConnection');
25506+
var constructorName =
25507+
JS('RtcPeerConnection', 'window[#]', 'RTCPeerConnection');
2551625508
if (mediaConstraints != null) {
2551725509
return JS(
2551825510
'RtcPeerConnection',
@@ -25847,15 +25839,7 @@ class RtcRtpSender extends Interceptor {
2584725839
@Native("RTCSessionDescription,mozRTCSessionDescription")
2584825840
class RtcSessionDescription extends Interceptor {
2584925841
factory RtcSessionDescription(Map dictionary) {
25850-
// TODO(efortuna): Remove this check if when you can actually construct with
25851-
// the unprefixed RTCIceCandidate in Firefox (currently both are defined,
25852-
// but one can't be used as a constructor).
25853-
var constructorName = JS(
25854-
'',
25855-
'window[#]',
25856-
Device.isFirefox
25857-
? '${Device.propertyPrefix}RTCSessionDescription'
25858-
: 'RTCSessionDescription');
25842+
var constructorName = JS('', 'window[#]', 'RTCSessionDescription');
2585925843
return JS('RtcSessionDescription', 'new #(#)', constructorName,
2586025844
convertDartToNative_SerializedScriptValue(dictionary));
2586125845
}

sdk_nnbd/lib/html/dart2js/html_dart2js.dart

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25459,15 +25459,7 @@ class RtcDtmfToneChangeEvent extends Event {
2545925459
@Native("RTCIceCandidate,mozRTCIceCandidate")
2546025460
class RtcIceCandidate extends Interceptor {
2546125461
factory RtcIceCandidate(Map dictionary) {
25462-
// TODO(efortuna): Remove this check if when you can actually construct with
25463-
// the unprefixed RTCIceCandidate in Firefox (currently both are defined,
25464-
// but one can't be used as a constructor).
25465-
var constructorName = JS(
25466-
'',
25467-
'window[#]',
25468-
Device.isFirefox
25469-
? '${Device.propertyPrefix}RTCIceCandidate'
25470-
: 'RTCIceCandidate');
25462+
var constructorName = JS('', 'window[#]', 'RTCIceCandidate');
2547125463
return JS('RtcIceCandidate', 'new #(#)', constructorName,
2547225464
convertDartToNative_SerializedScriptValue(dictionary));
2547325465
}
@@ -25513,8 +25505,8 @@ class RtcLegacyStatsReport extends Interceptor {
2551325505
@Native("RTCPeerConnection,webkitRTCPeerConnection,mozRTCPeerConnection")
2551425506
class RtcPeerConnection extends EventTarget {
2551525507
factory RtcPeerConnection(Map rtcIceServers, [Map mediaConstraints]) {
25516-
var constructorName = JS('RtcPeerConnection', 'window[#]',
25517-
'${Device.propertyPrefix}RTCPeerConnection');
25508+
var constructorName =
25509+
JS('RtcPeerConnection', 'window[#]', 'RTCPeerConnection');
2551825510
if (mediaConstraints != null) {
2551925511
return JS(
2552025512
'RtcPeerConnection',
@@ -25849,15 +25841,7 @@ class RtcRtpSender extends Interceptor {
2584925841
@Native("RTCSessionDescription,mozRTCSessionDescription")
2585025842
class RtcSessionDescription extends Interceptor {
2585125843
factory RtcSessionDescription(Map dictionary) {
25852-
// TODO(efortuna): Remove this check if when you can actually construct with
25853-
// the unprefixed RTCIceCandidate in Firefox (currently both are defined,
25854-
// but one can't be used as a constructor).
25855-
var constructorName = JS(
25856-
'',
25857-
'window[#]',
25858-
Device.isFirefox
25859-
? '${Device.propertyPrefix}RTCSessionDescription'
25860-
: 'RTCSessionDescription');
25844+
var constructorName = JS('', 'window[#]', 'RTCSessionDescription');
2586125845
return JS('RtcSessionDescription', 'new #(#)', constructorName,
2586225846
convertDartToNative_SerializedScriptValue(dictionary));
2586325847
}

tests/lib_2/html/rtc_test.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ main() {
2727
]
2828
});
2929
expect(pc is RtcPeerConnection, isTrue);
30-
// TODO(efortuna): Uncomment this test when RTCPeerConnection correctly
31-
// implements EventListener in Firefox (works correctly in nightly, so
32-
// it's coming!).
33-
//pc.onIceCandidate.listen((candidate) {});
30+
pc.onIceCandidate.listen((candidate) {});
3431
});
3532

3633
test('ice candidate', () {

tools/dom/templates/html/dart2js/impl_RTCIceCandidate.darttemplate

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@ part of $LIBRARYNAME;
66

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

tools/dom/templates/html/dart2js/impl_RTCSessionDescription.darttemplate

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@ part of $LIBRARYNAME;
66

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

tools/dom/templates/html/impl/impl_RTCPeerConnection.darttemplate

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ part of $LIBRARYNAME;
66

77
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
88
factory $CLASSNAME(Map rtcIceServers, [Map mediaConstraints]) {
9-
var constructorName = JS('RtcPeerConnection', 'window[#]',
10-
'${Device.propertyPrefix}RTCPeerConnection');
9+
var constructorName =
10+
JS('RtcPeerConnection', 'window[#]', 'RTCPeerConnection');
1111
if (mediaConstraints != null) {
1212
return JS('RtcPeerConnection', 'new #(#,#)', constructorName,
1313
convertDartToNative_SerializedScriptValue(rtcIceServers),

0 commit comments

Comments
 (0)