Bug 985274 - Ensure generated callback function handles string objects. r=drno
authorJason Smith <jsmith@mozilla.com>
Mon, 24 Mar 2014 20:57:15 -0700
changeset 175555 ef3e291155ae4edf326a07c87f16d61ceabe983c
parent 175554 85a3429366fcc515322d73022aeeb635e965c0c7
child 175556 2de3bb4941ed5d8fa43cf4913b12e51ee270c58f
push id26492
push userryanvm@gmail.com
push dateThu, 27 Mar 2014 00:57:51 +0000
treeherdermozilla-central@441f5fd256e2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno
bugs985274
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 985274 - Ensure generated callback function handles string objects. r=drno
dom/media/tests/mochitest/head.js
dom/media/tests/mochitest/pc.js
dom/media/tests/mochitest/test_dataChannel_noOffer.html
dom/media/tests/mochitest/test_getUserMedia_basicAudio.html
dom/media/tests/mochitest/test_getUserMedia_basicVideo.html
dom/media/tests/mochitest/test_getUserMedia_basicVideoAudio.html
dom/media/tests/mochitest/test_getUserMedia_gumWithinGum.html
dom/media/tests/mochitest/test_getUserMedia_playAudioTwice.html
dom/media/tests/mochitest/test_getUserMedia_playVideoAudioTwice.html
dom/media/tests/mochitest/test_getUserMedia_playVideoTwice.html
dom/media/tests/mochitest/test_getUserMedia_stopAudioStream.html
dom/media/tests/mochitest/test_getUserMedia_stopAudioStreamWithFollowupAudio.html
dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStream.html
dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStreamWithFollowupVideoAudio.html
dom/media/tests/mochitest/test_getUserMedia_stopVideoStream.html
dom/media/tests/mochitest/test_getUserMedia_stopVideoStreamWithFollowupVideo.html
dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html
dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html
--- a/dom/media/tests/mochitest/head.js
+++ b/dom/media/tests/mochitest/head.js
@@ -122,17 +122,17 @@ function runTest(aCallback) {
       ['media.peerconnection.identity.enabled', true],
       ['media.peerconnection.identity.timeout', 3000],
       ['media.navigator.permission.disabled', true]]
     }, function () {
       try {
         aCallback();
       }
       catch (err) {
-        unexpectedCallbackAndFinish()(err);
+        generateErrorCallback()(err);
       }
     });
   } else {
     // Steeplechase, let it call the callback.
     window.run_test = function(is_initiator) {
       var options = {is_local: is_initiator,
                      is_remote: !is_initiator};
       aCallback(options);
@@ -209,28 +209,34 @@ function getBlobContent(blob, onSuccess)
  * Generates a callback function fired only under unexpected circumstances
  * while running the tests. The generated function kills off the test as well
  * gracefully.
  *
  * @param {String} [message]
  *        An optional message to show if no object gets passed into the
  *        generated callback method.
  */
-function unexpectedCallbackAndFinish(message) {
+function generateErrorCallback(message) {
   var stack = new Error().stack.split("\n");
   stack.shift(); // Don't include this instantiation frame
 
   /**
    * @param {object} aObj
    *        The object fired back from the callback
    */
   return function (aObj) {
-    if (aObj && aObj.name && aObj.message) {
-      ok(false, "Unexpected callback for '" + aObj.name + "' with message = '" +
-         aObj.message + "' at " + JSON.stringify(stack));
+    if (aObj) {
+      if (aObj.name && aObj.message) {
+        ok(false, "Unexpected callback for '" + aObj.name +
+           "' with message = '" + aObj.message + "' at " +
+           JSON.stringify(stack));
+      } else {
+        ok(false, "Unexpected callback with = '" + aObj +
+           "' at: " + JSON.stringify(stack));
+      }
     } else {
       ok(false, "Unexpected callback with message = '" + message +
          "' at: " + JSON.stringify(stack));
     }
     SimpleTest.finish();
   }
 }
 
--- a/dom/media/tests/mochitest/pc.js
+++ b/dom/media/tests/mochitest/pc.js
@@ -1269,17 +1269,17 @@ PeerConnectionWrapper.prototype = {
 
           if (constraints.video) {
             type += 'video';
           }
 
           self.attachMedia(stream, type, 'local');
 
           _getAllUserMedia(constraintsList, index + 1);
-        }, unexpectedCallbackAndFinish());
+        }, generateErrorCallback());
       } else {
         onSuccess();
       }
     }
 
     info("Get " + this.constraints.length + " local streams");
     _getAllUserMedia(this.constraints, 0);
   },
