tor-browser

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

table.tentative.any.js (1155B)


      1 // META: global=window,dedicatedworker,jsshell,shadowrealm
      2 // META: script=/wasm/jsapi/assertions.js
      3 
      4 function testfunc(n) {}
      5 
      6 test(() => {
      7    var table = new WebAssembly.Table({element: "anyfunc", initial: 3})
      8    var func1 = new WebAssembly.Function({parameters: ["i32"], results: []}, testfunc)
      9    table.set(0, func1)
     10    var func2 = new WebAssembly.Function({parameters: ["f32"], results: []}, testfunc)
     11    table.set(1, func2)
     12    var func3 = new WebAssembly.Function({parameters: ["i64"], results: []}, testfunc)
     13    table.set(2, func3)
     14 
     15    var first = table.get(0)
     16    assert_true(first instanceof WebAssembly.Function)
     17    assert_equals(first, func1)
     18    assert_equals(first.type().parameters[0], func1.type().parameters[0])
     19 
     20    var second = table.get(1)
     21    assert_true(second instanceof WebAssembly.Function)
     22    assert_equals(second, func2)
     23    assert_equals(second.type().parameters[0], func2.type().parameters[0])
     24 
     25    var third = table.get(2)
     26    assert_true(third instanceof WebAssembly.Function)
     27    assert_equals(third, func3)
     28    assert_equals(third.type().parameters[0], func3.type().parameters[0])
     29 
     30 }, "Test insertion into table")