Changeset 208956 in webkit


Ignore:
Timestamp:
Nov 21, 2016 6:05:27 PM (7 years ago)
Author:
mark.lam@apple.com
Message:

Fix exception scope verification failures in FunctionConstructor.cpp.
https://bugs.webkit.org/show_bug.cgi?id=165011

Reviewed by Saam Barati.

  • runtime/FunctionConstructor.cpp:

(JSC::constructFunction):
(JSC::constructFunctionSkippingEvalEnabledCheck):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r208955 r208956  
     12016-11-21  Mark Lam  <mark.lam@apple.com>
     2
     3        Fix exception scope verification failures in FunctionConstructor.cpp.
     4        https://bugs.webkit.org/show_bug.cgi?id=165011
     5
     6        Reviewed by Saam Barati.
     7
     8        * runtime/FunctionConstructor.cpp:
     9        (JSC::constructFunction):
     10        (JSC::constructFunctionSkippingEvalEnabledCheck):
     11
    1122016-11-21  Mark Lam  <mark.lam@apple.com>
    213
  • trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp

    r208767 r208956  
    8484    if (!globalObject->evalEnabled())
    8585        return throwException(exec, scope, createEvalError(exec, globalObject->evalDisabledErrorMessage()));
     86    scope.release();
    8687    return constructFunctionSkippingEvalEnabledCheck(exec, globalObject, args, functionName, sourceURL, position, -1, functionConstructionMode, newTarget);
    8788}
     
    117118    if (args.isEmpty())
    118119        program = makeString(prefix, functionName.string(), "() {\n\n}}");
    119     else if (args.size() == 1)
    120         program = makeString(prefix, functionName.string(), "() {\n", args.at(0).toString(exec)->value(exec), "\n}}");
    121     else {
     120    else if (args.size() == 1) {
     121        auto body = args.at(0).toWTFString(exec);
     122        RETURN_IF_EXCEPTION(scope, nullptr);
     123        program = makeString(prefix, functionName.string(), "() {\n", body, "\n}}");
     124    } else {
    122125        StringBuilder builder;
    123126        builder.append(prefix);
Note: See TracChangeset for help on using the changeset viewer.