empty.html (1145B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>Script src with an empty URL</title> 4 <script src=/resources/testharness.js></script> 5 <script src=/resources/testharnessreport.js></script> 6 <div id=log></div> 7 <script> 8 // For a better error message in case the UA tries to load "" (which resolves 9 // to this document). 10 setup({ 11 "allow_uncaught_exception": true, 12 }); 13 async_test(function(t) { 14 window.onerror = this.unreached_func("Should not get an error reported to " + 15 "the window before the script"); 16 var queued = false; 17 var script = document.createElement("script"); 18 script.onerror = this.step_func_done(function(ev) { 19 assert_equals(ev.type, "error"); 20 assert_false(ev.bubbles, "bubbles"); 21 assert_false(ev.cancelable, "cancelable"); 22 assert_true(ev.isTrusted, "isTrusted"); 23 assert_equals(ev.target, script); 24 assert_true(ev instanceof Event, "instanceof Event"); 25 assert_class_string(ev, "Event"); 26 assert_true(queued, "event should not be dispatched synchronously"); 27 }); 28 script.setAttribute("src", ""); 29 document.body.appendChild(script); 30 queued = true; 31 }); 32 </script>