iframe-load-event.html (2004B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>Test some sanity behavior around iframe load/error events</title> 4 <script src=/resources/testharness.js></script> 5 <script src=/resources/testharnessreport.js></script> 6 <body> 7 <script> 8 async_test(function(t) { 9 var obj = document.createElement("iframe"); 10 obj.onload = t.step_func_done(function(e){ 11 assert_not_equals(obj.contentWindow, null, "The iframe element should represent a nested browsing context.") 12 assert_equals(Object.getPrototypeOf(e).constructor, Event, "The load event should use the Event interface."); 13 assert_true(e.isTrusted, "The load event should be a trusted event."); 14 assert_false(e.cancelable, "The load event should not be a cancelable event."); 15 assert_false(e.bubbles, "The load event should not be a bubble event."); 16 assert_equals(e.target, obj, "The load event target should be the corresponding object element."); 17 }); 18 19 obj.onerror = t.unreached_func("The error event should not be fired."); 20 21 var url = URL.createObjectURL(new Blob([""], { type: "text/html" })); 22 23 obj.src = url; 24 document.body.appendChild(obj); 25 }, "load event of blob URL"); 26 27 async_test(function(t) { 28 var obj = document.createElement("iframe"); 29 obj.onload = t.step_func_done(function(e){ 30 assert_not_equals(obj.contentWindow, null, "The object element should represent a nested browsing context.") 31 assert_equals(Object.getPrototypeOf(e).constructor, Event, "The load event should use the Event interface."); 32 assert_true(e.isTrusted, "The load event should be a trusted event."); 33 assert_false(e.cancelable, "The load event should not be a cancelable event."); 34 assert_false(e.bubbles, "The load event should not be a bubble event."); 35 assert_equals(e.target, obj, "The load event target should be the corresponding object element."); 36 }); 37 38 obj.onerror = t.unreached_func("The error event should not be fired."); 39 40 document.body.appendChild(obj); 41 }, "load event of initial about:blank"); 42 </script> 43 </body>