tor-browser

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

bug1123064.js (702B)


      1 function toint32() {
      2 
      3    // The test case to trigger MToNumberInt32 operation.
      4    var ToInteger = getSelfHostedValue("ToInteger");
      5 
      6    // Case1: The input operand is constant int32.
      7    var result = ToInteger(1);
      8    assertEq(result, 1);
      9 
     10    // Case2: The input operand is constant double.
     11    result = ToInteger(0.12);
     12    assertEq(result, 0);
     13 
     14    // Case3: The input operand is constant float.
     15    result = ToInteger(Math.fround(0.13));
     16    assertEq(result, 0);
     17 
     18    // Case4: The input operand is constant boolean.
     19    result = ToInteger(true);
     20    assertEq(result, 1);
     21 
     22    // Case5: The input operand is null.
     23    result = ToInteger(null);
     24    assertEq(result, 0);
     25 }
     26 
     27 toint32();
     28 toint32();