@@ -1318,64 +1318,64 @@ PeerConnectionWrapper.prototype = {
    */
   createOffer : function PCW_createOffer(onSuccess) {
     var self = this;
 
     this._pc.createOffer(function (offer) {
       info("Got offer: " + JSON.stringify(offer));
       self._last_offer = offer;
       onSuccess(offer);
-    }, unexpectedCallbackAndFinish(), this.offerConstraints);
+    }, generateErrorCallback(), this.offerConstraints);
   },
 
   /**
    * Creates an answer and automatically handles the failure case.
    *
    * @param {function} onSuccess
    *        Callback to execute if the answer was created successfully
    */
   createAnswer : function PCW_createAnswer(onSuccess) {
     var self = this;
 
     this._pc.createAnswer(function (answer) {
       info(self + ": Got answer: " + JSON.stringify(answer));
       self._last_answer = answer;
       onSuccess(answer);
-    }, unexpectedCallbackAndFinish());
+    }, generateErrorCallback());
   },
 
   /**
    * Sets the local description and automatically handles the failure case.
    *
    * @param {object} desc
    *        mozRTCSessionDescription for the local description request
    * @param {function} onSuccess
    *        Callback to execute if the local description was set successfully
    */
   setLocalDescription : function PCW_setLocalDescription(desc, onSuccess) {
     var self = this;
     this._pc.setLocalDescription(desc, function () {
       info(self + ": Successfully set the local description");
       onSuccess();
-    }, unexpectedCallbackAndFinish());
+    }, generateErrorCallback());
   },
 
   /**
    * Tries to set the local description and expect failure. Automatically
    * causes the test case to fail if the call succeeds.
    *
    * @param {object} desc
    *        mozRTCSessionDescription for the local description request
    * @param {function} onFailure
    *        Callback to execute if the call fails.
    */
   setLocalDescriptionAndFail : function PCW_setLocalDescriptionAndFail(desc, onFailure) {
     var self = this;
     this._pc.setLocalDescription(desc,
-      unexpectedCallbackAndFinish("setLocalDescription should have failed."),
+      generateErrorCallback("setLocalDescription should have failed."),
       function (err) {
         info(self + ": As expected, failed to set the local description");
         onFailure(err);
     });
   },
 
   /**
    * Sets the remote description and automatically handles the failure case.
@@ -1385,32 +1385,32 @@ PeerConnectionWrapper.prototype = {
    * @param {function} onSuccess
    *        Callback to execute if the remote description was set successfully
    */
   setRemoteDescription : function PCW_setRemoteDescription(desc, onSuccess) {
     var self = this;
     this._pc.setRemoteDescription(desc, function () {
       info(self + ": Successfully set remote description");
       onSuccess();
-    }, unexpectedCallbackAndFinish());
+    }, generateErrorCallback());
   },
 
   /**
    * Tries to set the remote description and expect failure. Automatically
    * causes the test case to fail if the call succeeds.
    *
    * @param {object} desc
    *        mozRTCSessionDescription for the remote description request
    * @param {function} onFailure
    *        Callback to execute if the call fails.
    */
   setRemoteDescriptionAndFail : function PCW_setRemoteDescriptionAndFail(desc, onFailure) {
     var self = this;
     this._pc.setRemoteDescription(desc,
-      unexpectedCallbackAndFinish("setRemoteDescription should have failed."),
+      generateErrorCallback("setRemoteDescription should have failed."),
       function (err) {
         info(self + ": As expected, failed to set the remote description");
         onFailure(err);
     });
   },
 
   /**
    * Adds an ICE candidate and automatically handles the failure case.
@@ -1421,33 +1421,33 @@ PeerConnectionWrapper.prototype = {
    *        Callback to execute if the local description was set successfully
    */
   addIceCandidate : function PCW_addIceCandidate(candidate, onSuccess) {
     var self = this;
 
     this._pc.addIceCandidate(candidate, function () {
       info(self + ": Successfully added an ICE candidate");
       onSuccess();
-    }, unexpectedCallbackAndFinish());
+    }, generateErrorCallback());
   },
 
   /**
    * Tries to add an ICE candidate and expects failure. Automatically
    * causes the test case to fail if the call succeeds.
    *
    * @param {object} candidate
    *        SDP candidate
    * @param {function} onFailure
    *        Callback to execute if the call fails.
    */
   addIceCandidateAndFail : function PCW_addIceCandidateAndFail(candidate, onFailure) {
     var self = this;
 
     this._pc.addIceCandidate(candidate,
-      unexpectedCallbackAndFinish("addIceCandidate should have failed."),
+      generateErrorCallback("addIceCandidate should have failed."),
       function (err) {
         info(self + ": As expected, failed to add an ICE candidate");
         onFailure(err);
     }) ;
   },
 
   /**
    * Returns if the ICE the connection state is "connected".
@@ -1563,17 +1563,17 @@ PeerConnectionWrapper.prototype = {
    */
   getStats : function PCW_getStats(selector, onSuccess) {
     var self = this;
 
     this._pc.getStats(selector, function(stats) {
       info(self + ": Got stats: " + JSON.stringify(stats));
       self._last_stats = stats;
       onSuccess(stats);
-    }, unexpectedCallbackAndFinish());
+    }, generateErrorCallback());
   },
 
   /**
    * Checks that we are getting the media streams we expect.
    *
    * @param {object} stats
    *        The stats to check from this PeerConnectionWrapper
    */
