tor-browser

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

performance-bind.html (1657B)


      1 <!DOCTYPE HTML>
      2 <meta charset=utf-8>
      3 <title>performance.bind()</title>
      4 <meta name="timeout" content="long">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="resources/utils.js"></script>
      8 
      9 <body>
     10 <div id="log"></div>
     11 <script>
     12 
     13 test_loaf_script((t, busy_wait) => {
     14    const wrapped = performance.bind(function internal_func() {
     15        busy_wait();
     16    });
     17    t.step_timeout(() => wrapped());
     18 }, "internal_func", "user-entry-point", "A user-defined entry point should appear in the list of scripts");
     19 
     20 test_loaf_script((t, busy_wait) => {
     21    const wrapped = performance.bind(function internal_func(arg) {
     22        assert_equals(arg, 123);
     23        assert_equals(this, globalThis);
     24        busy_wait();
     25    });
     26    t.step_timeout(() => wrapped(123));
     27 }, "internal_func", "user-entry-point", "A user-defined entry point should forward args");
     28 
     29 test_loaf_script((t, busy_wait) => {
     30    const wrapped = performance.bind(function internal_func(arg) {
     31        assert_equals(arg, 123);
     32        assert_equals(this, t);
     33        busy_wait();
     34    }, t);
     35    t.step_timeout(() => wrapped(123));
     36 }, "internal_func", "user-entry-point", "A user-defined entry point should bind thisArg");
     37 
     38 test_loaf_script((t, busy_wait) => {
     39    const wrapped = performance.bind(function internal_func(arg1, arg2) {
     40        assert_equals(arg1, "bound");
     41        assert_equals(arg2, 123);
     42        assert_equals(this, t);
     43        busy_wait();
     44    }, t, "bound");
     45    t.step_timeout(() => wrapped(123));
     46 }, "internal_func", "user-entry-point", "A user-defined entry point should bind additional args");
     47 </script>
     48 </body>