summaryrefslogtreecommitdiffstats
path: root/dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html')
-rw-r--r--dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html79
1 files changed, 79 insertions, 0 deletions
diff --git a/dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html b/dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html
new file mode 100644
index 000000000..ad5cb7d86
--- /dev/null
+++ b/dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <script type="application/javascript" src="pc.js"></script>
+</head>
+<body>
+<pre id="test">
+<script type="application/javascript;version=1.8">
+ createHTML({
+ bug: "857765",
+ title: "Throw in PeerConnection callbacks"
+ });
+
+runNetworkTest(function () {
+ function finish() {
+ window.onerror = oldOnError;
+ is(error_count, 7, "Seven expected errors verified.");
+ networkTestFinished();
+ }
+
+ function getFail() {
+ return err => {
+ window.onerror = oldOnError;
+ generateErrorCallback()(err);
+ };
+ }
+
+ let error_count = 0;
+ let oldOnError = window.onerror;
+ window.onerror = (errorMsg, url, lineNumber) => {
+ if (errorMsg.indexOf("Expected") == -1) {
+ getFail()(errorMsg);
+ }
+ error_count += 1;
+ info("onerror " + error_count + ": " + errorMsg);
+ if (error_count == 7) {
+ finish();
+ }
+ throw new Error("window.onerror may throw");
+ return false;
+ }
+
+ let pc0, pc1, pc2;
+ // Test failure callbacks (limited to 1 for now)
+ pc0 = new RTCPeerConnection();
+ pc0.createOffer(getFail(), function(err) {
+ pc1 = new RTCPeerConnection();
+ pc2 = new RTCPeerConnection();
+
+ // Test success callbacks (happy path)
+ navigator.mozGetUserMedia({video:true}, function(video1) {
+ pc1.addStream(video1);
+ pc1.createOffer(function(offer) {
+ pc1.setLocalDescription(offer, function() {
+ pc2.setRemoteDescription(offer, function() {
+ pc2.createAnswer(function(answer) {
+ pc2.setLocalDescription(answer, function() {
+ pc1.setRemoteDescription(answer, function() {
+ throw new Error("Expected");
+ }, getFail());
+ throw new Error("Expected");
+ }, getFail());
+ throw new Error("Expected");
+ }, getFail());
+ throw new Error("Expected");
+ }, getFail());
+ throw new Error("Expected");
+ }, getFail());
+ throw new Error("Expected");
+ }, getFail());
+ }, getFail());
+ throw new Error("Expected");
+ });
+});
+
+</script>
+</pre>
+</body>
+</html>