Changeset 203853 in webkit


Ignore:
Timestamp:
Jul 28, 2016 6:23:27 PM (8 years ago)
Author:
mark.lam@apple.com
Message:

ASSERTION FAILED in errorProtoFuncToString() when Error name is a single char string.
https://bugs.webkit.org/show_bug.cgi?id=160324
<rdar://problem/27389572>

Reviewed by Keith Miller.

The issue is that errorProtoFuncToString() was using jsNontrivialString() to
generate the error string even when the name string can be a single character
string. This is incorrect. We should be using jsString() instead.

  • runtime/ErrorPrototype.cpp:

(JSC::errorProtoFuncToString):

  • tests/stress/errors-with-simple-names-or-messages-should-not-crash-toString.js: Added.
Location:
trunk/Source/JavaScriptCore
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r203851 r203853  
     12016-07-28  Mark Lam  <mark.lam@apple.com>
     2
     3        ASSERTION FAILED in errorProtoFuncToString() when Error name is a single char string.
     4        https://bugs.webkit.org/show_bug.cgi?id=160324
     5        <rdar://problem/27389572>
     6
     7        Reviewed by Keith Miller.
     8
     9        The issue is that errorProtoFuncToString() was using jsNontrivialString() to
     10        generate the error string even when the name string can be a single character
     11        string.  This is incorrect.  We should be using jsString() instead.
     12
     13        * runtime/ErrorPrototype.cpp:
     14        (JSC::errorProtoFuncToString):
     15        * tests/stress/errors-with-simple-names-or-messages-should-not-crash-toString.js: Added.
     16
    1172016-07-28  Michael Saboff  <msaboff@apple.com>
    218
  • trunk/Source/JavaScriptCore/runtime/ErrorPrototype.cpp

    r201448 r203853  
    119119    // 9. If msg is the empty String, return name.
    120120    if (!messageString.length())
    121         return JSValue::encode(name.isString() ? name : jsNontrivialString(exec, nameString));
     121        return JSValue::encode(name.isString() ? name : jsString(exec, nameString));
    122122
    123123    // 10. Return the result of concatenating name, ":", a single space character, and msg.
Note: See TracChangeset for help on using the changeset viewer.