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

Side by Side Diff: Source/modules/mediastream/MediaDevices.cpp

Issue 1311473003: Removal of mediaDevices.getUserMedia from insecure origins (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "config.h" 5 #include "config.h"
6 #include "modules/mediastream/MediaDevices.h" 6 #include "modules/mediastream/MediaDevices.h"
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 UserMediaController* userMedia = UserMediaController::from(document->frame() ); 98 UserMediaController* userMedia = UserMediaController::from(document->frame() );
99 if (!userMedia) 99 if (!userMedia)
100 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError, "No media device controller available; is this a detac hed window?")); 100 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError, "No media device controller available; is this a detac hed window?"));
101 101
102 UserMediaRequest* request = UserMediaRequest::create(document, userMedia, op tions, successCallback, errorCallback, exceptionState); 102 UserMediaRequest* request = UserMediaRequest::create(document, userMedia, op tions, successCallback, errorCallback, exceptionState);
103 if (!request) { 103 if (!request) {
104 ASSERT(exceptionState.hadException()); 104 ASSERT(exceptionState.hadException());
105 return exceptionState.reject(scriptState); 105 return exceptionState.reject(scriptState);
106 } 106 }
107 107
108 String errorMessage;
109 if (!document->isPrivilegedContext(errorMessage)) {
110 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(NotSupportedError, errorMessage));
111 }
112
108 request->start(); 113 request->start();
109 return resolver->promise(); 114 return resolver->promise();
110 } 115 }
111 116
112 } // namespace blink 117 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/security/powerfulFeatureRestrictions/old-powerful-features-on-insecure-origin-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698