tor-browser

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

string-substring-latin1rope-with-twobyte-children.js (438B)


      1 let right = newRope("b", "012345678901234567890123456789");
      2 let latin1Rope = newRope("a", right);
      3 let twoByteRope = newRope("\u221e", right);
      4 
      5 // Flattening |twoByteRope| changes |right| from a Latin-1 rope into a two-byte
      6 // dependent string. At this point, |latin1Rope| has the Latin-1 flag set, but
      7 // also has a two-byte rope child.
      8 ensureLinearString(twoByteRope);
      9 
     10 let result = latin1Rope.substring(0, 3);
     11 
     12 assertEq(result, "ab0");