OLD | NEW |
---|---|
1 /** | 1 /** |
2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /** | 7 /** |
8 * See http://dev.w3.org/2011/webrtc/editor/getusermedia.html for more | 8 * See http://dev.w3.org/2011/webrtc/editor/getusermedia.html for more |
9 * information on getUserMedia. See | 9 * information on getUserMedia. See |
10 * http://dev.w3.org/2011/webrtc/editor/webrtc.html for more information on | 10 * http://dev.w3.org/2011/webrtc/editor/webrtc.html for more information on |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1149 print_handler_(message, 'debug', 'red'); | 1149 print_handler_(message, 'debug', 'red'); |
1150 } | 1150 } |
1151 | 1151 |
1152 /** | 1152 /** |
1153 * @private | 1153 * @private |
1154 * @param {string} message Text to print. | 1154 * @param {string} message Text to print. |
1155 * @param {string} textField Element ID of where to print. | 1155 * @param {string} textField Element ID of where to print. |
1156 * @param {string} color Color of the text. | 1156 * @param {string} color Color of the text. |
1157 */ | 1157 */ |
1158 function print_handler_(message, textField, color) { | 1158 function print_handler_(message, textField, color) { |
1159 if (color == 'red' ) | 1159 try { |
perkj_chrome
2014/08/25 11:59:13
This looks weird. Isn't the point of this throw th
| |
1160 throw new Error(message); | 1160 if (color == 'red' ) |
1161 throw new Error(message); | |
1162 } finally { | |
1163 if (color == 'green' ) | |
1164 message += ' success'; | |
1161 | 1165 |
1162 if (color == 'green' ) | 1166 $(textField).innerHTML += '<span style="color:' + color + ';">' + message + |
1163 message += ' success'; | 1167 '</span><br>' |
1164 | 1168 |
1165 $(textField).innerHTML += '<span style="color:' + color + ';">' + message + | 1169 console.log(message); |
1166 '</span><br>' | 1170 } |
1167 | |
1168 console.log(message); | |
1169 } | 1171 } |
1170 | 1172 |
1171 /** | 1173 /** |
1172 * @private | 1174 * @private |
1173 * @param {string} stringRepresentation JavaScript as a string. | 1175 * @param {string} stringRepresentation JavaScript as a string. |
1174 * @return {Object} The PeerConnection constraints as a JavaScript dictionary. | 1176 * @return {Object} The PeerConnection constraints as a JavaScript dictionary. |
1175 */ | 1177 */ |
1176 function getEvaluatedJavaScript_(stringRepresentation) { | 1178 function getEvaluatedJavaScript_(stringRepresentation) { |
1177 try { | 1179 try { |
1178 var evaluatedJavaScript; | 1180 var evaluatedJavaScript; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1411 | 1413 |
1412 /** @private */ | 1414 /** @private */ |
1413 function readResponseHeader_(request, key) { | 1415 function readResponseHeader_(request, key) { |
1414 var value = request.getResponseHeader(key); | 1416 var value = request.getResponseHeader(key); |
1415 if (value == null || value.length == 0) { | 1417 if (value == null || value.length == 0) { |
1416 error_('Received empty value ' + value + | 1418 error_('Received empty value ' + value + |
1417 ' for response header key ' + key + '.'); | 1419 ' for response header key ' + key + '.'); |
1418 } | 1420 } |
1419 return parseInt(value); | 1421 return parseInt(value); |
1420 } | 1422 } |
OLD | NEW |