tor-browser

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

binary.js (725B)


      1 load(libdir + "wasm-binary.js");
      2 
      3 function checkInvalid(body, errorMessage) {
      4    assertErrorMessage(() => new WebAssembly.Module(
      5        moduleWithSections([
      6            typeSection([
      7                { kind: FuncCode, args: [], ret: [] },
      8            ]),
      9            declSection([0]),
     10            bodySection([body]),
     11        ])
     12    ), WebAssembly.CompileError, errorMessage);
     13 }
     14 
     15 const invalidRefBlockType = funcBody({locals:[], body:[
     16    BlockCode,
     17    OptRefCode,
     18    0x42,
     19    EndCode,
     20 ]});
     21 checkInvalid(invalidRefBlockType, /heap type/);
     22 
     23 const invalidTooBigRefType = funcBody({locals:[], body:[
     24    BlockCode,
     25    OptRefCode,
     26    ...varU32(1000000),
     27    EndCode,
     28 ]});
     29 checkInvalid(invalidTooBigRefType, /heap type/);