tor-browser

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

event-handler-handleEvent-ignored.html (1073B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>"handleEvent" property of EventHandler should be ignored</title>
      4 <link rel="help" href="https://html.spec.whatwg.org/#eventhandler">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <div id="log"></div>
      8 <script>
      9 "use strict";
     10 
     11 test(t => {
     12  const handler = Object.create(null, {
     13    handleEvent: {
     14      get: t.unreached_func('"handleEvent" property should not be looked up'),
     15    },
     16  });
     17 
     18  const el = document.createElement("div");
     19  el.onmouseenter = handler;
     20  el.dispatchEvent(new MouseEvent("mouseenter"));
     21 }, 'plain object "mouseenter" handler');
     22 
     23 async_test(t => {
     24  const handler = Object.create(Function.prototype, {
     25    handleEvent: {
     26      get: t.unreached_func('"handleEvent" property should not be looked up'),
     27    },
     28  });
     29  assert_true(handler instanceof Function);
     30 
     31  window.onmessage = handler;
     32  window.postMessage({}, "*");
     33 
     34  step_timeout(() => {
     35    t.done();
     36  }, 50);
     37 }, 'non-callable "message" handler that is instance of Function');
     38 </script>