allow-crossorigin.html (947B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/cors/support.js?pipe=sub"></script> 6 <link rel="help" href="https://html.spec.whatwg.org/#unhandled-promise-rejections"> 7 <link rel="help" href="https://html.spec.whatwg.org/#muted-errors"> 8 9 <body> 10 <script> 11 'use strict'; 12 setup({ 13 allow_uncaught_exception: true 14 }); 15 16 async_test(function(t) { 17 addEventListener('unhandledrejection', t.step_func(function(e) { 18 assert_equals(e.reason, 42, 'reason should be the one given by the script'); 19 t.done(); 20 })); 21 }, 'Promise rejection event should be received for the cross-origin CORS script'); 22 23 (function() { 24 var scriptEl = document.createElement('script'); 25 scriptEl.src = CROSSDOMAIN + 'support/promise-access-control.py?allow=true'; 26 scriptEl.crossOrigin = 'anonymous'; 27 document.body.appendChild(scriptEl); 28 }()); 29 </script> 30 </body>