Backed out 4 changesets (bug 1152151, bug 1152153, bug 1151693) for test_eme_persistent_sessions.html timeouts on multiple platforms.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 10 Apr 2015 00:21:43 -0400
changeset 238493 82fc1964041c88a1bb89a7075602b68dc0ac474e
parent 238492 b2e2a9ff51e92d723537c8a878201727313b60c3
child 238494 1610ee9ba5d8eb28a2036bf2b65f81fac7c877d6
push id58224
push userryanvm@gmail.com
push dateFri, 10 Apr 2015 04:21:48 +0000
treeherdermozilla-inbound@82fc1964041c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1152151, 1152153, 1151693
milestone40.0a1
backs out395ef92d464fdb75c2cee7e528ecd234306e7533
5b2e38cdb64d9a0b7ba4d50a48c7d545d23b4934
3a63c4087b9fdfe2bb391efa9aa8e8ba0225e3f0
88b5d5b06e0236ef4b96d25f636967beddfdadc4
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
Backed out 4 changesets (bug 1152151, bug 1152153, bug 1151693) for test_eme_persistent_sessions.html timeouts on multiple platforms. Backed out changeset 395ef92d464f (bug 1152153) Backed out changeset 5b2e38cdb64d (bug 1152151) Backed out changeset 3a63c4087b9f (bug 1151693) Backed out changeset 88b5d5b06e02 (bug 1151693) CLOSED TREE
dom/media/test/eme.js
dom/media/test/manifest.js
dom/media/test/test_eme_canvas_blocked.html
dom/media/test/test_eme_obs_notification.html
dom/media/test/test_eme_persistent_sessions.html
dom/media/test/test_eme_stream_capture_blocked.html
--- a/dom/media/test/eme.js
+++ b/dom/media/test/eme.js
@@ -68,62 +68,51 @@ function TimeStamp(token) {
              (ms < 10 ? "  " : (ms < 100 ? " " : ""));
   return token ? (time + " " + token) : time;
 }
 
 function Log(token, msg) {
   info(TimeStamp(token) + " " + msg);
 }
 
-function MediaErrorCodeToString(code)
-{
-  switch (code) {
-  case MediaError.MEDIA_ERROR_ABORTED         : return "MEDIA_ERROR_ABORTED";
-  case MediaError.MEDIA_ERR_NETWORK           : return "MEDIA_ERR_NETWORK";
-  case MediaError.MEDIA_ERR_DECODE            : return "MEDIA_ERR_DECODE";
-  case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED : return "MEDIA_ERR_SRC_NOT_SUPPORTED";
-  default: return String(code);
-  }
-}
-
 function TimeRangesToString(trs)
 {
   var l = trs.length;
   if (l === 0) { return "-"; }
   var s = "";
   var i = 0;
   for (;;) {
     s += trs.start(i) + "-" + trs.end(i);
     if (++i === l) { return s; }
     s += ",";
   }
 }
 
 function SourceBufferToString(sb)
 {
   return ("SourceBuffer{"
-    + (sb
-       ? ((sb.updating ? " updating," : "")
-          + " buffered="
-          + (sb.buffered ? TimeRangesToString(sb.buffered) : "?"))
-       : " ?")
-    + " }");
+    + "AppendMode=" + (sb.AppendMode || "-")
+    + ", updating=" + (sb.updating ? "true" : "false")
+    + ", buffered=" + TimeRangesToString(sb.buffered)
+    + ", audioTracks=" + (sb.audioTracks ? sb.audioTracks.length : "-")
+    + ", videoTracks=" + (sb.videoTracks ? sb.videoTracks.length : "-")
+    + "}");
 }
 
 function SourceBufferListToString(sbl)
 {
   return "SourceBufferList[" + sbl.map(SourceBufferToString).join(", ") + "]";
 }
 
 function UpdateSessionFunc(test, token, sessionType, resolve, reject) {
   return function(ev) {
     var msgStr = ArrayBufferToString(ev.message);
     var msg = JSON.parse(msgStr);
 
-    Log(token, "Session[" + ev.target.sessionId + "], got message from CDM: " + msgStr);
+    Log(token, "got message from CDM: " + msgStr);
     is(msg.type, sessionType, TimeStamp(token) + " key session type should match");
     ok(msg.kids, TimeStamp(token) + " message event should contain key ID array");
 
     var outKeys = [];
 
     for (var i = 0; i < msg.kids.length; i++) {
       var id64 = msg.kids[i];
       var idHex = Base64ToHex(msg.kids[i]).toLowerCase();
@@ -141,140 +130,93 @@ function UpdateSessionFunc(test, token, 
         bail(token + " couldn't find key for key id " + idHex);
       }
     }
 
     var update = JSON.stringify({
       "keys" : outKeys,
       "type" : msg.type
     });
-    Log(token, "Session[" + ev.target.sessionId + "], sending update message to CDM: " + update);
+    Log(token, "sending update message to CDM: " + update);
 
     ev.target.update(StringToArrayBuffer(update)).then(function() {
-      Log(token, "Session[" + ev.target.sessionId + "] update ok!");
+      Log(token, "MediaKeySession update ok!");
       resolve(ev.target);
     }).catch(function(reason) {
-      bail(token + " Session[" + ev.target.sessionId + "] update failed")(reason);
+      bail(token + " MediaKeySession update failed")(reason);
       reject();
     });
   }
 }
 
 function MaybeCrossOriginURI(test, uri)
 {
   if (test.crossOrigin) {
     return "http://test2.mochi.test:8888/tests/dom/media/test/allowed.sjs?" + uri;
   } else {
     return uri;
   }
 }
 
