Title: [102182] trunk/Source/_javascript_Core
Revision
102182
Author
msab...@apple.com
Date
2011-12-06 14:41:56 -0800 (Tue, 06 Dec 2011)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (102181 => 102182)


--- trunk/Source/_javascript_Core/ChangeLog	2011-12-06 22:37:12 UTC (rev 102181)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-12-06 22:41:56 UTC (rev 102182)
@@ -1,3 +1,18 @@
+2011-12-06  Michael Saboff  <msab...@apple.com>
+
+        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.
+
 2011-12-06  Filip Pizlo  <fpi...@apple.com>
 
         GC zapping logic could benefit from some more assertions

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp (102181 => 102182)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp	2011-12-06 22:37:12 UTC (rev 102181)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp	2011-12-06 22:41:56 UTC (rev 102182)
@@ -646,19 +646,21 @@
     
     if (str.is8Bit()) {
         const LChar* characters = str.characters8();
-
+        LChar convertedLChar;
         while (k < len) {
             const LChar* c = characters + k;
             if (c[0] == '%' && k <= len - 6 && c[1] == 'u') {
                 if (isASCIIHexDigit(c[2]) && isASCIIHexDigit(c[3]) && isASCIIHexDigit(c[4]) && isASCIIHexDigit(c[5])) {
                     builder.append(Lexer<UChar>::convertUnicode(c[2], c[3], c[4], c[5]));
-                    k += 5;
+                    k += 6;
+                    continue;
                 }
             } else if (c[0] == '%' && k <= len - 3 && isASCIIHexDigit(c[1]) && isASCIIHexDigit(c[2])) {
-                builder.append(Lexer<LChar>::convertHex(c[1], c[2]));
+                convertedLChar = LChar(Lexer<LChar>::convertHex(c[1], c[2]));
+                c = &convertedLChar;
                 k += 2;
-            } else
-                builder.append(*c);
+            }
+            builder.append(*c);
             k++;
         }        
     } else {
@@ -666,16 +668,16 @@
 
         while (k < len) {
             const UChar* c = characters + k;
-            UChar u;
+            UChar convertedUChar;
             if (c[0] == '%' && k <= len - 6 && c[1] == 'u') {
                 if (isASCIIHexDigit(c[2]) && isASCIIHexDigit(c[3]) && isASCIIHexDigit(c[4]) && isASCIIHexDigit(c[5])) {
-                    u = Lexer<UChar>::convertUnicode(c[2], c[3], c[4], c[5]);
-                    c = &u;
+                    convertedUChar = Lexer<UChar>::convertUnicode(c[2], c[3], c[4], c[5]);
+                    c = &convertedUChar;
                     k += 5;
                 }
             } else if (c[0] == '%' && k <= len - 3 && isASCIIHexDigit(c[1]) && isASCIIHexDigit(c[2])) {
-                u = UChar(Lexer<UChar>::convertHex(c[1], c[2]));
-                c = &u;
+                convertedUChar = UChar(Lexer<UChar>::convertHex(c[1], c[2]));
+                c = &convertedUChar;
                 k += 2;
             }
             k++;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to