Changeset 212085 in webkit


Ignore:
Timestamp:
Feb 10, 2017 12:15:47 AM (7 years ago)
Author:
matthew_hanson@apple.com
Message:

Merge r212009. rdar://problem/29939864

Location:
branches/safari-603-branch
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-603-branch/JSTests/ChangeLog

    r211509 r212085  
     12017-02-09  Matthew Hanson  <matthew_hanson@apple.com>
     2
     3        Merge r212009. rdar://problem/29939864
     4
     5    2017-02-09  Keith Miller  <keith_miller@apple.com>
     6
     7            We should not allow Function.caller to be used on native functions
     8            https://bugs.webkit.org/show_bug.cgi?id=165628
     9
     10            Reviewed by Mark Lam.
     11
     12            * stress/caller-native-code.js: Added.
     13            (f):
     14
    1152017-01-27  Matthew Hanson  <matthew_hanson@apple.com>
    216
  • branches/safari-603-branch/Source/JavaScriptCore/ChangeLog

    r212049 r212085  
     12017-02-09  Matthew Hanson  <matthew_hanson@apple.com>
     2
     3        Merge r212009. rdar://problem/29939864
     4
     5    2017-02-09  Keith Miller  <keith_miller@apple.com>
     6
     7            We should not allow Function.caller to be used on native functions
     8            https://bugs.webkit.org/show_bug.cgi?id=165628
     9
     10            Reviewed by Mark Lam.
     11
     12            Also remove unneeded dynamic cast.
     13
     14            * runtime/JSFunction.cpp:
     15            (JSC::RetrieveCallerFunctionFunctor::RetrieveCallerFunctionFunctor):
     16            (JSC::JSFunction::callerGetter):
     17
    1182017-02-09  Matthew Hanson  <matthew_hanson@apple.com>
    219
  • branches/safari-603-branch/Source/JavaScriptCore/runtime/JSFunction.cpp

    r209897 r212085  
    22 *  Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
    33 *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
    4  *  Copyright (C) 2003-2009, 2015-2016 Apple Inc. All rights reserved.
     4 *  Copyright (C) 2003-2009, 2015-2017 Apple Inc. All rights reserved.
    55 *  Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
    66 *  Copyright (C) 2007 Maks Orlovich
     
    322322    // See ES5.1 15.3.5.4 - Function.caller may not be used to retrieve a strict caller.
    323323    if (!caller.isObject() || !asObject(caller)->inherits(JSFunction::info())) {
    324         // It isn't a JSFunction, but if it is a JSCallee from a program or call eval, return null.
     324        // It isn't a JSFunction, but if it is a JSCallee from a program or eval call or an internal constructor, return null.
    325325        if (jsDynamicCast<JSCallee*>(caller))
     326        if (jsDynamicCast<JSCallee*>(caller) || jsDynamicCast<InternalFunction*>(caller))
    326327            return JSValue::encode(jsNull());
    327328        return JSValue::encode(caller);
    328329    }
    329330    JSFunction* function = jsCast<JSFunction*>(caller);
    330     if (function->isHostOrBuiltinFunction() || !function->jsExecutable()->isStrictMode())
     331
     332    // Firefox returns null for native code callers, so we match that behavior.
     333    if (function->isHostOrBuiltinFunction())
     334        return JSValue::encode(jsNull());
     335    if (!function->jsExecutable()->isStrictMode())
    331336        return JSValue::encode(caller);
    332337    return JSValue::encode(throwTypeError(exec, scope, ASCIILiteral("Function.caller used to retrieve strict caller")));
Note: See TracChangeset for help on using the changeset viewer.