Bug 1293613: Never attempt to read past end of manifest table. r?gerald
Should the events being waited for take a while to fire, we could have attempted to append more segments than the table contain causing an exception.
MozReview-Commit-ID: HnmLTqNQ5rb
--- a/testing/web-platform/tests/media-source/mediasource-util.js
+++ b/testing/web-platform/tests/media-source/mediasource-util.js
@@ -300,17 +300,20 @@
mediaElement.addEventListener(eventName, onEvent);
var i = startingIndex;
var onAppendDone = function() {
if (eventFired)
return;
i++;
- MediaSourceUtil.append(test, sourceBuffer, MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[i]), onAppendDone);
+ if (i < segmentInfo.media.length)
+ {
+ MediaSourceUtil.append(test, sourceBuffer, MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[i]), onAppendDone);
+ }
};
MediaSourceUtil.append(test, sourceBuffer, MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[i]), onAppendDone);
};
function addExtraTestMethods(test)
{
test.eventExpectations_ = new EventExpectationsManager(test);