tor-browser

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

S15.1.3.1_A1.11_T2.js (1173B)


      1 // Copyright 2009 the Sputnik authors.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 info: |
      6    If B = 1110xxxx (n = 3) and (string.charAt(k + 4) and
      7    string.charAt(k + 5)) or (string.charAt(k + 7) and
      8    string.charAt(k + 8)) do not represent hexadecimal digits, throw URIError
      9 esid: sec-decodeuri-encodeduri
     10 description: >
     11    Complex tests, string.charAt(k + 7) and string.charAt(k + 8)  do
     12    not represent hexadecimal digits
     13 ---*/
     14 
     15 //CHECK
     16 var result = true;
     17 var interval = [
     18  [0x00, 0x2F],
     19  [0x3A, 0x40],
     20  [0x47, 0x60],
     21  [0x67, 0xFFFF]
     22 ];
     23 for (var indexI = 0; indexI < interval.length; indexI++) {
     24  for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) {
     25    try {
     26      decodeURI("%E0" + "%A0%" + String.fromCharCode(indexJ, indexJ));
     27      result = false;
     28    } catch (e) {
     29      if ((e instanceof URIError) !== true) {
     30        result = false;
     31      }
     32    }
     33  }
     34 }
     35 
     36 if (result !== true) {
     37  throw new Test262Error('#1: If B = 1110xxxx (n = 3) and (string.charAt(k + 7) and  string.charAt(k + 8)) do not represent hexadecimal digits, throw URIError');
     38 }
     39 
     40 reportCompare(0, 0);