Title: [134245] trunk
Revision
134245
Author
[email protected]
Date
2012-11-12 08:34:45 -0800 (Mon, 12 Nov 2012)

Log Message

MediaStream API: Make sure that MediaConstraints only has optional and mandatory at the top level
https://bugs.webkit.org/show_bug.cgi?id=101733

Reviewed by Jochen Eisinger.

Source/WebCore:

This patch adds better verification to MediaConstraintsImpl.

Existing tests expanded to cover this change.

* Modules/mediastream/MediaConstraintsImpl.cpp:
(WebCore::MediaConstraintsImpl::initialize):

LayoutTests:

This patch adds more tests for MediaConstraints.

* fast/mediastream/RTCPeerConnection-expected.txt:
* fast/mediastream/RTCPeerConnection.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (134244 => 134245)


--- trunk/LayoutTests/ChangeLog	2012-11-12 16:20:49 UTC (rev 134244)
+++ trunk/LayoutTests/ChangeLog	2012-11-12 16:34:45 UTC (rev 134245)
@@ -1,3 +1,15 @@
+2012-11-12  Tommy Widenflycht  <[email protected]>
+
+        MediaStream API: Make sure that MediaConstraints only has optional and mandatory at the top level
+        https://bugs.webkit.org/show_bug.cgi?id=101733
+
+        Reviewed by Jochen Eisinger.
+
+        This patch adds more tests for MediaConstraints.
+
+        * fast/mediastream/RTCPeerConnection-expected.txt:
+        * fast/mediastream/RTCPeerConnection.html:
+
 2012-11-12  Allan Sandfeld Jensen  <[email protected]>
 
         [Qt] Support ResourceRequest's setTimeoutInterval

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-expected.txt (134244 => 134245)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-expected.txt	2012-11-12 16:20:49 UTC (rev 134244)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-expected.txt	2012-11-12 16:34:45 UTC (rev 134245)
@@ -31,6 +31,9 @@
 PASS new webkitRTCPeerConnection(null, {optional:{valid_and_supported_1:0}}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS new webkitRTCPeerConnection(null, {optional:[{valid_and_supported_1:0,valid_and_supported_2:0}]}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS new webkitRTCPeerConnection(null, {optional:[{invalid:0}]}); threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+PASS new webkitRTCPeerConnection(null, {valid_and_supported_1:1}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS new webkitRTCPeerConnection(null, {valid_but_unsupported_1:1}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS new webkitRTCPeerConnection(null, {valid_and_supported_2:1, mandatory:{valid_and_supported_1:1}}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection.html (134244 => 134245)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection.html	2012-11-12 16:20:49 UTC (rev 134244)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection.html	2012-11-12 16:34:45 UTC (rev 134245)
@@ -37,6 +37,9 @@
 shouldThrow("new webkitRTCPeerConnection(null, {optional:{valid_and_supported_1:0}});");
 shouldThrow("new webkitRTCPeerConnection(null, {optional:[{valid_and_supported_1:0,valid_and_supported_2:0}]});");
 shouldThrow("new webkitRTCPeerConnection(null, {optional:[{invalid:0}]});");
+shouldThrow("new webkitRTCPeerConnection(null, {valid_and_supported_1:1});");
+shouldThrow("new webkitRTCPeerConnection(null, {valid_but_unsupported_1:1});");
+shouldThrow("new webkitRTCPeerConnection(null, {valid_and_supported_2:1, mandatory:{valid_and_supported_1:1}});");
 </script>
 <script src=""
 </body>

Modified: trunk/Source/WebCore/ChangeLog (134244 => 134245)


--- trunk/Source/WebCore/ChangeLog	2012-11-12 16:20:49 UTC (rev 134244)
+++ trunk/Source/WebCore/ChangeLog	2012-11-12 16:34:45 UTC (rev 134245)
@@ -1,3 +1,17 @@
+2012-11-12  Tommy Widenflycht  <[email protected]>
+
+        MediaStream API: Make sure that MediaConstraints only has optional and mandatory at the top level
+        https://bugs.webkit.org/show_bug.cgi?id=101733
+
+        Reviewed by Jochen Eisinger.
+
+        This patch adds better verification to MediaConstraintsImpl.
+
+        Existing tests expanded to cover this change.
+
+        * Modules/mediastream/MediaConstraintsImpl.cpp:
+        (WebCore::MediaConstraintsImpl::initialize):
+
 2012-11-12  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r134223.

Modified: trunk/Source/WebCore/Modules/mediastream/MediaConstraintsImpl.cpp (134244 => 134245)


--- trunk/Source/WebCore/Modules/mediastream/MediaConstraintsImpl.cpp	2012-11-12 16:20:49 UTC (rev 134244)
+++ trunk/Source/WebCore/Modules/mediastream/MediaConstraintsImpl.cpp	2012-11-12 16:34:45 UTC (rev 134245)
@@ -65,6 +65,13 @@
     constraints.getOwnPropertyNames(names);
 
     String mandatory = ASCIILiteral("mandatory");
+    String optional = ASCIILiteral("optional");
+
+    for (Vector<String>::iterator it = names.begin(); it != names.end(); ++it) {
+        if (*it != mandatory && *it != optional)
+            return false;
+    }
+
     if (names.contains(mandatory)) {
         Dictionary mandatoryConstraints;
         bool ok = constraints.get(mandatory, mandatoryConstraints);
@@ -76,7 +83,6 @@
             return false;
     }
 
-    String optional = ASCIILiteral("optional");
     if (names.contains(optional)) {
         ArrayValue optionalConstraints;
         bool ok = constraints.get(optional, optionalConstraints);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to