Skip to content

Commit

Permalink
[WebRTC] Preparation CL for making Plan B throw an exception.
Browse files Browse the repository at this point in the history
This CL adds the code that makes constructing an RTCPeerConnection with
{sdpSemantics:"plan-b"} throw an exception, however it also adds a kill
switch for this code path that is enabled by default (meaning we will
not throw an exception).

The kill switch will be made DISABLED_BY_DEFAULT in a follow-up CL so
that in case we have to revert "making Plan B throw" we don't have to
revert evertything this CL is adding, including a web platform test and
a use counter that is likely to cause merge conflicts if reverted.

Bug: chromium:857004
Change-Id: I8452b6d883ec71ba77cc59275b038ae2cac41c73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2949808
Reviewed-by: Harald Alvestrand <hta@chromium.org>
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Commit-Queue: Henrik Boström <hbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#891596}
  • Loading branch information
henbos authored and chromium-wpt-export-bot committed Jun 11, 2021
1 parent 10b1658 commit 66bea91
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions webrtc/RTCPeerConnection-plan-b-is-not-supported.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!doctype html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title></title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
'use strict';

promise_test(async t => {
// Plan B is a legacy feature that should not be supported on a modern
// browser. To pass this test you must either ignore sdpSemantics altogether
// (and construct with Unified Plan despite us asking for Plan B) or throw an
// exception.
let pc = null;
try {
pc = new RTCPeerConnection({sdpSemantics:"plan-b"});
t.add_cleanup(() => pc.close());
} catch (e) {
// Test passed!
return;
}
// If we did not throw, we must not have gotten what we asked for. If
// sdpSemantics is not recognized by the browser it will be undefined here.
assert_not_equals(pc.getConfiguration().sdpSemantics, "plan-b");
}, 'Plan B is not supported');

</script>

0 comments on commit 66bea91

Please sign in to comment.