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

Unified Diff: third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp

Issue 2519403002: binding: Lets Dictionary::getPropertyNames, etc. rethrow an exception. (Closed)
Patch Set: Addressed review comments. 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp
index 2bc5aaa750f8ca1a70b2e71604aeccb131bfed48..e9a15eac46c3e07401d3a8554b946da93e04e576 100644
--- a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp
+++ b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp
@@ -346,12 +346,15 @@ WebRTCConfiguration parseConfiguration(ExecutionContext* context,
return webConfiguration;
}
-RTCOfferOptionsPlatform* parseOfferOptions(const Dictionary& options) {
+RTCOfferOptionsPlatform* parseOfferOptions(const Dictionary& options,
+ ExceptionState& exceptionState) {
if (options.isUndefinedOrNull())
- return 0;
+ return nullptr;
- Vector<String> propertyNames;
- options.getPropertyNames(propertyNames);
+ const Vector<String>& propertyNames =
+ options.getPropertyNames(exceptionState);
+ if (exceptionState.hadException())
+ return nullptr;
// Treat |options| as MediaConstraints if it is empty or has "optional" or
// "mandatory" properties for compatibility.
@@ -359,7 +362,7 @@ RTCOfferOptionsPlatform* parseOfferOptions(const Dictionary& options) {
// client code is ready.
if (propertyNames.isEmpty() || propertyNames.contains("optional") ||
propertyNames.contains("mandatory"))
- return 0;
+ return nullptr;
int32_t offerToReceiveVideo = -1;
int32_t offerToReceiveAudio = -1;
@@ -573,7 +576,8 @@ ScriptPromise RTCPeerConnection::createOffer(
ScriptState* scriptState,
RTCSessionDescriptionCallback* successCallback,
RTCPeerConnectionErrorCallback* errorCallback,
- const Dictionary& rtcOfferOptions) {
+ const Dictionary& rtcOfferOptions,
+ ExceptionState& exceptionState) {
DCHECK(successCallback);
DCHECK(errorCallback);
ExecutionContext* context = scriptState->getExecutionContext();
@@ -582,7 +586,10 @@ ScriptPromise RTCPeerConnection::createOffer(
if (callErrorCallbackIfSignalingStateClosed(m_signalingState, errorCallback))
return ScriptPromise::castUndefined(scriptState);
- RTCOfferOptionsPlatform* offerOptions = parseOfferOptions(rtcOfferOptions);
+ RTCOfferOptionsPlatform* offerOptions =
+ parseOfferOptions(rtcOfferOptions, exceptionState);
+ if (exceptionState.hadException())
+ return ScriptPromise();
RTCSessionDescriptionRequest* request =
RTCSessionDescriptionRequestImpl::create(getExecutionContext(), this,
successCallback, errorCallback);

Powered by Google App Engine
This is Rietveld 408576698