tor-browser

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

unicode_restricted_identity_escape_x.js (1178B)


      1 // Copyright (C) 2015 André Bargull. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 description: B.1.4 is not applied for Unicode RegExp - Incomplete hexadecimal escape sequences
      6 info: |
      7    The compatibility extensions defined in B.1.4 Regular Expressions Patterns
      8    are not applied for Unicode RegExp.
      9    Tested extension: "IdentityEscape[U] :: [~U] SourceCharacter but not c"
     10 es6id: 21.1.2
     11 ---*/
     12 
     13 // Incomplete HexEscapeSequence in AtomEscape not parsed as IdentityEscape.
     14 //
     15 // AtomEscape[U] :: CharacterEscape[?U]
     16 // CharacterEscape[U] :: HexEscapeSequence
     17 assert.throws(SyntaxError, function() {
     18  RegExp("\\x", "u");
     19 }, 'RegExp("\\x", "u"): ');
     20 assert.throws(SyntaxError, function() {
     21  RegExp("\\x1", "u");
     22 }, 'RegExp("\\x1", "u"): ');
     23 
     24 
     25 // Incomplete HexEscapeSequence in ClassEscape not parsed as IdentityEscape.
     26 //
     27 // ClassEscape[U] :: CharacterEscape[?U]
     28 // CharacterEscape[U] :: HexEscapeSequence
     29 assert.throws(SyntaxError, function() {
     30  RegExp("[\\x]", "u");
     31 }, 'RegExp("[\\x]", "u"): ');
     32 assert.throws(SyntaxError, function() {
     33  RegExp("[\\x1]", "u");
     34 }, 'RegExp("[\\x1]", "u"): ');
     35 
     36 reportCompare(0, 0);