<commit_before><!DOCTYPE html>
<html>
  <head>
    <script src="/media-resources/video-test.js"></script>
    <script src="/media/resources/media-source/webm/segment-info.js"></script>
    <script src="webkitmediasource-util.js"></script>
    <script>
      var segmentHelper = new MediaSourceTest.SegmentHelper(WebMSegmentInfo.testWebM);

      // Duration of HTMLMediaElement (i.e., video) changed.
      function onDurationChange()
      {
        consoleWrite("onDurationChange : video.duration is " + video.duration.toFixed(3));

        // Confirm that value of media-source duration matches value of
        // parent HTML Media Element's duration.
        // Do this only if the video tag ready state is greater
        // than HAVE_NOTHING.
        // Without metadata, parent media element won't have a duration value defined.
        if (video.readyState <= video.HAVE_NOTHING)
          return;

        // Don't use "testExpected()" so we won't log the actual duration as the floating point result may differ with different engines.
        reportExpected(mediaSource.duration == video.duration, "mediaSource.duration", "==", "video.duration", mediaSource.duration);
      }

      // Set duration of the MediaSource object to the input duration value.
      // Also check if any error, if specified, was raised.
      function verifySetDuration(testDurationValue, expectedError)
      {
        try {
          mediaSource.duration = testDurationValue;
          if (expectedError) {
            consoleWrite("FAIL: Media Source set duration. Expected an exception");
          }
        } catch (e) {
          if (!expectedError || !(e.code == expectedError)) {
            consoleWrite("FAIL: Media Source set duration. Unexpected exception " + e);
          }
          consoleWrite("PASS: Media Source set duration. " + "Got expected exception " + e);
          return;
        }

        // Confirm that value of media-source duration matches value that it was assigned.
        // Don't use "testExpected()" so we won't log the actual duration as the floating point result may differ with different engines.
        reportExpected(mediaSource.duration == testDurationValue, "mediaSource.duration", "==", "testDurationValue", mediaSource.duration);
      }
<commit_msg>Prefixed MediaSource: Clarify durationchange+readyState verification<commit_after><!DOCTYPE html>
<html>
  <head>
    <script src="/media-resources/video-test.js"></script>
    <script src="/media/resources/media-source/webm/segment-info.js"></script>
    <script src="webkitmediasource-util.js"></script>
    <script>
      var segmentHelper = new MediaSourceTest.SegmentHelper(WebMSegmentInfo.testWebM);

      // Duration of HTMLMediaElement (i.e., video) changed.
      function onDurationChange()
      {
        consoleWrite("onDurationChange : video.duration is " + video.duration.toFixed(3));
        if (video.readyState <= video.HAVE_NOTHING) {
          consoleWrite("FAIL: 'durationchange' event fired when HTMLMediaElement.readyState is <= HAVE_NOTHING");
          return;
        }

        // Confirm that value of media-source duration matches value of
        // parent HTML Media Element's duration.
        // Don't use "testExpected()" so we won't log the actual duration as the floating point result may differ with different engines.
        reportExpected(mediaSource.duration == video.duration, "mediaSource.duration", "==", "video.duration", mediaSource.duration);
      }

      // Set duration of the MediaSource object to the input duration value.
      // Also check if any error, if specified, was raised.
      function verifySetDuration(testDurationValue, expectedError)
      {
        try {
          mediaSource.duration = testDurationValue;
          if (expectedError) {
            consoleWrite("FAIL: Media Source set duration. Expected an exception");
            return;
          }
        } catch (e) {
          if (!expectedError || !(e.code == expectedError)) {
            consoleWrite("FAIL: Media Source set duration. Unexpected exception " + e);
          }
          consoleWrite("PASS: Media Source set duration. " + "Got expected exception " + e);
          return;
        }

        // Confirm that value of media-source duration matches value that it was assigned.
        // Don't use "testExpected()" so we won't log the actual duration as the floating point result may differ with different engines.
        reportExpected(mediaSource.duration == testDurationValue, "mediaSource.duration", "==", "testDurationValue", mediaSource.duration);
      }

{'fraction_non_alphanumeric': 0.1035457907330868, 'fraction_numerical': 0.00043506634761801175, 'mean_word_length': 2.793729372937294, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2148843', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1137, 'n_words': 371}