diff options
author | Moonchild <moonchild@palemoon.org> | 2021-02-25 01:03:57 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-02-25 01:03:57 +0000 |
commit | ceadffab6b357723981a429e11222daf6cd6dcfb (patch) | |
tree | 5603053048d6a460f79b22bdf165fb74d32d39b0 /testing/web-platform/tests/encrypted-media/scripts/unique-origin.js | |
parent | 14fb2f966e9b54598c451e3cb35b4aa0480dafed (diff) | |
parent | ad5a13bd501e379517da1a944c104a11d951a3f5 (diff) | |
download | UXP-RC_20210225.tar UXP-RC_20210225.tar.gz UXP-RC_20210225.tar.lz UXP-RC_20210225.tar.xz UXP-RC_20210225.zip |
Merge branch 'master' into releaseRC_20210225
Diffstat (limited to 'testing/web-platform/tests/encrypted-media/scripts/unique-origin.js')
-rw-r--r-- | testing/web-platform/tests/encrypted-media/scripts/unique-origin.js | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/testing/web-platform/tests/encrypted-media/scripts/unique-origin.js b/testing/web-platform/tests/encrypted-media/scripts/unique-origin.js deleted file mode 100644 index 523eb84a6..000000000 --- a/testing/web-platform/tests/encrypted-media/scripts/unique-origin.js +++ /dev/null @@ -1,64 +0,0 @@ -function runTest(config) { - // When the sandbox attribute is present on an iframe, it will - // treat the content as being from a unique origin. So try to - // call createMediaKeys() inside an iframe and it should fail. - - function load_iframe(src, sandbox) { - return new Promise(function (resolve) { - var iframe = document.createElement('iframe'); - iframe.onload = function () { - resolve(iframe); - }; - iframe.sandbox = sandbox; - iframe.src = src; - document.documentElement.appendChild(iframe); - }); - } - - function wait_for_message() { - return new Promise(function (resolve) { - self.addEventListener('message', function listener(e) { - resolve(e.data); - self.removeEventListener('message', listener); - }); - }); - } - - promise_test(function (test) { - var script = 'data:text/html,' + - '<script>' + - ' window.onmessage = function(e) {' + - ' navigator.requestMediaKeySystemAccess("' + config.keysystem + '", [{' + - ' initDataTypes: [\"' + config.initDataType + '\"],' + - ' audioCapabilities: [' + - ' { contentType:\'' + config.audioType + '\'},' + - ' ]' + - ' }]).then(function(access) {' + - ' return access.createMediaKeys();' + - ' }).then(function(mediaKeys) {' + - ' window.parent.postMessage({result: \'allowed\'}, \'*\');' + - ' }, function(error) {' + - ' window.parent.postMessage({result: \'failed\'}, \'*\');' + - ' });' + - ' };' + - '<\/script>'; - - // Verify that this page can create a MediaKeys first. - navigator.requestMediaKeySystemAccess(config.keysystem, [{ - initDataTypes: [config.initDataType], - audioCapabilities: [ - {contentType: config.audioType}, - ] - }]).then(function (access) { - return access.createMediaKeys(); - }).then(function (mediaKeys) { - // Success, so now create the iframe and try there. - return load_iframe(script, 'allow-scripts') - }).then(function (iframe) { - iframe.contentWindow.postMessage({}, '*'); - return wait_for_message(); - }).then(function (message) { - assert_equals(message.result, 'failed'); - }); - }, 'Unique origin is unable to create MediaKeys'); -} |