--- a/dom/media/tests/mochitest/test_dataChannel_noOffer.html
+++ b/dom/media/tests/mochitest/test_dataChannel_noOffer.html
@@ -19,15 +19,15 @@
     // necessary to circumvent bug 864109
     var options = { mandatory: { OfferToReceiveAudio: true} };
 
     pc.createOffer(function (offer) {
       ok(!offer.sdp.contains("m=application"),
         "m=application is not contained in the SDP");
 
       SimpleTest.finish();
-    }, unexpectedCallbackAndFinish(), options);
+    }, generateErrorCallback(), options);
   }, true);
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_basicAudio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicAudio.html
@@ -29,18 +29,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 
     getUserMedia(constraints, function (aStream) {
       checkMediaStreamTracks(constraints, aStream);
 
       var playback = new LocalMediaStreamPlayback(testAudio, aStream);
       playback.playMedia(false, function () {
         aStream.stop();
         SimpleTest.finish();
-      }, unexpectedCallbackAndFinish());
+      }, generateErrorCallback());
 
-    }, unexpectedCallbackAndFinish());
+    }, generateErrorCallback());
 
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_basicVideo.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicVideo.html
@@ -29,18 +29,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 
     getUserMedia(constraints, function (aStream) {
       checkMediaStreamTracks(constraints, aStream);
 
       var playback = new LocalMediaStreamPlayback(testVideo, aStream);
       playback.playMedia(false, function () {
         aStream.stop();
         SimpleTest.finish();
-      }, unexpectedCallbackAndFinish());
+      }, generateErrorCallback());
 
-    }, unexpectedCallbackAndFinish());
+    }, generateErrorCallback());
 
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_basicVideoAudio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicVideoAudio.html
@@ -29,17 +29,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
     getUserMedia(constraints, function (aStream) {
       checkMediaStreamTracks(constraints, aStream);
 
       var playback = new LocalMediaStreamPlayback(testVideoAudio, aStream);
       playback.playMedia(false, function () {
         aStream.stop();
         SimpleTest.finish();
-      }, unexpectedCallbackAndFinish());
+      }, generateErrorCallback());
 
-    }, unexpectedCallbackAndFinish());
+    }, generateErrorCallback());
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_gumWithinGum.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_gumWithinGum.html
@@ -37,21 +37,21 @@ https://bugzilla.mozilla.org/show_bug.cg
           var testAudio = document.getElementById('testAudio');
           var audioStreamPlayback = new LocalMediaStreamPlayback(testAudio,
             audioStream);
 
           audioStreamPlayback.playMedia(false, function() {
             audioStream.stop();
             videoStream.stop();
             SimpleTest.finish();
-          }, unexpectedCallbackAndFinish());
+          }, generateErrorCallback());
 
-        }, unexpectedCallbackAndFinish());
+        }, generateErrorCallback());
 
-      }, unexpectedCallbackAndFinish());
+      }, generateErrorCallback());
 
-    }, unexpectedCallbackAndFinish());
+    }, generateErrorCallback());
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_playAudioTwice.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_playAudioTwice.html
@@ -29,19 +29,19 @@ https://bugzilla.mozilla.org/show_bug.cg
       var audioStreamPlayback = new LocalMediaStreamPlayback(testAudio,
         audioStream);
 
       audioStreamPlayback.playMedia(false, function() {
 
         audioStreamPlayback.playMedia(true, function() {
           audioStream.stop();
           SimpleTest.finish();
-        }, unexpectedCallbackAndFinish());
+        }, generateErrorCallback());
 
