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

Side by Side Diff: content/browser/renderer_host/media/media_devices_dispatcher_host.cc

Issue 2468853002: Do not kill renderer when enumerateDevices is called from about:blank. (Closed)
Patch Set: rebase Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/media/media_devices_dispatcher_host.h" 5 #include "content/browser/renderer_host/media/media_devices_dispatcher_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 const url::Origin& security_origin, 110 const url::Origin& security_origin,
111 const EnumerateDevicesCallback& client_callback) { 111 const EnumerateDevicesCallback& client_callback) {
112 DCHECK_CURRENTLY_ON(BrowserThread::IO); 112 DCHECK_CURRENTLY_ON(BrowserThread::IO);
113 113
114 if (!request_audio_input && !request_video_input && !request_audio_output) { 114 if (!request_audio_input && !request_video_input && !request_audio_output) {
115 bad_message::ReceivedBadMessage( 115 bad_message::ReceivedBadMessage(
116 render_process_id_, bad_message::MDDH_INVALID_DEVICE_TYPE_REQUEST); 116 render_process_id_, bad_message::MDDH_INVALID_DEVICE_TYPE_REQUEST);
117 return; 117 return;
118 } 118 }
119 119
120 // Ignore requests from unique origins, but do not crash the renderer.
121 if (security_origin.unique())
122 return;
123
120 if (!MediaStreamManager::IsOriginAllowed(render_process_id_, 124 if (!MediaStreamManager::IsOriginAllowed(render_process_id_,
121 security_origin)) { 125 security_origin)) {
122 bad_message::ReceivedBadMessage(render_process_id_, 126 bad_message::ReceivedBadMessage(render_process_id_,
123 bad_message::MDDH_UNAUTHORIZED_ORIGIN); 127 bad_message::MDDH_UNAUTHORIZED_ORIGIN);
124 return; 128 return;
125 } 129 }
126 130
127 MediaDevicesManager::BoolDeviceTypes devices_to_enumerate; 131 MediaDevicesManager::BoolDeviceTypes devices_to_enumerate;
128 devices_to_enumerate[MEDIA_DEVICE_TYPE_AUDIO_INPUT] = request_audio_input; 132 devices_to_enumerate[MEDIA_DEVICE_TYPE_AUDIO_INPUT] = request_audio_input;
129 devices_to_enumerate[MEDIA_DEVICE_TYPE_VIDEO_INPUT] = request_video_input; 133 devices_to_enumerate[MEDIA_DEVICE_TYPE_VIDEO_INPUT] = request_video_input;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 for (const auto& device_info : enumeration[i]) { 285 for (const auto& device_info : enumeration[i]) {
282 result[i].push_back(TranslateDeviceInfo(has_permissions[i], 286 result[i].push_back(TranslateDeviceInfo(has_permissions[i],
283 device_id_salt_, group_id_salt_, 287 device_id_salt_, group_id_salt_,
284 security_origin, device_info)); 288 security_origin, device_info));
285 } 289 }
286 } 290 }
287 client_callback.Run(result); 291 client_callback.Run(result);
288 } 292 }
289 293
290 } // namespace content 294 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_devices_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698