Bug 1358401. P4 - reject the promise with an error string in UpdateSessionFunc(). draft
authorJW Wang <jwwang@mozilla.com>
Fri, 21 Apr 2017 15:35:41 +0800
changeset 566255 3b6773087591056db5f0dac0493ebfa8d4722880
parent 566254 d23a44705268d21d99c794054293ed2b5ec52e84
child 625270 7eaed4add5b244f4cbf78007ed72741adf740514
push id55168
push userjwwang@mozilla.com
push dateFri, 21 Apr 2017 08:39:02 +0000
bugs1358401
milestone55.0a1
Bug 1358401. P4 - reject the promise with an error string in UpdateSessionFunc(). MozReview-Commit-ID: 2bFb9NBQPxk
dom/media/test/eme.js
--- a/dom/media/test/eme.js
+++ b/dom/media/test/eme.js
@@ -126,32 +126,31 @@ function UpdateSessionFunc(test, token, 
       if (key) {
         Log(token, "found key " + key + " for key id " + idHex);
         outKeys.push({
           "kty":"oct",
           "kid":id64,
           "k":HexToBase64(key)
         });
       } else {
-        bail(token + " couldn't find key for key id " + idHex)("No such key");
+        reject(`${token} couldn't find key for key id ${idHex}`);
       }
     }
 
     var update = JSON.stringify({
       "keys" : outKeys,
       "type" : msg.type
     });
     Log(token, "sending update message to CDM: " + update);
 
     ev.target.update(StringToArrayBuffer(update)).then(function() {
       Log(token, "MediaKeySession update ok!");
       resolve(ev.target);
     }).catch(function(reason) {
-      bail(token + " MediaKeySession update failed")(reason);
-      reject();
+      reject(`${token} MediaKeySession update failed: ${reason}`);
     });
   }
 }
 
 function MaybeCrossOriginURI(test, uri)
 {
   if (test.crossOrigin) {
     return "http://test2.mochi.test:8888/tests/dom/media/test/allowed.sjs?" + uri;