tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

object-events.html (3298B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>HTML Test: object-events</title>
      4 <meta name="timeout" content="long">
      5 <link rel="author" title="Intel" href="http://www.intel.com">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <div id="log"></div>
      9 <script>
     10 
     11 async_test(function(t) {
     12  var obj = document.createElement("object");
     13  obj.onerror = t.step_func_done(function(e){
     14    assert_equals(Object.getPrototypeOf(e).constructor, Event, "The error event should use the Event interface.");
     15    assert_true(e.isTrusted, "The error event should be a trusted event.");
     16    assert_false(e.cancelable, "The error event should not be a cancelable event.");
     17    assert_false(e.bubbles, "The error event should not be a bubble event.");
     18    assert_equals(e.target, obj, "The error event target should be the corresponding object element.");
     19  });
     20 
     21  obj.onload = t.step_func_done(function(e){
     22    assert_unreached("The load event should not be fired.");
     23  });
     24 
     25  obj.data = "file:\\http://nonexistent.html";
     26  document.body.appendChild(obj);
     27 }, "error event (using 'file:' protocol)");
     28 
     29 async_test(function(t) {
     30  var obj = document.createElement("object");
     31  obj.onerror = t.step_func_done(function(e){
     32    assert_equals(e.target, obj,
     33                  "The error event should be fired on our element");
     34  });
     35  obj.onload = t.step_func_done(function(e){
     36    assert_unreached("The load event should not be fired.");
     37  });
     38 
     39  obj.data = "http://test:test";
     40  document.body.appendChild(obj);
     41 }, "error event (using 'http:' protocol)");
     42 
     43 
     44 async_test(function(t) {
     45  var obj = document.createElement("object");
     46  obj.onload = t.step_func_done(function(e){
     47    assert_equals(Object.getPrototypeOf(e).constructor, Event, "The load event should use the Event interface.");
     48    assert_true(e.isTrusted, "The load event should be a trusted event.");
     49    assert_false(e.cancelable, "The load event should not be a cancelable event.");
     50    assert_false(e.bubbles, "The load event should not be a bubble event.");
     51    assert_equals(e.target, obj, "The load event target should be the corresponding object element.");
     52  });
     53 
     54  obj.onerror = t.step_func_done(function(e){
     55    assert_unreached("The error event should not be fired.");
     56  });
     57 
     58  obj.data = "/images/blue.png";
     59  document.body.appendChild(obj);
     60 }, "load event");
     61 
     62 async_test(function(t) {
     63  var obj = document.createElement("object");
     64  obj.onload = t.step_func_done(function(e){
     65    assert_true(obj.contentWindow instanceof obj.contentWindow.Window, "The object element should represent a nested browsing context.")
     66    assert_equals(Object.getPrototypeOf(e).constructor, Event, "The load event should use the Event interface.");
     67    assert_true(e.isTrusted, "The load event should be a trusted event.");
     68    assert_false(e.cancelable, "The load event should not be a cancelable event.");
     69    assert_false(e.bubbles, "The load event should not be a bubble event.");
     70    assert_equals(e.target, obj, "The load event target should be the corresponding object element.");
     71  });
     72 
     73  obj.onerror = t.step_func_done(function(e){
     74    assert_unreached("The error event should not be fired.");
     75  });
     76 
     77  obj.data = "about:blank";
     78  document.body.appendChild(obj);
     79 }, "load event of about:blank");
     80 
     81 </script>