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.srcdoc = 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 = '