-function BSD16(a)
-{
-  var c = 0x1234;
-  var i = 0;
-  var l = a.length;
-  for (i = 0; i < l; i++) {
-    c = (((((c >>> 1) + ((c & 1) << 15)) | 0) + (a[i] & 0xff)) & 0xffff) | 0;
-  }
-  return c;
-};
-
 function AppendTrack(test, ms, track, token)
 {
   return new Promise(function(resolve, reject) {
     var sb;
     var curFragment = 0;
     var resolved = false;
     var fragmentFile;
-    var appendBufferTimer = null;
 
     function addNextFragment() {
       if (curFragment >= track.fragments.length) {
         Log(token, track.name + ": end of track");
+        resolve();
         resolved = true;
-        sb.removeEventListener("updateend", handleUpdateEnd);
-        resolve();
         return;
       }
 
-      var fragment = track.fragments[curFragment++];
-      if (typeof fragment === "string") {
-        fragment = { file:fragment, size:-1, bsd16:-1 };
-      }
-
-      fragmentFile = MaybeCrossOriginURI(test, fragment.file);
+      fragmentFile = MaybeCrossOriginURI(test, track.fragments[curFragment++]);
 
       var req = new XMLHttpRequest();
       req.open("GET", fragmentFile);
       req.responseType = "arraybuffer";
-      req.timeout = 10 * 1000; // 10s should be plenty of time to get small fragments!
 
       req.addEventListener("load", function() {
-        var u8array = new Uint8Array(req.response);
-        if (fragment.size !== undefined && fragment.size >= 0) {
-          is(u8array.length, fragment.size,
-             token + " fragment '" + fragmentFile + "' size: expected "
-             + fragment.size + ", got " + u8array.length);
-        }
-        if (fragment.bsd16 !== undefined && fragment.bsd16 >= 0) {
-          is(BSD16(u8array), fragment.bsd16,
-             token + " fragment '" + fragmentFile + "' checksum: expected "
-             + fragment.bsd16 + ", got " + BSD16(u8array));
-        }
         Log(token, track.name + ": fetch of " + fragmentFile + " complete, appending");
-        appendBufferTimer = setTimeout(function () {
-          if (!appendBufferTimer) { return; }
-          sb.removeEventListener("updateend", handleUpdateEnd);
-          reject("Timeout appendBuffer with fragment '" + fragmentFile + "'");
-        }, 10 * 1000);
-        sb.appendBuffer(u8array);
+        sb.appendBuffer(new Uint8Array(req.response));
       });
 
-      ["error", "abort", "timeout"
-      ].forEach(function(issue) {
-        req.addEventListener(issue, function() {
-          info(token + " " + issue + " fetching " + fragmentFile + ", status='" + req.statusText + "'");
-          resolved = true;
-          reject(issue + " fetching " + fragmentFile);
-        });
-      });
+      req.addEventListener("error", function(){info(token + " error fetching " + fragmentFile);});
+      req.addEventListener("abort", function(){info(token + " aborted fetching " + fragmentFile);});
 
       Log(token, track.name + ": addNextFragment() fetching next fragment " + fragmentFile);
       req.send(null);
     }
 
-    function handleUpdateEnd() {
-      if (appendBufferTimer) {
-        clearTimeout(appendBufferTimer);
-        appendBufferTimer = null;
-      }
+    Log(token, track.name + ": addSourceBuffer(" + track.type + ")");
+    sb = ms.addSourceBuffer(track.type);
+    sb.addEventListener("updateend", function() {
       if (ms.readyState == "ended") {
         /* We can get another updateevent as a result of calling ms.endOfStream() if
            the highest end time of our source buffers is different from that of the
            media source duration. Due to bug 1065207 this can happen because of
            inaccuracies in the frame duration calculations. Check if we are already
            "ended" and ignore the update event */
         Log(token, track.name + ": updateend when readyState already 'ended'");
         if (!resolved) {
           // Needed if decoder knows this was the last fragment and ended by itself.
           Log(token, track.name + ": but promise not resolved yet -> end of track");
+          resolve();
           resolved = true;
-          resolve();
         }
         return;
       }
       Log(token, track.name + ": updateend for " + fragmentFile + ", " + SourceBufferToString(sb));
       addNextFragment();
-    }
+    });
 
-    Log(token, track.name + ": addSourceBuffer(" + track.type + ")");
-    sb = ms.addSourceBuffer(track.type);
-
-    sb.addEventListener("updateend", handleUpdateEnd);
     addNextFragment();
   });
 }
 
 //Returns a promise that is resolved when the media element is ready to have
 //its play() function called; when it's loaded MSE fragments.
 function LoadTest(test, elem, token)
 {
@@ -302,32 +244,16 @@ function LoadTest(test, elem, token)
         Log(token, "end of stream");
         ms.endOfStream();
         resolve();
       });
     })
   });
 }
 
