Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(864)

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 16023011: Make RTC work on Firefox (mostly). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 3bb3ec27a797671c48c9f6109aa6f4a086238033..0bdc70da859a091e240b79e5a98391f724348127 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -17286,7 +17286,13 @@ class RtcDtmfToneChangeEvent extends Event native "RTCDTMFToneChangeEvent" {
@Experimental
class RtcIceCandidate native "RTCIceCandidate" {
factory RtcIceCandidate(Map dictionary) {
- return JS('RtcIceCandidate', 'new RTCIceCandidate(#)',
+ // 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');
+ return JS('RtcIceCandidate', 'new #(#)', constructorName,
convertDartToNative_SerializedScriptValue(dictionary));
}
@@ -17346,11 +17352,12 @@ class RtcPeerConnection extends EventTarget native "RTCPeerConnection" {
// Currently in Firefox some of the RTC elements are defined but throw an
// error unless the user has specifically enabled them in their
// about:config. So we have to construct an element to actually test if RTC
- // is supported at at the given time.
+ // is supported at the given time.
try {
- var c = new RtcPeerConnection({"iceServers": [ {"url":"stun:foo.com"}]});
- return c is RtcPeerConnection;
- } catch (_) {}
+ new RtcPeerConnection(
+ {"iceServers": [ {"url":"stun:localhost"}]});
+ return true;
+ } catch (_) { return false;}
return false;
}
Future<RtcSessionDescription> createOffer([Map mediaConstraints]) {
@@ -17633,8 +17640,6 @@ class RtcPeerConnection extends EventTarget native "RTCPeerConnection" {
Stream<Event> get onSignalingStateChange => signalingStateChangeEvent.forTarget(this);
}
-
-
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -17645,7 +17650,14 @@ class RtcPeerConnection extends EventTarget native "RTCPeerConnection" {
@Experimental
class RtcSessionDescription native "RTCSessionDescription" {
factory RtcSessionDescription(Map dictionary) {
- return JS('RtcSessionDescription', 'new RTCSessionDescription(#)',
+ // 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');
+ return JS('RtcSessionDescription',
+ 'new #(#)', constructorName,
convertDartToNative_SerializedScriptValue(dictionary));
}
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698