-      }, unexpectedCallbackAndFinish());
+      }, generateErrorCallback());
 
-    }, unexpectedCallbackAndFinish());
+    }, generateErrorCallback());
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_playVideoAudioTwice.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_playVideoAudioTwice.html
@@ -28,19 +28,19 @@ https://bugzilla.mozilla.org/show_bug.cg
       var testVideo = document.getElementById('testVideo');
       var streamPlayback = new LocalMediaStreamPlayback(testVideo, stream);
 
       streamPlayback.playMedia(false, function() {
 
         streamPlayback.playMedia(true, function() {
           stream.stop();
           SimpleTest.finish();
-        }, unexpectedCallbackAndFinish());
+        }, generateErrorCallback());
 
-      }, unexpectedCallbackAndFinish());
+      }, generateErrorCallback());
 
-    }, unexpectedCallbackAndFinish());
+    }, generateErrorCallback());
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_playVideoTwice.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_playVideoTwice.html
@@ -29,19 +29,19 @@ https://bugzilla.mozilla.org/show_bug.cg
       var videoStreamPlayback = new LocalMediaStreamPlayback(testVideo,
         videoStream);
 
       videoStreamPlayback.playMedia(false, function() {
 
         videoStreamPlayback.playMedia(true, function() {
           videoStream.stop();
           SimpleTest.finish();
-        }, unexpectedCallbackAndFinish());
+        }, generateErrorCallback());
 
-      }, unexpectedCallbackAndFinish());
+      }, generateErrorCallback());
 
-    }, unexpectedCallbackAndFinish());
+    }, generateErrorCallback());
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_stopAudioStream.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_stopAudioStream.html
@@ -25,16 +25,16 @@ https://bugzilla.mozilla.org/show_bug.cg
    * call stop() on the stream, and successfully get an ended event fired.
    */
   runTest(function () {
     getUserMedia({audio: true}, function(stream) {
       var testAudio = document.getElementById('testAudio');
       var audioStreamPlayback = new LocalMediaStreamPlayback(testAudio, stream);
 
       audioStreamPlayback.playMediaWithStreamStop(false, SimpleTest.finish,
-        unexpectedCallbackAndFinish());
-    }, unexpectedCallbackAndFinish());
+        generateErrorCallback());
+    }, generateErrorCallback());
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_stopAudioStreamWithFollowupAudio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_stopAudioStreamWithFollowupAudio.html
@@ -32,21 +32,21 @@ https://bugzilla.mozilla.org/show_bug.cg
 
       streamPlayback.playMediaWithStreamStop(false, function() {
         getUserMedia({audio: true}, function(secondStream) {
           streamPlayback.mediaStream = secondStream;
 
           streamPlayback.playMedia(false, function() {
             secondStream.stop();
             SimpleTest.finish();
-          }, unexpectedCallbackAndFinish());
+          }, generateErrorCallback());
 
-        }, unexpectedCallbackAndFinish());
+        }, generateErrorCallback());
 
-      }, unexpectedCallbackAndFinish());
+      }, generateErrorCallback());
 
-    }, unexpectedCallbackAndFinish());
+    }, generateErrorCallback());
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStream.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStream.html
@@ -25,16 +25,16 @@ https://bugzilla.mozilla.org/show_bug.cg
    * ended event fired.
    */
   runTest(function () {
     getUserMedia({video: true, audio: true}, function(stream) {
       var testVideo = document.getElementById('testVideo');
       var streamPlayback = new LocalMediaStreamPlayback(testVideo, stream);
 
       streamPlayback.playMediaWithStreamStop(false, SimpleTest.finish,
-        unexpectedCallbackAndFinish());
-    }, unexpectedCallbackAndFinish());
+        generateErrorCallback());
+    }, generateErrorCallback());
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStreamWithFollowupVideoAudio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStreamWithFollowupVideoAudio.html
@@ -32,21 +32,21 @@ https://bugzilla.mozilla.org/show_bug.cg
 
       streamPlayback.playMediaWithStreamStop(false, function() {
         getUserMedia({video: true, audio: true}, function(secondStream) {
           streamPlayback.mediaStream = secondStream;
 
           streamPlayback.playMedia(false, function() {
             secondStream.stop();
             SimpleTest.finish();
-          }, unexpectedCallbackAndFinish());
+          }, generateErrorCallback());
 
-        }, unexpectedCallbackAndFinish());
+        }, generateErrorCallback());
 
