tor-browser

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

string-coercion.js (669B)


      1 // |reftest| skip-if(!Uint8Array.fromBase64) -- uint8array-base64 is not enabled unconditionally
      2 // Copyright (C) 2024 Kevin Gibbons. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 /*---
      5 esid: sec-uint8array.fromhex
      6 description: Uint8Array.fromHex throws if its argument is not a string
      7 features: [uint8array-base64, TypedArray]
      8 ---*/
      9 
     10 var toStringCalls = 0;
     11 var throwyToString = {
     12  toString: function() {
     13    toStringCalls += 1;
     14    throw new Test262Error("toString called");
     15  }
     16 };
     17 
     18 assert.throws(TypeError, function() {
     19  Uint8Array.fromHex(throwyToString);
     20 });
     21 assert.sameValue(toStringCalls, 0);
     22 
     23 reportCompare(0, 0);