tor-browser

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

valueOf.any.js (646B)


      1 // META: global=window,dedicatedworker,jsshell,shadowrealm
      2 
      3 test(() => {
      4  const argument = { "value": "i32" };
      5  const thisValues = [
      6    undefined,
      7    null,
      8    true,
      9    "",
     10    Symbol(),
     11    1,
     12    {},
     13    WebAssembly.Global,
     14    WebAssembly.Global.prototype,
     15  ];
     16 
     17  const fn = WebAssembly.Global.prototype.valueOf;
     18 
     19  for (const thisValue of thisValues) {
     20    assert_throws_js(TypeError, () => fn.call(thisValue), `this=${format_value(thisValue)}`);
     21  }
     22 }, "Branding");
     23 
     24 test(() => {
     25  const argument = { "value": "i32" };
     26  const global = new WebAssembly.Global(argument, 0);
     27  assert_equals(global.valueOf({}), 0);
     28 }, "Stray argument");