| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Test close the key session associated with the object when the pa
ge is inaccessible</title> |
| 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 </head> |
| 8 <body> |
| 9 <script> |
| 10 var iframe; |
| 11 |
| 12 function load_iframe(src) { |
| 13 return new Promise(function(resolve) { |
| 14 iframe = document.createElement('iframe'); |
| 15 iframe.onload = function() { resolve(iframe); }; |
| 16 iframe.src = src; |
| 17 document.documentElement.appendChild(iframe); |
| 18 }); |
| 19 } |
| 20 |
| 21 function wait_for_message() { |
| 22 return new Promise(function(resolve) { |
| 23 self.addEventListener('message', function listener(e) { |
| 24 if (e.data.comm == 'init-completed') { |
| 25 iframe.contentWindow.postMessage({comm: 'close'}, '*
'); |
| 26 } else if (e.data.comm == 'close-received') { |
| 27 iframe.remove(); |
| 28 window.postMessage({result: 'finished'}, '*'); |
| 29 } else { |
| 30 resolve(e.data); |
| 31 self.removeEventListener('message', listener); |
| 32 } |
| 33 }); |
| 34 }); |
| 35 } |
| 36 |
| 37 async_test(function(test) { |
| 38 load_iframe("../resources/encrypted-media-session-close-and-conte
xt-destroyed-iframe.html").then(function(iframe) { |
| 39 iframe.contentWindow.postMessage({comm: 'init'}, '*'); |
| 40 return wait_for_message(); |
| 41 }).then(function(message) { |
| 42 assert_equals(message.result, 'finished'); |
| 43 test.done(); |
| 44 }); |
| 45 }, 'Test close the key session associated with the object when the p
age is inaccessible'); |
| 46 </script> |
| 47 </body> |
| 48 </html> |
| OLD | NEW |