Bug 1289003 followup - Initialize *smallestEncoding. r=bustage
☠☠ backed out by f73442255a83 ☠ ☠
authorTooru Fujisawa <arai_a@mac.com>
Fri, 02 Sep 2016 20:14:35 +0900
changeset 312402 586730aa152198ece8f016f3098ad2fbf055090b
parent 312401 1d96c286f93e59548bb9462626ebd135b46c6956
child 312403 4ab9576d4c6280d6f7dbbc75ea100d133ace1aad
push id20447
push userkwierso@gmail.com
push dateFri, 02 Sep 2016 20:36:44 +0000
treeherderfx-team@969397f22187 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage
bugs1289003
milestone51.0a1
Bug 1289003 followup - Initialize *smallestEncoding. r=bustage
js/src/vm/CharacterEncoding.cpp
--- a/js/src/vm/CharacterEncoding.cpp
+++ b/js/src/vm/CharacterEncoding.cpp
@@ -262,16 +262,18 @@ static const Latin1Char REPLACE_UTF8_LAT
 
 // If making changes to this algorithm, make sure to also update
 // LossyConvertUTF8toUTF16() in dom/wifi/WifiUtils.cpp
 template <InflateUTF8Action Action, typename CharT>
 static bool
 InflateUTF8StringToBuffer(JSContext* cx, const UTF8Chars src, CharT* dst, size_t* dstlenp,
                           JS::SmallestEncoding *smallestEncoding)
 {
+    if (Action != AssertNoInvalids)
+        *smallestEncoding = JS::SmallestEncoding::ASCII;
     auto RequireLatin1 = [&smallestEncoding]{
         *smallestEncoding = std::max(JS::SmallestEncoding::Latin1, *smallestEncoding);
     };
     auto RequireUTF16 = [&smallestEncoding]{
         *smallestEncoding = JS::SmallestEncoding::UTF16;
     };
 
     // Count how many code units need to be in the inflated string.