tor-browser

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

import-function-toPrimitive.js (351B)


      1 var counter = 0;
      2 
      3 function f(stdlib, foreign)
      4 {
      5  "use asm";
      6  var a = +foreign.a;
      7  var b = +foreign.b;
      8  function g() {}
      9  return g;
     10 }
     11 
     12 var foreign =
     13  {
     14    a: function() {},
     15    b: /value that doesn't coerce purely/,
     16  };
     17 
     18 foreign.a[Symbol.toPrimitive] =
     19  function()
     20  {
     21    counter++;
     22    return 0;
     23  };
     24 
     25 f(null, foreign);
     26 assertEq(counter, 1);