-      }, unexpectedCallbackAndFinish());
+      }, generateErrorCallback());
 
-    }, unexpectedCallbackAndFinish());
+    }, generateErrorCallback());
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_stopVideoStream.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_stopVideoStream.html
@@ -25,16 +25,16 @@ https://bugzilla.mozilla.org/show_bug.cg
    * call stop() on the stream, and successfully get an ended event fired.
    */
   runTest(function () {
     getUserMedia({video: true}, function(stream) {
       var testVideo = document.getElementById('testVideo');
       var videoStreamPlayback = new LocalMediaStreamPlayback(testVideo, stream);
 
       videoStreamPlayback.playMediaWithStreamStop(false, SimpleTest.finish,
-        unexpectedCallbackAndFinish());
-    }, unexpectedCallbackAndFinish());
+        generateErrorCallback());
+    }, generateErrorCallback());
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_getUserMedia_stopVideoStreamWithFollowupVideo.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_stopVideoStreamWithFollowupVideo.html
@@ -33,21 +33,21 @@ https://bugzilla.mozilla.org/show_bug.cg
 
       streamPlayback.playMediaWithStreamStop(false, function() {
         getUserMedia({video: true}, function(secondStream) {
           streamPlayback.mediaStream = secondStream;
 
           streamPlayback.playMedia(false, function() {
             secondStream.stop();
             SimpleTest.finish();
-          }, unexpectedCallbackAndFinish());
+          }, generateErrorCallback());
 
-        }, unexpectedCallbackAndFinish());
+        }, generateErrorCallback());
 
-      }, unexpectedCallbackAndFinish());
+      }, generateErrorCallback());
 
-    }, unexpectedCallbackAndFinish());
+    }, generateErrorCallback());
   });
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html
+++ b/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html
@@ -20,45 +20,45 @@
       ok(err.message && err.message.length, "Error message = " + err.message);
       nextStep();
     }
   };
 
   function testCreateAnswerError() {
     var pc = new mozRTCPeerConnection();
     info ("Testing createAnswer error callback");
-    pc.createAnswer(unexpectedCallbackAndFinish("createAnswer before offer should fail"),
+    pc.createAnswer(generateErrorCallback("createAnswer before offer should fail"),
                     errorCallback(testSetLocalDescriptionError));
   };
 
   function testSetLocalDescriptionError() {
     var pc = new mozRTCPeerConnection();
     info ("Testing setLocalDescription error callback");
     pc.setLocalDescription(new mozRTCSessionDescription({ sdp: "Picklechips!",
                                                           type: "offer" }),
-      unexpectedCallbackAndFinish("setLocalDescription with nonsense SDP should fail"),
+      generateErrorCallback("setLocalDescription with nonsense SDP should fail"),
       errorCallback(testSetRemoteDescriptionError));
   };
 
   function testSetRemoteDescriptionError() {
     var pc = new mozRTCPeerConnection();
     info ("Testing setRemoteDescription error callback");
     pc.setRemoteDescription(new mozRTCSessionDescription({ sdp: "Who?",
                                                            type: "offer" }),
-      unexpectedCallbackAndFinish("setRemoteDescription with nonsense SDP should fail"),
+      generateErrorCallback("setRemoteDescription with nonsense SDP should fail"),
       errorCallback(testAddIceCandidateError));
   };
 
   function testAddIceCandidateError() {
     var pc = new mozRTCPeerConnection();
     info ("Testing addIceCandidate error callback");
     pc.addIceCandidate(new mozRTCIceCandidate({ candidate: "Pony Lords, jump!",
                                                 sdpMid: "whee",
                                                 sdpMLineIndex: 1 }),
-      unexpectedCallbackAndFinish("addIceCandidate with nonsense candidate should fail"),
+      generateErrorCallback("addIceCandidate with nonsense candidate should fail"),
       errorCallback(SimpleTest.finish));
   };
 
   // No test for createOffer errors -- there's nothing we can do at this
   // level to evoke an error in createOffer.
 
   runTest(function () {
     testCreateAnswerError();
--- a/dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html
+++ b/dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html
@@ -70,15 +70,15 @@
     window.onerror = oldOnError;
     is(error_count, 7, "Seven expected errors verified.");
     SimpleTest.finish();
   }
 
   function getFail() {
     return function (err) {
       window.onerror = oldOnError;
-      unexpectedCallbackAndFinish()(err);
+      generateErrorCallback()(err);
     };
   }
 </script>
 </pre>
 </body>
 </html>