-// Same as LoadTest, but manage a token+"_load" start&finished.
-// Also finish main token if loading fails.
-function LoadTestWithManagedLoadToken(test, elem, manager, token)
-{
-  manager.started(token + "_load");
-  return LoadTest(test, elem, token)
-  .catch(function (reason) {
-    ok(false, TimeStamp(token) + " - Error during load: " + reason);
-    manager.finished(token + "_load");
-    manager.finished(token);
-  })
-  .then(function () {
-    manager.finished(token + "_load");
-  });
-}
-
 function SetupEME(test, token, params)
 {
   var v = document.createElement("video");
   v.crossOrigin = test.crossOrigin || false;
 
   // Log events dispatched to make debugging easier...
   [ "canplay", "canplaythrough", "ended", "error", "loadeddata",
     "loadedmetadata", "loadstart", "pause", "play", "playing", "progress",
--- a/dom/media/test/manifest.js
+++ b/dom/media/test/manifest.js
@@ -647,19 +647,19 @@ var gMetadataTests = [
 // Test files for Encrypted Media Extensions
 var gEMETests = [
   {
     name:"bipbop-cenc-videoinit.mp4",
     tracks: [
       {
         name:"video",
         type:"video/mp4; codecs=\"avc1.64000d\"",
-        fragments:[ { file:"bipbop-cenc-videoinit.mp4", size:1058, bsd16:63578 },
-                    { file:"bipbop-cenc-video1.m4s", size:25211, bsd16:39494 },
-                    { file:"bipbop-cenc-video2.m4s", size:22934, bsd16:24908 },
+        fragments:[ "bipbop-cenc-videoinit.mp4",
+                    "bipbop-cenc-video1.m4s",
+                    "bipbop-cenc-video2.m4s",
                   ]
       }
     ],
     keys: {
       // "keyid" : "key"
       "7e571d037e571d037e571d037e571d03" : "7e5733337e5733337e5733337e573333",
       "7e571d047e571d047e571d047e571d04" : "7e5744447e5744447e5744447e574444",
     },
@@ -668,19 +668,19 @@ var gEMETests = [
     duration:1.60,
   },
   {
     name:"bipbop-cenc-videoinit.mp4",
     tracks: [
       {
         name:"video",
         type:"video/mp4; codecs=\"avc1.64000d\"",
-        fragments:[ { file:"bipbop-cenc-videoinit.mp4", size:1058, bsd16:63578 },
-                    { file:"bipbop-cenc-video1.m4s", size:25211, bsd16:39494 },
-                    { file:"bipbop-cenc-video2.m4s", size:22934, bsd16:24908 },
+        fragments:[ "bipbop-cenc-videoinit.mp4",
+                    "bipbop-cenc-video1.m4s",
+                    "bipbop-cenc-video2.m4s",
                   ]
       }
     ],
     keys: {
       // "keyid" : "key"
       "7e571d037e571d037e571d037e571d03" : "7e5733337e5733337e5733337e573333",
       "7e571d047e571d047e571d047e571d04" : "7e5744447e5744447e5744447e574444",
     },
@@ -690,29 +690,29 @@ var gEMETests = [
     duration:1.60,
   },
   {
     name:"bipbop-cenc-videoinit.mp4",
     tracks: [
       {
         name:"audio",
         type:"audio/mp4; codecs=\"mp4a.40.2\"",
-        fragments:[ { file:"bipbop-cenc-audioinit.mp4", size:1000, bsd16:50248 },
-                    { file:"bipbop-cenc-audio1.m4s", size:921, bsd16:21737 },
-                    { file:"bipbop-cenc-audio2.m4s", size:565, bsd16:14663 },
-                    { file:"bipbop-cenc-audio3.m4s", size:977, bsd16:38572 },
+        fragments:[ "bipbop-cenc-audioinit.mp4",
+                    "bipbop-cenc-audio1.m4s",
+                    "bipbop-cenc-audio2.m4s",
+                    "bipbop-cenc-audio3.m4s",
                   ],
       },
       {
         name:"video",
         type:"video/mp4; codecs=\"avc1.64000d\"",
-        fragments:[ { file:"bipbop-cenc-videoinit.mp4", size:1058, bsd16:63578 },
-                    { file:"bipbop-cenc-video1.m4s", size:25211, bsd16:39494 },
-                    { file:"bipbop-cenc-video2.m4s", size:22934, bsd16:24908 },
-                  ]
+        fragments:[ "bipbop-cenc-videoinit.mp4",
+                    "bipbop-cenc-video1.m4s",
+                    "bipbop-cenc-video2.m4s",
+                  ],
       },
     ],
     keys: {
       // "keyid" : "key"
       "7e571d037e571d037e571d037e571d03" : "7e5733337e5733337e5733337e573333",
       "7e571d047e571d047e571d047e571d04" : "7e5744447e5744447e5744447e574444",
     },
     sessionType:"temporary",
@@ -720,29 +720,29 @@ var gEMETests = [
     duration:1.60,
   },
   {
     name:"bipbop-cenc-videoinit.mp4",
     tracks: [
       {
         name:"audio",
         type:"audio/mp4; codecs=\"mp4a.40.2\"",
-        fragments:[ { file:"bipbop-cenc-audioinit.mp4", size:1000, bsd16:50248 },
-                    { file:"bipbop-cenc-audio1.m4s", size:921, bsd16:21737 },
-                    { file:"bipbop-cenc-audio2.m4s", size:565, bsd16:14663 },
-                    { file:"bipbop-cenc-audio3.m4s", size:977, bsd16:38572 },
+        fragments:[ "bipbop-cenc-audioinit.mp4",
+                    "bipbop-cenc-audio1.m4s",
+                    "bipbop-cenc-audio2.m4s",
+                    "bipbop-cenc-audio3.m4s",
                   ],
       },
       {
         name:"video",
         type:"video/mp4; codecs=\"avc1.64000d\"",
-        fragments:[ { file:"bipbop-cenc-videoinit.mp4", size:1058, bsd16:63578 },
-                    { file:"bipbop-cenc-video1.m4s", size:25211, bsd16:39494 },
-                    { file:"bipbop-cenc-video2.m4s", size:22934, bsd16:24908 },
-                  ]
+        fragments:[ "bipbop-cenc-videoinit.mp4",
+                    "bipbop-cenc-video1.m4s",
+                    "bipbop-cenc-video2.m4s",
+                  ],
       },
     ],
     keys: {
       // "keyid" : "key"
       "7e571d037e571d037e571d037e571d03" : "7e5733337e5733337e5733337e573333",
       "7e571d047e571d047e571d047e571d04" : "7e5744447e5744447e5744447e574444",
     },
     sessionType:"temporary",
--- a/dom/media/test/test_eme_canvas_blocked.html
+++ b/dom/media/test/test_eme_canvas_blocked.html
@@ -33,17 +33,17 @@ function startTest(test, token)
       ctx.drawImage(video, 0, 0);
     } catch (ex) {
       threwError = true;
     }
     ok(threwError, TimeStamp(token) + " - Should throw an error when trying to draw EME video to canvas.");
     manager.finished(token);
   });
 
-  LoadTestWithManagedLoadToken(test, v, manager, token);
+  LoadTest(test, v, token);
 }
 
 function beginTest() {
   manager.runTests(gEMETests, startTest);
 }
 
 var prefs = [
   [ "media.mediasource.enabled", true ],
--- a/dom/media/test/test_eme_obs_notification.html
+++ b/dom/media/test/test_eme_obs_notification.html
@@ -34,29 +34,30 @@ SimpleTest.registerCleanupFunction(funct
   videos.clear();
   observedVideos.clear();
 });
 
 function startTest(test, token)
 {
   manager.started(token);
 
+
   var sessions = [];
 
   var v = SetupEME(test, token);
   videos.add(v);
   v.preload = "auto"; // Required due to "canplay" not firing for MSE unless we do this.
 
   v.addEventListener("loadeddata", function(ev) {
     ok(observedVideos.has(ev.target), "Should have been told about eme video through observer as well.");
     observedVideos.delete(ev.target);
     manager.finished(token);
   });
 
-  LoadTestWithManagedLoadToken(test, v, manager, token);
+  LoadTest(test, v, token);
 }
 
 function beginTest() {
   manager.runTests(gEMETests, startTest);
 }
 
 var prefs = [
   [ "media.mediasource.enabled", true ],
--- a/dom/media/test/test_eme_persistent_sessions.html
+++ b/dom/media/test/test_eme_persistent_sessions.html
@@ -69,16 +69,17 @@ function startTest(test, token)
 
   var keySystemAccess;
 
   var v = SetupEME(test, token,
     {
       onsessionupdated: function(session) {
         Log(token, "Session created");
         var sessionId;
+        initialSession = session;
 
         // Once the session has loaded and has all its keys usable, close
         // all sessions without calling remove() on them.
         AwaitAllKeysUsable(session, test.keys, token)
         .then(function() {
           sessionId = session.sessionId;
           Log(token, "Closing session with id=" + sessionId);
           return session.close();
@@ -141,21 +142,21 @@ function startTest(test, token)
           manager.finished(token);
         });
 
       },
       sessionType: "persistent",
     }
   );
 
-  LoadTestWithManagedLoadToken(test, v, manager, token);
+  LoadTest(test, v, token);
 }
 
 function beginTest() {
-  manager.runTests(gEMETests.filter(t => t.sessionCount === 1), startTest);
+  manager.runTests(gEMETests, startTest);
 }
 
 var prefs = [
   [ "media.mediasource.enabled", true ],
   [ "media.mediasource.mp4.enabled", true ],
 ];
 
 if (/Linux/.test(navigator.userAgent) ||
--- a/dom/media/test/test_eme_stream_capture_blocked.html
+++ b/dom/media/test/test_eme_stream_capture_blocked.html
@@ -27,17 +27,17 @@ function startTest(test, token)
   };
   var v1 = SetupEME(test, case1token,  { onSetKeysFail: setKeysFailed });
   var context = new AudioContext();
   var node = context.createMediaElementSource(v1);
   v1.addEventListener("loadeddata", function(ev) {
     ok(false, TimeStamp(case1token) + " should never reach loadeddata, as setMediaKeys should fail");
   });
   manager.started(case1token);
-  LoadTestWithManagedLoadToken(test, v1, manager, case1token);
+  LoadTest(test, v1, case1token);
 
 
   // Case 2. creating a MediaElementSource on a media element with a MediaKeys should fail.
   var case2token = token + "_case2";
   var v2 = SetupEME(test, case2token);
   v2.addEventListener("loadeddata", function(ev) {
     ok(true, case2token + " should reach loadeddata");
     var threw = false;
@@ -46,17 +46,17 @@ function startTest(test, token)
       var node = context.createMediaElementSource(v2);
     } catch (e) {
       threw = true;
     }
     ok(threw, "Should throw an error creating a MediaElementSource on an EME video.");
     manager.finished(case2token);
   });
   manager.started(case2token);
-  LoadTestWithManagedLoadToken(test, v2, manager, case2token);
+  LoadTest(test, v2, case2token);
 
 
   // Case 3. capturing a media element with mozCaptureStream that has a MediaKeys should fail.
   var case3token = token + "_case3";
   var v3 = SetupEME(test, case3token);
   v3.addEventListener("loadeddata", function(ev) {
     ok(true, TimeStamp(case3token) + " should reach loadeddata");
     var threw = false;
@@ -64,17 +64,17 @@ function startTest(test, token)
       var stream = v3.mozCaptureStreamUntilEnded();
     } catch (e) {
       threw = true;
     }
     ok(threw, TimeStamp(case3token) + " Should throw an error calling mozCaptureStreamUntilEnded an EME video.");
     manager.finished(case3token);
   });
   manager.started(case3token);
-  LoadTestWithManagedLoadToken(test, v3, manager, case3token);
+  LoadTest(test, v3, case3token);
 }
 
 function beginTest() {
   manager.runTests(gEMETests, startTest);
 }
 
 var prefs = [
   [ "media.mediasource.enabled", true ],