tor-browser

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

whitespace.js (809B)


      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.frombase64
      6 description: Uint8Array.fromBase64 ignores ASCII whitespace in the input
      7 includes: [compareArray.js]
      8 features: [uint8array-base64, TypedArray]
      9 ---*/
     10 
     11 var whitespaceKinds = [
     12  ["Z g==", "space"],
     13  ["Z\tg==", "tab"],
     14  ["Z\x0Ag==", "LF"],
     15  ["Z\x0Cg==", "FF"],
     16  ["Z\x0Dg==", "CR"],
     17 ];
     18 whitespaceKinds.forEach(function(pair) {
     19  var arr = Uint8Array.fromBase64(pair[0]);
     20  assert.sameValue(arr.length, 1);
     21  assert.sameValue(arr.buffer.byteLength, 1);
     22  assert.compareArray(arr, [102], "ascii whitespace: " + pair[1]);
     23 });
     24 
     25 reportCompare(0, 0);