⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 102182 in webkit


Ignore:
Timestamp:
Dec 6, 2011, 2:41:56 PM (15 years ago)
Author:
msaboff@apple.com
Message:

r102146 from 73875 broke fast/js/encode-URI-test.html
https://bugs.webkit.org/show_bug.cgi?id=73950

Reviewed by Gavin Barraclough.

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::globalFuncUnescape): Restructured to handle
the %uHHHH case to output the resulting character
and continue so that a failure in finding 4 hex
digits will fall through and output the '%'.
Due to style check, changed the temporary
character variable to a more descriptive name.

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r102179 r102182  
     12011-12-06  Michael Saboff  <msaboff@apple.com>
     2
     3        r102146 from 73875 broke fast/js/encode-URI-test.html
     4        https://bugs.webkit.org/show_bug.cgi?id=73950
     5
     6        Reviewed by Gavin Barraclough.
     7
     8        * runtime/JSGlobalObjectFunctions.cpp:
     9        (JSC::globalFuncUnescape): Restructured to handle
     10        the %uHHHH case to output the resulting character
     11        and continue so that a failure in finding 4 hex
     12        digits will fall through and output the '%'.
     13        Due to style check, changed the temporary
     14        character variable to a more descriptive name.
     15
    1162011-12-06  Filip Pizlo  <fpizlo@apple.com>
    217
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp

    r102146 r102182  
    647647    if (str.is8Bit()) {
    648648        const LChar* characters = str.characters8();
    649 
     649        LChar convertedLChar;
    650650        while (k < len) {
    651651            const LChar* c = characters + k;
     
    653653                if (isASCIIHexDigit(c[2]) && isASCIIHexDigit(c[3]) && isASCIIHexDigit(c[4]) && isASCIIHexDigit(c[5])) {
    654654                    builder.append(Lexer<UChar>::convertUnicode(c[2], c[3], c[4], c[5]));
    655                     k += 5;
     655                    k += 6;
     656                    continue;
    656657                }
    657658            } else if (c[0] == '%' && k <= len - 3 && isASCIIHexDigit(c[1]) && isASCIIHexDigit(c[2])) {
    658                 builder.append(Lexer<LChar>::convertHex(c[1], c[2]));
     659                convertedLChar = LChar(Lexer<LChar>::convertHex(c[1], c[2]));
     660                c = &convertedLChar;
    659661                k += 2;
    660             } else
    661                 builder.append(*c);
     662            }
     663            builder.append(*c);
    662664            k++;
    663665        }       
     
    667669        while (k < len) {
    668670            const UChar* c = characters + k;
    669             UChar u;
     671            UChar convertedUChar;
    670672            if (c[0] == '%' && k <= len - 6 && c[1] == 'u') {
    671673                if (isASCIIHexDigit(c[2]) && isASCIIHexDigit(c[3]) && isASCIIHexDigit(c[4]) && isASCIIHexDigit(c[5])) {
    672                     u = Lexer<UChar>::convertUnicode(c[2], c[3], c[4], c[5]);
    673                     c = &u;
     674                    convertedUChar = Lexer<UChar>::convertUnicode(c[2], c[3], c[4], c[5]);
     675                    c = &convertedUChar;
    674676                    k += 5;
    675677                }
    676678            } else if (c[0] == '%' && k <= len - 3 && isASCIIHexDigit(c[1]) && isASCIIHexDigit(c[2])) {
    677                 u = UChar(Lexer<UChar>::convertHex(c[1], c[2]));
    678                 c = &u;
     679                convertedUChar = UChar(Lexer<UChar>::convertHex(c[1], c[2]));
     680                c = &convertedUChar;
    679681                k += 2;
    680682            }
Note: See TracChangeset for help on using the changeset viewer.